Expose import mode calculation functions#49360
Merged
DanielRosenwasser merged 4 commits intomicrosoft:mainfrom Jun 3, 2022
Merged
Expose import mode calculation functions#49360DanielRosenwasser merged 4 commits intomicrosoft:mainfrom
DanielRosenwasser merged 4 commits intomicrosoft:mainfrom
Conversation
Member
|
@iclanton given changes at microsoft/rushstack#3434, you might want to move that out from |
DanielRosenwasser
requested changes
Jun 2, 2022
src/compiler/program.ts
Outdated
| * @param file File to fetch the resolution mode within | ||
| * @param index Index into the file's complete resolution list to get the resolution of - this is a concatenation of the file's imports and module augmentations | ||
| */ | ||
| export function getModeForResolutionAtIndex(file: SourceFileImportsList, index: number) { |
Member
There was a problem hiding this comment.
Idea:
Suggested change
| export function getModeForResolutionAtIndex(file: SourceFileImportsList, index: number) { | |
| export function getModeForResolutionAtIndex(file: SourceFile, index: number): ModuleKind.CommonJS | ModuleKind.ESNext | undefined; | |
| /** @internal */ | |
| export function getModeForResolutionAtIndex(file: SourceFileImportsList, index: number): ModuleKind.CommonJS | ModuleKind.ESNext | undefined; | |
| export function getModeForResolutionAtIndex(file: SourceFileImportsList, index: number): ModuleKind.CommonJS | ModuleKind.ESNext | undefined { |
Then you don't have to expose SourceFileImportsList
Member
There was a problem hiding this comment.
I've pushed the changes since I think we should get this into 4.7.3.
Member
|
@typescript-bot cherry-pick this to release-4.7 |
Collaborator
|
Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into |
DanielRosenwasser
approved these changes
Jun 3, 2022
typescript-bot
pushed a commit
to typescript-bot/TypeScript
that referenced
this pull request
Jun 3, 2022
Collaborator
|
Hey @DanielRosenwasser, I've opened #49370 for you. |
DanielRosenwasser
added a commit
that referenced
this pull request
Jun 3, 2022
…e-4.7 (#49370) * Cherry-pick PR #49360 into release-4.7 Component commits: 5eb6425 Expose import mode calculation functions 1f907ae Make `SourceFileImportsList` internal again. 4e40185 Accepted API baselines. * Fix lints. Co-authored-by: Daniel Rosenwasser <drosen@microsoft.com> Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #49340
getModeForUsageLocationshould be the preferred function, however you may need to resort togetModeForResolutionAtIndexin some implementations ofresolveModuleNames(though it's potentially unable to handle partial name lists).