[Release-2.0] Fix 9662: Visual Studio 2015 with TS2.0 gives incorrect @types path resolution errors (#9867)

* Change the shape of the shim layer to support getAutomaticTypeDirectives

* Change the key for looking up automatic type-directives

* Update baselines from change look-up name of type-directives

* Add @currentDirectory into the test

* Update baselines

* Fix linting error

* Address PR: fix spelling mistake

* Instead of return path of the type directive names just return type directive names
This commit is contained in:
Yui
2016-08-04 07:43:54 -07:00
committed by GitHub
parent 0a8afc91f6
commit 10b36abc8f
27 changed files with 62 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
[
"======== Resolving type reference directive 'jquery', containing file '/a/b/__inferred type names__.ts', root directory '/a/types'. ========",
"======== Resolving type reference directive 'jquery', containing file '/__inferred type names__.ts', root directory '/a/types'. ========",
"Resolving with primary search path '/a/types'",
"File '/a/types/jquery/package.json' does not exist.",
"File '/a/types/jquery/index.d.ts' exist - use it as a name resolution result.",

View File

@@ -1,5 +1,5 @@
[
"======== Resolving type reference directive 'jquery', containing file '/a/b/__inferred type names__.ts', root directory '/a/types'. ========",
"======== Resolving type reference directive 'jquery', containing file '/a/__inferred type names__.ts', root directory '/a/types'. ========",
"Resolving with primary search path '/a/types'",
"File '/a/types/jquery/package.json' does not exist.",
"File '/a/types/jquery/index.d.ts' exist - use it as a name resolution result.",

View File

@@ -1,5 +1,5 @@
[
"======== Resolving type reference directive 'jquery', containing file '/a/b/__inferred type names__.ts', root directory 'types'. ========",
"======== Resolving type reference directive 'jquery', containing file '/a/__inferred type names__.ts', root directory 'types'. ========",
"Resolving with primary search path 'types'",
"File 'types/jquery/package.json' does not exist.",
"File 'types/jquery/index.d.ts' exist - use it as a name resolution result.",

View File

@@ -5,7 +5,7 @@
"'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.",
"File '/types/jquery/jquery.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/jquery.d.ts', primary: true. ========",
"======== Resolving type reference directive 'jquery', containing file '/__inferred type names__.ts', root directory '/types'. ========",
"======== Resolving type reference directive 'jquery', containing file 'test/__inferred type names__.ts', root directory '/types'. ========",
"Resolving with primary search path '/types'",
"Found 'package.json' at '/types/jquery/package.json'.",
"'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.",

View File

@@ -4,7 +4,7 @@
"File '/node_modules/@types/alpha/package.json' does not exist.",
"File '/node_modules/@types/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/node_modules/@types/alpha/index.d.ts', primary: true. ========",
"======== Resolving type reference directive 'alpha', containing file '/src/__inferred type names__.ts', root directory '/node_modules/@types'. ========",
"======== Resolving type reference directive 'alpha', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========",
"Resolving with primary search path '/node_modules/@types'",
"File '/node_modules/@types/alpha/package.json' does not exist.",
"File '/node_modules/@types/alpha/index.d.ts' exist - use it as a name resolution result.",

View File

@@ -2,7 +2,6 @@
//// [index.d.ts]
interface $ { x }
//// [app.ts]

View File

@@ -9,8 +9,7 @@ interface A {
}
=== /types/lib/index.d.ts ===
interface $ { x }
>$ : Symbol($, Decl(index.d.ts, 0, 0))
>x : Symbol($.x, Decl(index.d.ts, 2, 13))
>x : Symbol($.x, Decl(index.d.ts, 1, 13))

View File

@@ -9,7 +9,6 @@ interface A {
}
=== /types/lib/index.d.ts ===
interface $ { x }
>$ : $
>x : any

View File

@@ -2,7 +2,7 @@
// @traceResolution: true
// @declaration: true
// @typeRoots: /types
// @currentDirectory: /
// @filename: /types/lib/index.d.ts
interface $ { x }

View File

@@ -2,6 +2,7 @@
// @declaration: true
// @typeRoots: /types
// @traceResolution: true
// @currentDirectory: /
// @filename: /ref.d.ts
export interface $ { x }

View File

@@ -4,6 +4,7 @@
// @traceResolution: true
// @types: lib
// @out: output.js
// @currentDirectory: /
// @filename: /types/lib/index.d.ts

View File

@@ -3,6 +3,7 @@
// @typeRoots: /types
// @traceResolution: true
// @out: output.js
// @currentDirectory: /
// @filename: /types/lib/index.d.ts

View File

@@ -2,6 +2,7 @@
// @declaration: true
// @typeRoots: /types
// @traceResolution: true
// @currentDirectory: /
// @filename: /ref.d.ts
export interface $ { x }

View File

@@ -3,6 +3,7 @@
// @declaration: true
// @typeRoots: /types
// @types: lib
// @currentDirectory: /
// @filename: /types/lib/index.d.ts
interface $ { x }

View File

@@ -2,6 +2,7 @@
// @declaration: true
// @typeRoots: /types
// @traceResolution: true
// @currentDirectory: /
// $ comes from d.ts file - no need to add type reference directive

View File

@@ -2,6 +2,7 @@
// @traceResolution: true
// @declaration: true
// @typeRoots: /types
// @currentDirectory: /
// $ comes from d.ts file - no need to add type reference directive

View File

@@ -2,6 +2,7 @@
// @traceResolution: true
// @declaration: true
// @typeRoots: /types
// @currentDirectory: /
// @filename: /ref.d.ts
export interface $ { x }

View File

@@ -2,6 +2,7 @@
// @traceResolution: true
// @declaration: true
// @typeRoots: /types
// @currentDirectory: /
// $ comes from type declaration file - type reference directive should be added

View File

@@ -2,6 +2,7 @@
// @traceResolution: true
// @declaration: true
// @typeRoots: /types
// @currentDirectory: /
// local value shadows global - no need to add type reference directive

View File

@@ -3,6 +3,7 @@
// @typeRoots: /types
// @traceResolution: true
// @types: lib
// @currentDirectory: /
// @filename: /types/lib/index.d.ts

View File

@@ -2,6 +2,7 @@
// @declaration: true
// @typeRoots: /types
// @traceResolution: true
// @currentDirectory: /
// @filename: /types/lib/index.d.ts

View File

@@ -1,5 +1,6 @@
// @noImplicitReferences: true
// @traceResolution: true
// @currentDirectory: /
// load type declarations from types section of tsconfig

View File

@@ -1,5 +1,6 @@
// @traceResolution: true
// @noImplicitReferences: true
// @currentDirectory: /
// @filename: /tsconfig.json
{ "files": "a.ts" }