You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if TypeScript could model situations where new names are added to the global scope.
This was described by a team member as a desirable feature that could definitely be enabled in #7015 (comment). However that issue is closed, and I can't find any other open issue tracking the suggestion, so I opened this one.
A basic example:
// File: foo.ts// Augment the global scope to add foodeclare global {varfoo: Function;// ERROR: Cannot introduce new top level names}// Implement foovarfooImpl=()=>{/***/};foo=fooImpl;// OK - compiler 'sees' global foo hereexportdefaultfooImpl;// Reference foofoo();// OK - compiler 'sees' global foo here
Currently this produces a compiler error as shown above. Interestingly, the global foois recognised at the two other sites where it is referenced in the example. So it appears this would already work just if the error message was suppressed.
The text was updated successfully, but these errors were encountered:
It would be great if TypeScript could model situations where new names are added to the global scope.
This was described by a team member as a desirable feature that could definitely be enabled in #7015 (comment). However that issue is closed, and I can't find any other open issue tracking the suggestion, so I opened this one.
A basic example:
Currently this produces a compiler error as shown above. Interestingly, the global
foo
is recognised at the two other sites where it is referenced in the example. So it appears this would already work just if the error message was suppressed.The text was updated successfully, but these errors were encountered: