Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API Extractor] Add missing required parameter for getResolvedModule to ensure that modules can resolve accurately with Node16/nodenext support #3434

Merged

Conversation

chrisdholt
Copy link
Member

…ypescript can resolve accurately

Summary

With the addition of Node16 and nodenext, Typescript now requires the mode to be passed in order to accurately resolve modules. This PR adds support for mode thanks to the help of @DanielRosenwasser and does so in a way that returns undefined gracefully in case the fn isn't supported in older versions.

This resolves #3433.

Details

  1. Add a third param to getResolvedModule for mode
  2. Create a new function getModeForUsageLocation which maps to the TS equivalent
  3. Update all callers to gracefully look for the right mode and return undefined if necessary

How it was tested

Tested locally with Typescript 4.7.2 and the error is gone, API Extractor succeeds.

Copy link

@EisenbergEffect EisenbergEffect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woohoo! Let's get this in 😄 This is a critical fix needed for us to ship our FAST vNext packages.

@chrisdholt chrisdholt force-pushed the users/chhol/fix-getResolvedModule-params branch from 8afde43 to 18b51b5 Compare May 25, 2022 20:53
@chrisdholt
Copy link
Member Author

Thanks for the review @DanielRosenwasser - build is passing with updated types! @iclanton, @octogonz, @D4N14L, @apostolisms - Apologies for the ping, but curious if anyone is available to work with us on getting this out the door to unblock our release? Thank you!

@iclanton iclanton enabled auto-merge May 25, 2022 22:02
@iclanton iclanton changed the title fix: add missing required parameter for getResolvedModule to ensure that modules can resolve accurately with Node16/nodenext support [API Extractor] Add missing required parameter for getResolvedModule to ensure that modules can resolve accurately with Node16/nodenext support May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[api-extractor] crash when used with TS 4.7.2 moduleResolution Node16
4 participants