Skip to content

[api-extractor] Support .d.mts for documentation and rollups #3116

@mscharley

Description

@mscharley

Summary

I've been messing around with compiling typescript to .mjs and ran into some issues with the rollups/api extraction features:

$ npx api-extractor run --local --diagnostics
api-extractor 7.19.2  - https://api-extractor.com/

Using configuration from ./api-extractor.json

ERROR: Error parsing ./packages/foo/api-extractor.json:
The "mainEntryPointFilePath" value is not a declaration file: ./packages/foo/dist/index.d.mts

Repro steps

  1. Create a simple typescript project.
  2. Instead of using .ts files, name them as .mts.
  3. When compiled, these will result in .mjs, .d.mts and appropriate map files.
  4. Attempt to run api-extractor on the results.

Expected result: API extractor will work as normal.

Actual result: The filename fails validation - I'm not sure if this runs deeper, but the actual contents hasn't seemed to change, other than imports/exports will all refer to ./foo.mjs instead of ./foo.

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.19.2
Operating system? Arch Linux
API Extractor scenario? reporting and rollups
Would you consider contributing a PR? Potentially, if just the filename validation needs updating
TypeScript compiler version? 4.5.4
Node.js version (node -v)? 16.13.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: mediumNeeds a somewhat experienced developerenhancementThe issue is asking for a new feature or design changehelp wantedIf you're looking to contribute, this issue is a good place to start!

    Type

    No type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions