GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Triple-slash reference type directives can override the import mode used for their resolution by weswigham · Pull Request #47732 · microsoft/TypeScript Conversation
|
| processTypeReferenceDirective(fileName, resolvedTypeReferenceDirective, { kind: FileIncludeKind.TypeReferenceDirective, file: file.path, index, }); | ||
| const mode = ref.resolutionMode || file.impliedNodeFormat; | ||
| if (mode && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Node12 && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeNext) { | ||
| programDiagnostics.add(createDiagnosticForRange(file, ref, Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hm, is this going to be problematic (though silenceable with --skipLibCheck) for library code? I guess all library code that’s written with nodenext can potentially present problems for consumers in a different resolution mode, so maybe this is nothing new.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
As-is, this always emits the appropriate |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Oh, I misunderstood. Hm, I’ll have to think about that. I think it complicates the library code problem more. If you happen to compile your library in nodenext but resolution would work for consumers under commonjs, it would be a shame to have errors on those references just for including superfluous syntax. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think on principle I lean toward leaving code the user wrote as-is unless there’s a good reason it needs to be changed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I now omit the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I've mentioned it in some linked issues, but the cache changes in this PR also happen to fix some language service issues to do with format detection caching, and as such this now includes a test to that effect. ♥ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Would be good to get another set of eyes since it’s a big changeset, but looks good to me (for merging after 4.6 RC, I assume). Do you know where the bug in the caching code was that you accidentally fixed?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
In the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Specifically, it wasn't being propagated here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Some comments from looking over the code. I'll look at the tests next.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| tracing?.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName }); | ||
| performance.mark("beforeResolveTypeReference"); | ||
| const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference); | ||
| const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
resolveTypeReferenceDirectiveNamesWorker -> actualResolveTypeReferenceDirectiveNamesWorker
I think our layers of indirection have gotten out of control
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think I basically get what's going on, but I don't think I can predict many of the ramifications. I'd vote that we merge this early enough for people to try it out.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…deOverride3.ts Co-authored-by: Nathan Shively-Sanders <[email protected]>
079515f to
f919c2a
Compare
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
VS Code/language server doesn't properly detectNodeNext module kind based on package.json
Node 12 ESM reports different errors between editor and CLI
There was an error while loading. Please reload this page.