Skip to content

Conversation

@stainless-em
Copy link

Summary

Some libraries need to conditionally import types (ex. for optional peer dependencies), which requires a @ts-ignore annotation on the import in case the user doesn't have the dependency installed. This PR makes api-extractor preserve ts-ignore directives, which would otherwise be lost in the DTS rollup process.

Details

This uses an internal typescript compiler API to be as accurate as possible without introducing a lot of new code to find directive ranges using the public API.

How it was tested

I modified the tests to cover this functionality and ran rush test -t tag:api-extractor-tests.

@stainless-em
Copy link
Author

@microsoft-github-policy-service agree company="Stainless Software"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

1 participant