-
-
Notifications
You must be signed in to change notification settings - Fork 667
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
A way to make AS globals also visible to TS (for VS Code intellisense for example). #1929
Comments
You could try a triple slash reference with a custom d.ts, but in general I'd recommend to avoid |
I'm thinking for In general I do like to avoid globals as much as I can, and I prefer |
Do you mean I'd use |
I would say you should not use |
I know, but like I mentioned, In AssemblyScript making globals is done in a way that TypeScript doesn't understand. Is there some way to make making globals portable? |
Globals are provided by stdlib with some magic currently, and that's pretty much it. I would discourage attempting to introduce globals otherwise, and recommend using Portable variant: // asdom.ts
export const document = ASC_TARGET ? getWasmDocument() : window.document; import { document } from "./asdom"; |
Yeah, It works! Just thinking about when people will want to start using it, telling users how to port code: just setup up tsconfig.json like this, then your DOM code should have the global APIs ready (like with regular DOM). But if that won't be the case, then oh well. Not the end of the world. I think it would be nice though. But I also think having only |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in one week if no further activity occurs. Thank you for your contributions! |
What if we make a special Then for TypeScript, A TS user could use this |
There doesn't seem to be a way to make
@global
AS variables visible to TypeScript. For example, this doesn't work:playground
The text was updated successfully, but these errors were encountered: