Skip to content

Faulty bundled d.ts file generated from API Explorer #160

@andreas-karlsson

Description

@andreas-karlsson

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.

  • Open an issue with api-extractor
  • Add a fix to the bundle process
  • Add a step to verify the bundle with tsc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions