tsc includes a export {} statement in namespaces in built d.ts files. When api-extractor bundles these files it translates the export statement to simply {}; which is invalid and gives the error TS1036: Statements are not allowed in ambient contexts. when consumers are using the library whith skipLibCheck:false.
Expected Behavior
Our build process should generate valid d.ts files.
Possible Solution
The real solution is to get this fixed in api-extractor, in the meantime though, we could hack around it by adding a process to remove the faulty statements. It's doable as a simple text transform. In any case we should add a step to verify that our bundled d.ts files are valid.
tsc
includes aexport {}
statement in namespaces in builtd.ts
files. When api-extractor bundles these files it translates the export statement to simply{};
which is invalid and gives the errorTS1036: Statements are not allowed in ambient contexts.
when consumers are using the library whithskipLibCheck:false
.Expected Behavior
Our build process should generate valid
d.ts
files.Possible Solution
The real solution is to get this fixed in api-extractor, in the meantime though, we could hack around it by adding a process to remove the faulty statements. It's doable as a simple text transform. In any case we should add a step to verify that our bundled
d.ts
files are valid.tsc