Support loading "index.d.ts" using "typesVersions" without "types", "typings", or "main"#27514
Support loading "index.d.ts" using "typesVersions" without "types", "typings", or "main"#275142 commits merged into
Conversation
…typings", or "main"
|
In general I think this looks fine, but it seems you have a test failure. |
| "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.ts' does not exist.", | ||
| "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.tsx' does not exist.", | ||
| "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' does not exist.", | ||
| "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'index'.", |
There was a problem hiding this comment.
Looks like this message will change everytime we change the compiler version (because of version of compiler being in the message) so if we forget about it every version change will introduce test failure?
There was a problem hiding this comment.
You're right. Not sure what we can do about this besides change the message.
There was a problem hiding this comment.
You can use sanitizeTraceResolutionLogEntry in harness/utils.ts to normalize the message for test runs. Its already in use in the compiler/conformance tests.
There was a problem hiding this comment.
Rather, its already being used here.
There was a problem hiding this comment.
So nothing to do? @sheetalkamat @rbuckton Good to merge?
…typings", or "main" (#27514) * Support loading "index.d.ts" using "typesVersions" without "types", "typings", or "main" * Update baseline
Currently "typesVersions" effectively has no effect unless "types", "typings", or "main" is specified in
package.json. But we don't normally require those fields ifindex.d.tsis present. This PR makes "index" the default if none of those fields is specified.(This should make it easier to add a minimal
package.jsonwith types redirects to DefinitelyTyped packages without having to add"types": "index". Those packages should still work without this PR once published because we'll generate a full, verbosepackage.jsonautomatically when publishing, but it's nice to have the user-writtenpackage.jsons on DefinitelyTyped minimal.)