Closed mysticatea closed 5 years ago
That is actually correct. This module is a global script. It is only the module it declares that is a module.
If this module was a module (had a top level import/export), it would actually change the meaning of declare module
to be a module augmentation instead of declaration. Module augmentations can only add types to existing modules instead of declaring new modules.
@mysticatea Hopefully @Kovensky's response is clear, please feel free to reopen if there is more to discuss
What version of TypeScript are you using?
What version of
typescript-estree
are you using?What code were you trying to parse?
What did you expect to happen?
The
sourceType
property ofProgram
node is"module"
because it contains ES2015 module syntax as an ambient module declaration.What actually happened?
The
sourceType
property ofProgram
node was"script"
.