-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Isomorphic global augmentation #12208
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
Comments
Why not use this? declare global {
// Augment Node.js `global`
namespace NodeJS {
interface Global {
wtf: WTF;
}
}
// Augment Browser `window`
interface Window extends NodeJS.Global { }
// Augment Web Worker `self`
interface WorkerGlobalScope extends NodeJS.Global { }
} |
My main gripe is actually with what comes after that. ): |
No reason for TypeScript to handle this. There is proposal to ECMAScript with polyfill |
Pretty sure TS already polyfills much bigger stuff than this, even things on stage 2. (; |
I have filed issue #12902 to track implementing the proposal in https://github.com/tc39/proposal-global I think this would fall from it. |
Currently, there is the need to add a lot of boilerplate code if we want to target more than one global environment, and I was wondering if TypeScript should sugar this a bit.
TypeScript Version:
^2.0.0
Code
Expected behavior:
TypeScript to detect the appropriate global environment, maybe by giving the compiler some sort of isomorphic flag.
Actual behavior:
A lot of boilerplate code to have an isomorphic framework.
The text was updated successfully, but these errors were encountered: