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
https://www.typescriptlang.org/docs/handbook/modules.html
In TypeScript, just as in ECMAScript 2015, any file containing a top-level import or export is considered a module. Conversely, a file without any top-level import or export declarations is treated as a script whose contents are available in the global scope (and therefore to modules as well).
After adding the import, your file gets treated as a module - and therefore the global scope augmentation is okay. If you leave out the declare global, you automatically augment the global scope:
// file: array.d.tsinterfaceArray<T>{remove(elem: T): Array<T>;}// another file:[].remove(undefined);// works!
I want to write that array-extension in TypeScript:
so I need to declare an interface for it. There's nothing in that file, just:
but the compiler cries:
funny is, when I add this line before:
(what has nothing to do with the Array or something - jQuery is not used here), it's okay for the compiler.
What's going on here?
The text was updated successfully, but these errors were encountered: