aspect-build/aspect-cli

[Bug]: gazelle does not support typescript 'declare module' statements

Closed this issue · 1 comments

What happened?

Importable modules can be declared using declare module:

declare module 'module-name' {
   ...
}

and this can then be imported using import 'module-name'.

Gazelle should support this.

Notes

This will require parsing declare module statements from the code to know the importable name, where today we only parse for finding imported libraries (not exported names). Some logic should probably be added to avoid parsing the same code twice, this logic should be shared with the kotlin plugin where the code is parsed twice in the initial mvp.

How to reproduce

In a .d.ts file:

declare module 'generated/declaration-module' {
    export * from '@aspect-test/a';
}

In a .ts file:

import 'generated/declaration-module';

Done, will be synced to the cli repo soon.