Baseline fix, CR comments, lint
This commit is contained in:
parent
576f09f531
commit
e8ac1abbd6
|
@ -341,8 +341,9 @@ namespace ts {
|
|||
type: "list",
|
||||
element: {
|
||||
name: "typeRoots",
|
||||
type: "string"
|
||||
}
|
||||
type: "string",
|
||||
isFilePath: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "types",
|
||||
|
|
|
@ -217,9 +217,9 @@ namespace ts {
|
|||
// Check primary library paths
|
||||
if (typeRoots.length) {
|
||||
if (traceEnabled) {
|
||||
trace(host, Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(', '));
|
||||
trace(host, Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
|
||||
}
|
||||
const primarySearchPaths = options.typeRoots || defaultTypeRoots;
|
||||
const primarySearchPaths = typeRoots;
|
||||
for (const typeRoot of primarySearchPaths) {
|
||||
const candidate = combinePaths(typeRoot, typeReferenceDirectiveName);
|
||||
const candidateDirectory = getDirectoryPath(candidate);
|
||||
|
|
|
@ -2562,7 +2562,7 @@ namespace ts {
|
|||
target?: ScriptTarget;
|
||||
traceResolution?: boolean;
|
||||
types?: string[];
|
||||
// Paths used to used to compute primary types search locations
|
||||
/** Paths used to used to compute primary types search locations */
|
||||
typeRoots?: string[];
|
||||
typesSearchPaths?: string[];
|
||||
/*@internal*/ version?: boolean;
|
||||
|
|
|
@ -316,7 +316,7 @@ namespace ts.server {
|
|||
}
|
||||
|
||||
getDirectories(path: string): string[] {
|
||||
return this.host.getDirectories ? this.host.getDirectories(path) : [];
|
||||
return this.host.getDirectories(path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2141,7 +2141,7 @@ namespace ts {
|
|||
const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames);
|
||||
|
||||
function getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey {
|
||||
return <DocumentRegistryBucketKey>`_${settings.target}|${settings.module}|${settings.noResolve}|${settings.jsx}|${settings.allowJs}|${settings.baseUrl}|${settings.typeRoots}|${JSON.stringify(settings.rootDirs)}|${JSON.stringify(settings.paths)}`;
|
||||
return <DocumentRegistryBucketKey>`_${settings.target}|${settings.module}|${settings.noResolve}|${settings.jsx}|${settings.allowJs}|${settings.baseUrl}|${JSON.stringify(settings.typeRoots)}|${JSON.stringify(settings.rootDirs)}|${JSON.stringify(settings.paths)}`;
|
||||
}
|
||||
|
||||
function getBucketForCompilationSettings(key: DocumentRegistryBucketKey, createIfMissing: boolean): FileMap<DocumentRegistryEntry> {
|
||||
|
|
16
tests/baselines/reference/library-reference-6.symbols
Normal file
16
tests/baselines/reference/library-reference-6.symbols
Normal file
|
@ -0,0 +1,16 @@
|
|||
=== /src/foo.ts ===
|
||||
/// <reference types="alpha" />
|
||||
var x: string = alpha.a;
|
||||
>x : Symbol(x, Decl(foo.ts, 1, 3))
|
||||
>alpha.a : Symbol(a, Decl(index.d.ts, 3, 20))
|
||||
>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11))
|
||||
>a : Symbol(a, Decl(index.d.ts, 3, 20))
|
||||
|
||||
=== /node_modules/@types/alpha/index.d.ts ===
|
||||
|
||||
// The primary lookup folder is relative to tsconfig.json, if present
|
||||
|
||||
declare var alpha: { a: string };
|
||||
>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11))
|
||||
>a : Symbol(a, Decl(index.d.ts, 3, 20))
|
||||
|
|
@ -2,27 +2,11 @@
|
|||
"======== Resolving type reference directive 'alpha', containing file '/src/foo.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' does not exist.",
|
||||
"Looking up in 'node_modules' folder, initial location '/src'",
|
||||
"File '/src/node_modules/alpha.ts' does not exist.",
|
||||
"File '/src/node_modules/alpha.d.ts' does not exist.",
|
||||
"File '/src/node_modules/alpha/package.json' does not exist.",
|
||||
"File '/src/node_modules/alpha/index.ts' does not exist.",
|
||||
"File '/src/node_modules/alpha/index.d.ts' does not exist.",
|
||||
"File '/src/node_modules/@types/alpha.ts' does not exist.",
|
||||
"File '/src/node_modules/@types/alpha.d.ts' does not exist.",
|
||||
"File '/src/node_modules/@types/alpha/package.json' does not exist.",
|
||||
"File '/src/node_modules/@types/alpha/index.ts' does not exist.",
|
||||
"File '/src/node_modules/@types/alpha/index.d.ts' does not exist.",
|
||||
"File '/node_modules/alpha.ts' does not exist.",
|
||||
"File '/node_modules/alpha.d.ts' does not exist.",
|
||||
"File '/node_modules/alpha/package.json' does not exist.",
|
||||
"File '/node_modules/alpha/index.ts' does not exist.",
|
||||
"File '/node_modules/alpha/index.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/alpha.ts' does not exist.",
|
||||
"File '/node_modules/@types/alpha.d.ts' does not exist.",
|
||||
"File '/node_modules/@types/alpha/package.json' does not exist.",
|
||||
"File '/node_modules/@types/alpha/index.ts' does not exist.",
|
||||
"File '/node_modules/@types/alpha/index.d.ts' does not exist.",
|
||||
"======== Type reference directive 'alpha' was not resolved. ========"
|
||||
"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 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.",
|
||||
"======== Type reference directive 'alpha' was successfully resolved to 'node_modules/@types/alpha/index.d.ts', primary: true. ========"
|
||||
]
|
16
tests/baselines/reference/library-reference-6.types
Normal file
16
tests/baselines/reference/library-reference-6.types
Normal file
|
@ -0,0 +1,16 @@
|
|||
=== /src/foo.ts ===
|
||||
/// <reference types="alpha" />
|
||||
var x: string = alpha.a;
|
||||
>x : string
|
||||
>alpha.a : string
|
||||
>alpha : { a: string; }
|
||||
>a : string
|
||||
|
||||
=== /node_modules/@types/alpha/index.d.ts ===
|
||||
|
||||
// The primary lookup folder is relative to tsconfig.json, if present
|
||||
|
||||
declare var alpha: { a: string };
|
||||
>alpha : { a: string; }
|
||||
>a : string
|
||||
|
|
@ -3,11 +3,13 @@
|
|||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/src/a'.",
|
||||
"File '/src/a.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/src/a.ts', result '/src/a.ts'",
|
||||
"======== Module name './a' was successfully resolved to '/src/a.ts'. ========",
|
||||
"======== Resolving module './a.ts' from '/src/c.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
"Loading module as file / folder, candidate module location '/src/a.ts'.",
|
||||
"File '/src/a.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/src/a.ts', result '/src/a.ts'",
|
||||
"======== Module name './a.ts' was successfully resolved to '/src/a.ts'. ========",
|
||||
"======== Resolving module './a.js' from '/src/d.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
|
@ -17,6 +19,7 @@
|
|||
"File '/src/a.js.d.ts' does not exist.",
|
||||
"File name '/src/a.js' has a '.js' extension - stripping it",
|
||||
"File '/src/a.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/src/a.ts', result '/src/a.ts'",
|
||||
"======== Module name './a.js' was successfully resolved to '/src/a.ts'. ========",
|
||||
"======== Resolving module './jquery.js' from '/src/jquery_user_1.ts'. ========",
|
||||
"Module resolution kind is not specified, using 'NodeJs'.",
|
||||
|
@ -28,5 +31,6 @@
|
|||
"File '/src/jquery.ts' does not exist.",
|
||||
"File '/src/jquery.tsx' does not exist.",
|
||||
"File '/src/jquery.d.ts' exist - use it as a name resolution result.",
|
||||
"Resolving real path for '/src/jquery.d.ts', result '/src/jquery.d.ts'",
|
||||
"======== Module name './jquery.js' was successfully resolved to '/src/jquery.d.ts'. ========"
|
||||
]
|
Loading…
Reference in a new issue