Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of empty 'types', 'typings', etc. fields in package.json (…
- Loading branch information
Showing
7 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//// [tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts] //// | ||
|
||
//// [package.json] | ||
{ | ||
"types": "", | ||
"typesVersions": { | ||
">=3.1.0-0": { "*" : ["ts3.1/*"] } | ||
} | ||
} | ||
|
||
//// [index.d.ts] | ||
export const a = 0; | ||
|
||
//// [user.ts] | ||
import { a } from "a"; | ||
|
||
|
||
//// [user.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
=== /a/ts3.1/index.d.ts === | ||
export const a = 0; | ||
>a : Symbol(a, Decl(index.d.ts, 0, 12)) | ||
|
||
=== /b/user.ts === | ||
import { a } from "a"; | ||
>a : Symbol(a, Decl(user.ts, 0, 8)) | ||
|
24 changes: 24 additions & 0 deletions
24
tests/baselines/reference/typesVersions.emptyTypes.trace.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
"======== Resolving module 'a' from '/b/user.ts'. ========", | ||
"Module resolution kind is not specified, using 'NodeJs'.", | ||
"'baseUrl' option is set to '/', using this value to resolve non-relative module name 'a'.", | ||
"Resolving module name 'a' relative to base url '/' - '/a'.", | ||
"Loading module as file / folder, candidate module location '/a', target file type 'TypeScript'.", | ||
"File '/a.ts' does not exist.", | ||
"File '/a.tsx' does not exist.", | ||
"File '/a.d.ts' does not exist.", | ||
"Found 'package.json' at '/a/package.json'.", | ||
"'package.json' has a 'typesVersions' field with version-specific path mappings.", | ||
"'package.json' does not have a 'typings' field.", | ||
"'package.json' had a falsy 'types' field.", | ||
"'package.json' does not have a 'main' field.", | ||
"'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'.", | ||
"Module name 'index', matched pattern '*'.", | ||
"Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", | ||
"File '/a/ts3.1/index' does not exist.", | ||
"Loading module as file / folder, candidate module location '/a/ts3.1/index', target file type 'TypeScript'.", | ||
"File '/a/ts3.1/index.ts' does not exist.", | ||
"File '/a/ts3.1/index.tsx' does not exist.", | ||
"File '/a/ts3.1/index.d.ts' exist - use it as a name resolution result.", | ||
"======== Module name 'a' was successfully resolved to '/a/ts3.1/index.d.ts'. ========" | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
=== /a/ts3.1/index.d.ts === | ||
export const a = 0; | ||
>a : 0 | ||
>0 : 0 | ||
|
||
=== /b/user.ts === | ||
import { a } from "a"; | ||
>a : 0 | ||
|
18 changes: 18 additions & 0 deletions
18
tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// @baseUrl: / | ||
// @traceResolution: true | ||
// @target: esnext | ||
// @module: commonjs | ||
|
||
// @filename: /a/package.json | ||
{ | ||
"types": "", | ||
"typesVersions": { | ||
">=3.1.0-0": { "*" : ["ts3.1/*"] } | ||
} | ||
} | ||
|
||
// @filename: /a/ts3.1/index.d.ts | ||
export const a = 0; | ||
|
||
// @filename: /b/user.ts | ||
import { a } from "a"; |