Skip to content

Impossible to implement LanguageServiceHost::resolveModuleNames without using TS internal getModeForResolutionAtIndexΒ #49340

Description

Suggestion

πŸ” Search Terms

LanguageServiceHost
resolveModuleNames
getModeForResolutionAtIndex

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

Expose ts.getModeForResolutionAtIndex as part of public API, or otherwise provide a way to implement LanguageServiceHost::resolveModuleNames with full NodeNext compatibility.

Alternatively, I might be wrong if there is a different correct way to implement resolveModuleNames.

πŸ“ƒ Motivating Example

This attempted bugfix, where I am using ts.getModeForResolutionAtIndex within my implementation of LanguageServiceHost::resolveModuleNames
TypeStrong/ts-node#1782
Link to the invocation of getModeForResolutionAtIndexhttps://github.com/TypeStrong/ts-node/pull/1782/files#diff-c654137f603e726b39295587f26aee8130da50d8c019ba7e176b201917f17e56R101-R107

πŸ’» Use Cases

ts-node, which JIT compiles and typechecks using the LanguageService, and supports NodeNext

Activity

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

Metadata

Metadata

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions