-
-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unions of References and TypedArrays #828
Comments
Wondering a bit, since union types are not supported. What am I missing? |
/**
* Takes a string and adds "padding" to the left.
* If 'padding' is a string, then 'padding' is appended to the left side.
* If 'padding' is a number, then that number of spaces is added to the left side.
*/
function padLeft(value: string, padding: string | number) {
// ...
}
let indentedString = padLeft("Hello world", true); // errors during compilation Were you thinking intersection types? |
@willemneal that's typescript, not assemblyscript? Assembly script doesn't support unions as far as I've seen and tried? |
Ah yeah I had forgotten. Had seen a lot of And had forgotten. I managed to get around with generics like this: https://webassembly.studio/?f=nw6ffxidsvr Perhaps we can add this to the discussion of #816 since with better type resolution this should be possible. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Aren't issues like these good to keep open? I wonder if perhaps Google and other search engines might de-prioritize closed issues. Also searching for open issues (the default) won't show results. I may have then not created #1548 if I had found this one first. I thought I searched thoroughly before posting (guess I didn't!). |
To anyone coming here for a status update, a more detailed overview of the current status has meanwhile been added to the AS website. No updates on support for union types so far, though. |
The following doesn't compile
with the following error:
Since Uint8Array has a class id, shouldn't this work?
Since WebAssembly.studio is down here is an example with near's fork:
https://studio.nearprotocol.com/?f=1cg9abhe2
The text was updated successfully, but these errors were encountered: