Merge branch 'master' into vfs

This commit is contained in:
Ron Buckton
2018-01-31 11:08:16 -08:00
52 changed files with 664 additions and 90 deletions
+7 -3
View File
@@ -291,14 +291,13 @@ Zeeshan Ahmed <ziishaned@gmail.com>
Orta <orta.therox+github@gmail.com> # Orta Therox
IdeaHunter <admin@fckn.me> # @IdeaHunter
kujon <jakub.korzeniowski@gmail.com> # Jakub Korzeniowski
Matt <begincalendar@users.noreply.github.com> @begincalendar
Matt <begincalendar@users.noreply.github.com> # @begincalendar
meyer <github.com@meyer.fm> # @meyer
micbou <contact@micbou.com> # @micbou
Alan Agius <alan.agius4@gmail.com>
Alex Khomchenko <akhomchenko@gmail.com>
Oussama Ben Brahim <benbraou@gmail.com> benbraou <benbraou@users.noreply.github.com>
Cameron Taggart <cameron.taggart@gmail.com>
csigs <csigs@outlook.com> csigs <csigs@users.noreply.github.com>
Eugene Timokhov <timocov@gmail.com>
Kris Zyp <kriszyp@gmail.com>
Jing Ma <mjingm87@qq.com>
@@ -312,4 +311,9 @@ Stanislav Iliev <gigobest2@gmail.com>
Wenlu Wang <805037171@163.com> wenlu.wang <805037171@163.com> kingwl <805037171@163.com>
Wilson Hobbs <wilsonhobbs1@gmail.com>
Yuval Greenfield <ubershmekel@gmail.com>
Daniel <nieltg@users.noreply.github.com> # @nieltg
Daniel <nieltg@users.noreply.github.com> # @nieltg
Adnan Chowdhury <bttf@users.noreply.github.com>
Esakki Raj <esakkiraj.tce@gmail.com>
Jack Williams <jw@jackw.io>
Philippe Voinov <philippevoinov@gmail.com>
Stephan Ginthör <26004708+Lazarus535@users.noreply.github.com>
+6 -2
View File
@@ -3,6 +3,7 @@ TypeScript is authored by:
* Abubaker Bashir
* Adam Freidin
* Adi Dahiya
* Adnan Chowdhury
* Adrian Leonhard
* Ahmad Farid
* Akshar Patel
@@ -36,6 +37,7 @@ TypeScript is authored by:
* Asad Saeeduddin
* Avery Morin
* Basarat Ali Syed
* @begincalendar
* Ben Duffield
* Ben Mosher
* Benjamin Bock
@@ -59,7 +61,6 @@ TypeScript is authored by:
* Colby Russell
* Colin Snover
* Cotton Hou
* csigs
* Cyrus Najmabadi
* Dafrok Zhang
* Dahan Gong
@@ -87,6 +88,7 @@ TypeScript is authored by:
* Eric Tsang
* Erik Edrosa
* Erik McClenney
* Esakki Raj
* Ethan Resnick
* Ethan Rubio
* Eugene Timokhov
@@ -124,6 +126,7 @@ TypeScript is authored by:
* Ivan Enderlin
* Ivo Gabe de Wolff
* Iwata Hidetaka
* Jack Williams
* Jakub Korzeniowski
* Jakub Młokosiewicz
* James Henry
@@ -182,7 +185,6 @@ TypeScript is authored by:
* Martin Hiller
* Martin Vseticka
* Masahiro Wakame
* Matt
* Matt Bierner
* Matt McCutchen
* Matt Mitchell
@@ -224,6 +226,7 @@ TypeScript is authored by:
* Perry Jiang
* Peter Burns
* Philip Bulley
* Philippe Voinov
* Piero Cangianiello
* @piloopin
* Prayag Verma
@@ -261,6 +264,7 @@ TypeScript is authored by:
* Stanislav Iliev
* Stanislav Sysoev
* Stas Vilchik
* Stephan Ginthör
* Steve Lucco
* Sudheesh Singanamalla
* Sébastien Arod
+1 -1
View File
@@ -1151,7 +1151,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are:
const fileMatcher = cmdLineOptions.files;
const files = fileMatcher
? `src/**/${fileMatcher}`
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'";
: `Gulpfile.ts "scripts/generateLocalizedDiagnosticMessages.ts" "scripts/tslint/**/*.ts" "src/**/*.ts" --exclude "src/lib/*.d.ts"`;
const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`;
console.log("Linting: " + cmd);
child_process.execSync(cmd, { stdio: [0, 1, 2] });
+28 -8
View File
@@ -8330,11 +8330,18 @@ namespace ts {
function instantiateList<T>(items: T[], mapper: TypeMapper, instantiator: (item: T, mapper: TypeMapper) => T): T[] {
if (items && items.length) {
const result: T[] = [];
for (const v of items) {
result.push(instantiator(v, mapper));
for (let i = 0; i < items.length; i++) {
const item = items[i];
const mapped = instantiator(item, mapper);
if (item !== mapped) {
const result = i === 0 ? [] : items.slice(0, i);
result.push(mapped);
for (i++; i < items.length; i++) {
result.push(instantiator(items[i], mapper));
}
return result;
}
}
return result;
}
return items;
}
@@ -8456,8 +8463,13 @@ namespace ts {
}
function instantiateSymbol(symbol: Symbol, mapper: TypeMapper): Symbol {
const links = getSymbolLinks(symbol);
if (links.type && !maybeTypeOfKind(links.type, TypeFlags.Object | TypeFlags.TypeVariable | TypeFlags.Index)) {
// If the type of the symbol is already resolved, and if that type could not possibly
// be affected by instantiation, simply return the symbol itself.
return symbol;
}
if (getCheckFlags(symbol) & CheckFlags.Instantiated) {
const links = getSymbolLinks(symbol);
// If symbol being instantiated is itself a instantiation, fetch the original target and combine the
// type mappers. This ensures that original type identities are properly preserved and that aliases
// always reference a non-aliases.
@@ -8600,14 +8612,20 @@ namespace ts {
return getAnonymousTypeInstantiation(<MappedType>type, mapper);
}
if ((<ObjectType>type).objectFlags & ObjectFlags.Reference) {
return createTypeReference((<TypeReference>type).target, instantiateTypes((<TypeReference>type).typeArguments, mapper));
const typeArguments = (<TypeReference>type).typeArguments;
const newTypeArguments = instantiateTypes(typeArguments, mapper);
return newTypeArguments !== typeArguments ? createTypeReference((<TypeReference>type).target, newTypeArguments) : type;
}
}
if (type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Primitive)) {
return getUnionType(instantiateTypes((<UnionType>type).types, mapper), UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
const types = (<UnionType>type).types;
const newTypes = instantiateTypes(types, mapper);
return newTypes !== types ? getUnionType(newTypes, UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type;
}
if (type.flags & TypeFlags.Intersection) {
return getIntersectionType(instantiateTypes((<IntersectionType>type).types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
const types = (<IntersectionType>type).types;
const newTypes = instantiateTypes(types, mapper);
return newTypes !== types ? getIntersectionType(newTypes, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type;
}
if (type.flags & TypeFlags.Index) {
return getIndexType(instantiateType((<IndexType>type).type, mapper));
@@ -20255,6 +20273,8 @@ namespace ts {
case SyntaxKind.ClassDeclaration:
case SyntaxKind.EnumDeclaration:
return DeclarationSpaces.ExportType | DeclarationSpaces.ExportValue;
case SyntaxKind.SourceFile:
return DeclarationSpaces.ExportType | DeclarationSpaces.ExportValue | DeclarationSpaces.ExportNamespace;
// The below options all declare an Alias, which is allowed to merge with other values within the importing module
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.NamespaceImport:
+21 -26
View File
@@ -1425,9 +1425,9 @@ namespace ts {
}
function directoryOfCombinedPath(fileName: string, basePath: string) {
// Use the `identity` function to avoid canonicalizing the path, as it must remain noncanonical
// Use the `getNormalizedAbsolutePath` function to avoid canonicalizing the path, as it must remain noncanonical
// until consistient casing errors are reported
return getDirectoryPath(toPath(fileName, basePath, identity));
return getDirectoryPath(getNormalizedAbsolutePath(fileName, basePath));
}
/**
@@ -1452,8 +1452,7 @@ namespace ts {
Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
const errors: Diagnostic[] = [];
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames);
const parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, getCanonicalFileName, resolutionStack, errors);
const parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors);
const { raw } = parsedConfig;
const options = extend(existingOptions, parsedConfig.options || {});
options.configFilePath = configFileName;
@@ -1547,7 +1546,10 @@ namespace ts {
raw: any;
options?: CompilerOptions;
typeAcquisition?: TypeAcquisition;
extendedConfigPath?: Path;
/**
* Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet
*/
extendedConfigPath?: string;
}
function isSuccessfulParsedTsconfig(value: ParsedTsconfig) {
@@ -1564,12 +1566,11 @@ namespace ts {
host: ParseConfigHost,
basePath: string,
configFileName: string,
getCanonicalFileName: GetCanonicalFileName,
resolutionStack: Path[],
resolutionStack: string[],
errors: Push<Diagnostic>,
): ParsedTsconfig {
basePath = normalizeSlashes(basePath);
const resolvedPath = toPath(configFileName || "", basePath, getCanonicalFileName);
const resolvedPath = getNormalizedAbsolutePath(configFileName || "", basePath);
if (resolutionStack.indexOf(resolvedPath) >= 0) {
errors.push(createCompilerDiagnostic(Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, [...resolutionStack, resolvedPath].join(" -> ")));
@@ -1577,14 +1578,13 @@ namespace ts {
}
const ownConfig = json ?
parseOwnConfigOfJson(json, host, basePath, getCanonicalFileName, configFileName, errors) :
parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, getCanonicalFileName, configFileName, errors);
parseOwnConfigOfJson(json, host, basePath, configFileName, errors) :
parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors);
if (ownConfig.extendedConfigPath) {
// copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios.
resolutionStack = resolutionStack.concat([resolvedPath]);
const extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, getCanonicalFileName,
resolutionStack, errors);
const extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors);
if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) {
const baseRaw = extendedConfig.raw;
const raw = ownConfig.raw;
@@ -1612,7 +1612,6 @@ namespace ts {
json: any,
host: ParseConfigHost,
basePath: string,
getCanonicalFileName: GetCanonicalFileName,
configFileName: string | undefined,
errors: Push<Diagnostic>
): ParsedTsconfig {
@@ -1625,7 +1624,7 @@ namespace ts {
// It should be removed in future releases - use typeAcquisition instead.
const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition || json.typingOptions, basePath, errors, configFileName);
json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
let extendedConfigPath: Path;
let extendedConfigPath: string;
if (json.extends) {
if (!isString(json.extends)) {
@@ -1633,7 +1632,7 @@ namespace ts {
}
else {
const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, getCanonicalFileName, errors, createCompilerDiagnostic);
extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, errors, createCompilerDiagnostic);
}
}
return { raw: json, options, typeAcquisition, extendedConfigPath };
@@ -1643,13 +1642,12 @@ namespace ts {
sourceFile: JsonSourceFile,
host: ParseConfigHost,
basePath: string,
getCanonicalFileName: GetCanonicalFileName,
configFileName: string | undefined,
errors: Push<Diagnostic>
): ParsedTsconfig {
const options = getDefaultCompilerOptions(configFileName);
let typeAcquisition: TypeAcquisition, typingOptionstypeAcquisition: TypeAcquisition;
let extendedConfigPath: Path;
let extendedConfigPath: string;
const optionsIterator: JsonConversionNotifier = {
onSetValidOptionKeyValueInParent(parentOption: string, option: CommandLineOption, value: CompilerOptionsValue) {
@@ -1670,7 +1668,6 @@ namespace ts {
<string>value,
host,
newBase,
getCanonicalFileName,
errors,
(message, arg0) =>
createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0)
@@ -1712,7 +1709,6 @@ namespace ts {
extendedConfig: string,
host: ParseConfigHost,
basePath: string,
getCanonicalFileName: GetCanonicalFileName,
errors: Push<Diagnostic>,
createDiagnostic: (message: DiagnosticMessage, arg1?: string) => Diagnostic) {
extendedConfig = normalizeSlashes(extendedConfig);
@@ -1721,9 +1717,9 @@ namespace ts {
errors.push(createDiagnostic(Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));
return undefined;
}
let extendedConfigPath = toPath(extendedConfig, basePath, getCanonicalFileName);
let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath);
if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, Extension.Json)) {
extendedConfigPath = `${extendedConfigPath}.json` as Path;
extendedConfigPath = `${extendedConfigPath}.json`;
if (!host.fileExists(extendedConfigPath)) {
errors.push(createDiagnostic(Diagnostics.File_0_does_not_exist, extendedConfig));
return undefined;
@@ -1734,11 +1730,10 @@ namespace ts {
function getExtendedConfig(
sourceFile: JsonSourceFile,
extendedConfigPath: Path,
extendedConfigPath: string,
host: ts.ParseConfigHost,
basePath: string,
getCanonicalFileName: GetCanonicalFileName,
resolutionStack: Path[],
resolutionStack: string[],
errors: Push<Diagnostic>,
): ParsedTsconfig | undefined {
const extendedResult = readJsonConfigFile(extendedConfigPath, path => host.readFile(path));
@@ -1752,14 +1747,14 @@ namespace ts {
const extendedDirname = getDirectoryPath(extendedConfigPath);
const extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname,
getBaseFileName(extendedConfigPath), getCanonicalFileName, resolutionStack, errors);
getBaseFileName(extendedConfigPath), resolutionStack, errors);
if (sourceFile) {
sourceFile.extendedSourceFiles.push(...extendedResult.extendedSourceFiles);
}
if (isSuccessfulParsedTsconfig(extendedConfig)) {
// Update the paths to reflect base path
const relativeDifference = convertToRelativePath(extendedDirname, basePath, getCanonicalFileName);
const relativeDifference = convertToRelativePath(extendedDirname, basePath, identity);
const updatePath = (path: string) => isRootedDiskPath(path) ? path : combinePaths(relativeDifference, path);
const mapPropertiesInRawIfNotUndefined = (propertyName: string) => {
if (raw[propertyName]) {
+39 -11
View File
@@ -801,7 +801,7 @@ namespace ts {
}
const resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state);
if (resolvedFromFile) {
const nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile.path) : undefined;
const nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
const packageId = nm && getPackageJsonInfo(nm.packageDirectory, nm.subModuleName, failedLookupLocations, /*onlyRecordFailures*/ false, state).packageId;
return withPackageId(packageId, resolvedFromFile);
}
@@ -826,12 +826,13 @@ namespace ts {
*
* packageDirectory is the directory of the package itself.
* subModuleName is the path within the package.
* For `blah/node_modules/foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "" }. (Part before "/node_modules/" is ignored.)
* For `/node_modules/foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar" }.
* For `/node_modules/@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar" }.
* For `blah/node_modules/foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "index.d.ts" }. (Part before "/node_modules/" is ignored.)
* For `/node_modules/foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
* For `/node_modules/@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar/index.d.ts" }.
* For `/node_modules/foo/bar/index.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
*/
function parseNodeModuleFromPath(path: string): { packageDirectory: string, subModuleName: string } | undefined {
path = normalizePath(path);
function parseNodeModuleFromPath(resolved: PathAndExtension): { packageDirectory: string, subModuleName: string } | undefined {
const path = normalizePath(resolved.path);
const idx = path.lastIndexOf(nodeModulesPathPart);
if (idx === -1) {
return undefined;
@@ -843,7 +844,7 @@ namespace ts {
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
}
const packageDirectory = path.slice(0, indexAfterPackageName);
const subModuleName = removeExtensionAndIndex(path.slice(indexAfterPackageName + 1));
const subModuleName = removeExtension(path.slice(indexAfterPackageName + 1), resolved.ext) + Extension.Dts;
return { packageDirectory, subModuleName };
}
@@ -852,9 +853,17 @@ namespace ts {
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
}
function removeExtensionAndIndex(path: string): string {
const noExtension = removeFileExtension(path);
return noExtension === "index" ? "" : removeSuffix(noExtension, "/index");
function addExtensionAndIndex(path: string): string {
if (path === "") {
return "index.d.ts";
}
if (endsWith(path, ".d.ts")) {
return path;
}
if (endsWith(path, "/index")) {
return path + ".d.ts";
}
return path + "/index.d.ts";
}
/* @internal */
@@ -955,12 +964,31 @@ namespace ts {
subModuleName: string,
failedLookupLocations: Push<string>,
onlyRecordFailures: boolean,
{ host, traceEnabled }: ModuleResolutionState,
state: ModuleResolutionState,
): { found: boolean, packageJsonContent: PackageJsonPathFields | undefined, packageId: PackageId | undefined } {
const { host, traceEnabled } = state;
const directoryExists = !onlyRecordFailures && directoryProbablyExists(nodeModuleDirectory, host);
const packageJsonPath = pathToPackageJson(nodeModuleDirectory);
if (directoryExists && host.fileExists(packageJsonPath)) {
const packageJsonContent = readJson(packageJsonPath, host);
if (subModuleName === "") { // looking up the root - need to handle types/typings/main redirects for subModuleName
const path = tryReadPackageJsonFields(/*readTypes*/ true, packageJsonContent, nodeModuleDirectory, state);
if (typeof path === "string") {
subModuleName = addExtensionAndIndex(path.substring(nodeModuleDirectory.length + 1));
}
else {
const jsPath = tryReadPackageJsonFields(/*readTypes*/ false, packageJsonContent, nodeModuleDirectory, state);
if (typeof jsPath === "string") {
subModuleName = removeExtension(removeExtension(jsPath.substring(nodeModuleDirectory.length + 1), Extension.Js), Extension.Jsx) + Extension.Dts;
}
else {
subModuleName = "index.d.ts";
}
}
}
if (!endsWith(subModuleName, Extension.Dts)) {
subModuleName = addExtensionAndIndex(subModuleName);
}
const packageId: PackageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string"
? { name: packageJsonContent.name, subModuleName, version: packageJsonContent.version }
: undefined;
+24 -3
View File
@@ -2363,9 +2363,30 @@ namespace ts {
return false;
}
return forEachEmittedFile(getEmitHost(), ({ jsFilePath, declarationFilePath }) =>
isSameFile(jsFilePath, file) ||
(declarationFilePath && isSameFile(declarationFilePath, file)));
// If this is source file, its not emitted file
const filePath = toPath(file);
if (getSourceFileByPath(filePath)) {
return false;
}
// If options have --outFile or --out just check that
const out = options.outFile || options.out;
if (out) {
return isSameFile(filePath, out) || isSameFile(filePath, removeFileExtension(out) + Extension.Dts);
}
// If --outDir, check if file is in that directory
if (options.outDir) {
return containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
}
if (fileExtensionIsOneOf(filePath, supportedJavascriptExtensions) || fileExtensionIs(filePath, Extension.Dts)) {
// Otherwise just check if sourceFile with the name exists
const filePathWithoutExtension = removeFileExtension(filePath);
return !!getSourceFileByPath(combinePaths(filePathWithoutExtension, Extension.Ts) as Path) ||
!!getSourceFileByPath(combinePaths(filePathWithoutExtension, Extension.Tsx) as Path);
}
return false;
}
function isSameFile(file1: string, file2: string) {
+12 -1
View File
@@ -681,10 +681,21 @@ namespace ts {
return getSpanOfTokenAtPosition(sourceFile, node.pos);
}
const pos = nodeIsMissing(errorNode)
const isMissing = nodeIsMissing(errorNode);
const pos = isMissing
? errorNode.pos
: skipTrivia(sourceFile.text, errorNode.pos);
// These asserts should all be satisfied for a properly constructed `errorNode`.
if (isMissing) {
Debug.assert(pos === errorNode.pos, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
Debug.assert(pos === errorNode.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
}
else {
Debug.assert(pos >= errorNode.pos, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
Debug.assert(pos <= errorNode.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
}
return createTextSpanFromBounds(pos, errorNode.end);
}
@@ -6883,4 +6883,48 @@ namespace ts.projectSystem {
});
});
});
describe("tsserverProjectSystem forceConsistentCasingInFileNames", () => {
it("works when extends is specified with a case insensitive file system", () => {
const rootPath = "/Users/username/dev/project";
const file1: FileOrFolder = {
path: `${rootPath}/index.ts`,
content: 'import {x} from "file2";',
};
const file2: FileOrFolder = {
path: `${rootPath}/file2.js`,
content: "",
};
const file2Dts: FileOrFolder = {
path: `${rootPath}/types/file2/index.d.ts`,
content: "export declare const x: string;",
};
const tsconfigAll: FileOrFolder = {
path: `${rootPath}/tsconfig.all.json`,
content: JSON.stringify({
compilerOptions: {
baseUrl: ".",
paths: { file2: ["./file2.js"] },
typeRoots: ["./types"],
forceConsistentCasingInFileNames: true,
},
}),
};
const tsconfig: FileOrFolder = {
path: `${rootPath}/tsconfig.json`,
content: JSON.stringify({ extends: "./tsconfig.all.json" }),
};
const host = createServerHost([file1, file2, file2Dts, libFile, tsconfig, tsconfigAll], { useCaseSensitiveFileNames: false });
const session = createSession(host);
openFilesForSession([file1], session);
const projectService = session.getProjectService();
checkNumberOfProjects(projectService, { configuredProjects: 1 });
const diagnostics = configuredProjectAt(projectService, 0).getLanguageService().getCompilerOptionsDiagnostics();
assert.deepEqual(diagnostics, []);
});
});
}
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5103,6 +5103,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[仅发出 ".d.ts" 声明文件。 ]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5103,6 +5103,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[只發出 '.d.ts' 宣告檔案。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8647,7 +8656,7 @@
<Str Cat="Text">
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['enum declarations' 只可用於 .ts 檔案中。]]></Val>
<Val><![CDATA[「列舉宣告」只可用於 .ts 檔案中。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -19,7 +19,7 @@
<Cmt Name="ManifestData" />
<Cmt Name="Mnemonic" />
<Cmt Name="Note" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
<Cmt Name="UIType" />
<Cmt Name="UTSData" />
<Cmt Name="UTSUI" />
@@ -5112,6 +5112,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Bude vydávat jen soubory deklarací .d.ts.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8656,7 +8665,7 @@
<Str Cat="Text">
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Deklarace výčtu se dají použít jenom v souboru .ts.]]></Val>
<Val><![CDATA[Deklarace enum se dají použít jen v souboru .ts.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5100,6 +5100,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Geben Sie nur .d.ts-Deklarationsdateien aus.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8638,7 +8647,7 @@
<Str Cat="Text">
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA["enum declarations" kann nur in einer TS-Datei verwendet werden.]]></Val>
<Val><![CDATA[enum-Deklarationen können nur in einer TS-Datei verwendet werden.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -19,7 +19,7 @@
<Cmt Name="ManifestData" />
<Cmt Name="Mnemonic" />
<Cmt Name="Note" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
<Cmt Name="UIType" />
<Cmt Name="UTSData" />
<Cmt Name="UTSUI" />
@@ -5112,6 +5112,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Solo deben emitirse archivos de declaración ".d.ts".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8656,7 +8665,7 @@
<Str Cat="Text">
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA["enum declarations" solo se puede usar en un archivo .ts.]]></Val>
<Val><![CDATA[Las declaraciones "enum" solo se pueden usar en un archivo .ts.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -19,7 +19,7 @@
<Cmt Name="ManifestData" />
<Cmt Name="Mnemonic" />
<Cmt Name="Note" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
<Cmt Name="UIType" />
<Cmt Name="UTSData" />
<Cmt Name="UTSUI" />
@@ -5112,6 +5112,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Émettez uniquement les fichiers de déclaration '.d.ts'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8656,7 +8665,7 @@
<Str Cat="Text">
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Les déclarations 'enum' peuvent uniquement être utilisées dans un fichier .ts.]]></Val>
<Val><![CDATA['Les déclarations enum' peuvent uniquement être utilisées dans un fichier .ts.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5103,6 +5103,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Crea solo i file di dichiarazione '.d.ts'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8647,7 +8656,7 @@
<Str Cat="Text">
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['enum declarations' può essere usato solo in un file con estensione ts.]]></Val>
<Val><![CDATA[Le dichiarazioni 'enum' possono essere usate solo in un file con estensione ts.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5103,6 +5103,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['.d.ts' 宣言ファイルのみを生成します。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -14,7 +14,7 @@
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="Note" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5103,6 +5103,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['.d.ts' 선언 파일만 내보냅니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8647,7 +8656,7 @@
<Str Cat="Text">
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['enum declarations'는 .ts 파일에서만 사용할 수 있습니다.]]></Val>
<Val><![CDATA['enum 선언'은 .ts 파일에서만 사용할 수 있습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7,7 +7,7 @@
<Cmt Name="Dev" />
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5093,6 +5093,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Emituj tylko pliki deklaracji „d.ts”.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8631,7 +8640,7 @@
<Str Cat="Text">
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Deklaracji wyliczeń można używać tylko w pliku ts.]]></Val>
<Val><![CDATA[Deklaracji enum można używać tylko w pliku ts.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7,7 +7,7 @@
<Cmt Name="Dev" />
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5093,6 +5093,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Emita somente arquivos de declaração '.d.ts'.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -13,7 +13,7 @@
<Cmt Name="Dev" />
<Cmt Name="LcxAdmin" />
<Cmt Name="Note" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5102,6 +5102,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Порождаются только файлы объявлений ".d.ts".]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8646,7 +8655,7 @@
<Str Cat="Text">
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Объявления перечислений могут использоваться только в TS-файле.]]></Val>
<Val><![CDATA[Объявления перечислений можно использовать только в TS-файле.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -7,7 +7,7 @@
<Cmt Name="Dev" />
<Cmt Name="LcxAdmin" />
<Cmt Name="Loc" />
<Cmt Name="RCCX" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5096,6 +5096,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Yalnızca '.d.ts' bildirim dosyalarını yayımla.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
+5 -2
View File
@@ -33,6 +33,7 @@ namespace ts.server {
const os: {
homedir?(): string;
tmpdir(): string;
platform(): string;
} = require("os");
interface NodeSocket {
@@ -824,8 +825,9 @@ namespace ts.server {
const logger = createLogger();
const sys = <ServerHost>ts.sys;
const nodeVersion = getNodeMajorVersion();
// use watchGuard process on Windows when node version is 4 or later
const useWatchGuard = process.platform === "win32" && getNodeMajorVersion() >= 4;
const useWatchGuard = process.platform === "win32" && nodeVersion >= 4;
const originalWatchDirectory: ServerHost["watchDirectory"] = sys.watchDirectory.bind(sys);
const noopWatcher: FileWatcher = { close: noop };
// This is the function that catches the exceptions when watching directory, and yet lets project service continue to function
@@ -980,8 +982,9 @@ namespace ts.server {
};
logger.info(`Starting TS Server`);
logger.info(`Version: ${versionMajorMinor}`);
logger.info(`Version: ${version}`);
logger.info(`Arguments: ${process.argv.join(" ")}`);
logger.info(`Platform: ${os.platform()} NodeVersion: ${nodeVersion} CaseSensitive: ${sys.useCaseSensitiveFileNames}`);
const ioSession = new IOSession(options);
process.on("uncaughtException", err => {
+10
View File
@@ -22,6 +22,15 @@
"References": {
"match": "^(.*\\/_references\\.js)$",
"exclude": [["^", 1, "$"]]
},
"Datatables.net": {
"match": "^.*\\/(jquery\\.)?dataTables(\\.all)?(\\.min)?\\.js$",
"types": ["datatables.net"]
},
"Ace": {
"match": "^(.*)\\/ace.js",
"exclude": [["^", 1, "/.*"]],
"types": ["ace"]
}
},
"simpleMap": {
@@ -352,6 +361,7 @@
"passport": "passport",
"passport-local": "passport-local",
"path": "pathjs",
"pdfkit":"pdfkit",
"peer": "peerjs",
"peg": "pegjs",
"photoswipe": "photoswipe",
@@ -21,6 +21,8 @@ namespace ts.codefix {
}
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, token: Identifier): void {
changes.replaceNode(sourceFile, token, createPropertyAccess(createThis(), token));
// TODO (https://github.com/Microsoft/TypeScript/issues/21246): use shared helper
suppressLeadingAndTrailingTrivia(token);
changes.replaceRange(sourceFile, { pos: token.getStart(), end: token.end }, createPropertyAccess(createThis(), token));
}
}
+7
View File
@@ -335,6 +335,13 @@ namespace ts.refactor.extractSymbol {
Continue = 1 << 1,
Return = 1 << 2
}
// We believe it's true because the node is from the (unmodified) tree.
Debug.assert(nodeToCheck.pos <= nodeToCheck.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
// For understanding how skipTrivia functioned:
Debug.assert(!positionIsSynthesized(nodeToCheck.pos), "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809");
if (!isStatement(nodeToCheck) && !(isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck))) {
return [createDiagnosticForNode(nodeToCheck, Messages.statementOrExpressionExpected)];
}
@@ -2,7 +2,7 @@
"======== Resolving module 'foo/use' from '/index.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'foo/use' from 'node_modules' folder, target file type 'TypeScript'.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/use@1.2.3'.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/use/index.d.ts@1.2.3'.",
"File '/node_modules/foo/use.ts' does not exist.",
"File '/node_modules/foo/use.tsx' does not exist.",
"File '/node_modules/foo/use.d.ts' exist - use it as a name resolution result.",
@@ -26,12 +26,15 @@
"File '/node_modules/foo/index.ts' does not exist.",
"File '/node_modules/foo/index.tsx' does not exist.",
"File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo@1.2.3'.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/index.d.ts@1.2.3'.",
"======== Module name './index' was successfully resolved to '/node_modules/foo/index.d.ts'. ========",
"======== Resolving module 'foo' from '/node_modules/a/index.d.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.",
"Found 'package.json' at '/node_modules/a/node_modules/foo/package.json'. Package ID is 'foo@1.2.3'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' does not have a 'main' field.",
"Found 'package.json' at '/node_modules/a/node_modules/foo/package.json'. Package ID is 'foo/index.d.ts@1.2.3'.",
"File '/node_modules/a/node_modules/foo.ts' does not exist.",
"File '/node_modules/a/node_modules/foo.tsx' does not exist.",
"File '/node_modules/a/node_modules/foo.d.ts' does not exist.",
@@ -2,7 +2,7 @@
"======== Resolving module '@foo/bar/use' from '/index.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module '@foo/bar/use' from 'node_modules' folder, target file type 'TypeScript'.",
"Found 'package.json' at '/node_modules/@foo/bar/package.json'. Package ID is '@foo/bar/use@1.2.3'.",
"Found 'package.json' at '/node_modules/@foo/bar/package.json'. Package ID is '@foo/bar/use/index.d.ts@1.2.3'.",
"File '/node_modules/@foo/bar/use.ts' does not exist.",
"File '/node_modules/@foo/bar/use.tsx' does not exist.",
"File '/node_modules/@foo/bar/use.d.ts' exist - use it as a name resolution result.",
@@ -26,12 +26,15 @@
"File '/node_modules/@foo/bar/index.ts' does not exist.",
"File '/node_modules/@foo/bar/index.tsx' does not exist.",
"File '/node_modules/@foo/bar/index.d.ts' exist - use it as a name resolution result.",
"Found 'package.json' at '/node_modules/@foo/bar/package.json'. Package ID is '@foo/bar@1.2.3'.",
"Found 'package.json' at '/node_modules/@foo/bar/package.json'. Package ID is '@foo/bar/index.d.ts@1.2.3'.",
"======== Module name './index' was successfully resolved to '/node_modules/@foo/bar/index.d.ts'. ========",
"======== Resolving module '@foo/bar' from '/node_modules/a/index.d.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module '@foo/bar' from 'node_modules' folder, target file type 'TypeScript'.",
"Found 'package.json' at '/node_modules/a/node_modules/@foo/bar/package.json'. Package ID is '@foo/bar@1.2.3'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' does not have a 'main' field.",
"Found 'package.json' at '/node_modules/a/node_modules/@foo/bar/package.json'. Package ID is '@foo/bar/index.d.ts@1.2.3'.",
"File '/node_modules/a/node_modules/@foo/bar.ts' does not exist.",
"File '/node_modules/a/node_modules/@foo/bar.tsx' does not exist.",
"File '/node_modules/a/node_modules/@foo/bar.d.ts' does not exist.",
@@ -1,6 +1,7 @@
[
"======== Resolving type reference directive 'jquery', containing file '/foo/consumer.ts', root directory './types'. ========",
"Resolving with primary search path './types'.",
"'package.json' has 'typings' field 'jquery.d.ts' that references 'types/jquery/jquery.d.ts'.",
"Found 'package.json' at './types/jquery/package.json'.",
"'package.json' has 'typings' 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.",
@@ -8,6 +9,7 @@
"======== Type reference directive 'jquery' was successfully resolved to '/foo/types/jquery/jquery.d.ts', primary: true. ========",
"======== Resolving type reference directive 'jquery', containing file '/foo/__inferred type names__.ts', root directory './types'. ========",
"Resolving with primary search path './types'.",
"'package.json' has 'typings' field 'jquery.d.ts' that references 'types/jquery/jquery.d.ts'.",
"Found 'package.json' at './types/jquery/package.json'.",
"'package.json' has 'typings' 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.",
@@ -3,6 +3,7 @@
"Root directory cannot be determined, skipping primary search paths.",
"Looking up in 'node_modules' folder, initial location '/a/b'.",
"Directory '/a/b/node_modules' does not exist, skipping all lookups in it.",
"'package.json' has 'typings' field 'jquery.d.ts' that references '/a/node_modules/jquery/jquery.d.ts'.",
"Found 'package.json' at '/a/node_modules/jquery/package.json'.",
"File '/a/node_modules/jquery.d.ts' does not exist.",
"'package.json' has 'typings' field 'jquery.d.ts' that references '/a/node_modules/jquery/jquery.d.ts'.",
@@ -3,6 +3,8 @@
"Root directory cannot be determined, skipping primary search paths.",
"Looking up in 'node_modules' folder, initial location '/a/b'.",
"Directory '/a/b/node_modules' does not exist, skipping all lookups in it.",
"'package.json' does not have a 'typings' field.",
"'package.json' has 'types' field 'dist/jquery.d.ts' that references '/a/node_modules/jquery/dist/jquery.d.ts'.",
"Found 'package.json' at '/a/node_modules/jquery/package.json'.",
"File '/a/node_modules/jquery.d.ts' does not exist.",
"'package.json' does not have a 'typings' field.",
@@ -1,6 +1,8 @@
[
"======== Resolving type reference directive 'jquery', containing file '/consumer.ts', root directory '/types'. ========",
"Resolving with primary search path '/types'.",
"'package.json' does not have a 'typings' field.",
"'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.",
"Found 'package.json' at '/types/jquery/package.json'.",
"'package.json' does not have a 'typings' field.",
"'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.",
@@ -9,6 +11,8 @@
"======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/jquery.d.ts', primary: true. ========",
"======== Resolving type reference directive 'jquery', containing file '/test/__inferred type names__.ts', root directory '/types'. ========",
"Resolving with primary search path '/types'.",
"'package.json' does not have a 'typings' field.",
"'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.",
"Found 'package.json' at '/types/jquery/package.json'.",
"'package.json' does not have a 'typings' field.",
"'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.",
@@ -0,0 +1,23 @@
//// [tests/cases/compiler/moduleLocalImportNotIncorrectlyRedirected.ts] ////
//// [package.json]
{
"name": "troublesome-lib",
"typings": "lib/index.d.ts",
"version": "0.0.1"
}
//// [index.d.ts]
import { Position } from './utilities/positioning';
export interface ISpinButton {}
//// [positioning.d.ts]
export * from './positioning/index';
//// [index.d.ts]
export declare enum Position {
top,
}
//// [index.ts]
import { ISpinButton } from "troublesome-lib";
//// [index.js]
"use strict";
exports.__esModule = true;
@@ -0,0 +1,20 @@
=== tests/cases/compiler/index.ts ===
import { ISpinButton } from "troublesome-lib";
>ISpinButton : Symbol(ISpinButton, Decl(index.ts, 0, 8))
=== tests/cases/compiler/node_modules/troublesome-lib/lib/index.d.ts ===
import { Position } from './utilities/positioning';
>Position : Symbol(Position, Decl(index.d.ts, 0, 8))
export interface ISpinButton {}
>ISpinButton : Symbol(ISpinButton, Decl(index.d.ts, 0, 51))
=== tests/cases/compiler/node_modules/troublesome-lib/lib/utilities/positioning.d.ts ===
export * from './positioning/index';
No type information for this code.=== tests/cases/compiler/node_modules/troublesome-lib/lib/utilities/positioning/index.d.ts ===
export declare enum Position {
>Position : Symbol(Position, Decl(index.d.ts, 0, 0))
top,
>top : Symbol(Position.top, Decl(index.d.ts, 0, 30))
}
@@ -0,0 +1,20 @@
=== tests/cases/compiler/index.ts ===
import { ISpinButton } from "troublesome-lib";
>ISpinButton : any
=== tests/cases/compiler/node_modules/troublesome-lib/lib/index.d.ts ===
import { Position } from './utilities/positioning';
>Position : typeof Position
export interface ISpinButton {}
>ISpinButton : ISpinButton
=== tests/cases/compiler/node_modules/troublesome-lib/lib/utilities/positioning.d.ts ===
export * from './positioning/index';
No type information for this code.=== tests/cases/compiler/node_modules/troublesome-lib/lib/utilities/positioning/index.d.ts ===
export declare enum Position {
>Position : Position
top,
>top : Position
}
@@ -2,6 +2,9 @@
"======== Resolving module 'normalize.css' from '/a.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'normalize.css' from 'node_modules' folder, target file type 'TypeScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' has 'main' field 'normalize.css' that references '/node_modules/normalize.css/normalize.css'.",
"Found 'package.json' at '/node_modules/normalize.css/package.json'.",
"File '/node_modules/normalize.css.ts' does not exist.",
"File '/node_modules/normalize.css.tsx' does not exist.",
@@ -13,6 +16,9 @@
"File '/node_modules/normalize.css/index.d.ts' does not exist.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"Loading module 'normalize.css' from 'node_modules' folder, target file type 'JavaScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' has 'main' field 'normalize.css' that references '/node_modules/normalize.css/normalize.css'.",
"Found 'package.json' at '/node_modules/normalize.css/package.json'.",
"File '/node_modules/normalize.css.js' does not exist.",
"File '/node_modules/normalize.css.jsx' does not exist.",
@@ -2,6 +2,8 @@
"======== Resolving module 'foo' from '/a.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' has 'types' field 'foo.js' that references '/node_modules/foo/foo.js'.",
"Found 'package.json' at '/node_modules/foo/package.json'.",
"File '/node_modules/foo.ts' does not exist.",
"File '/node_modules/foo.tsx' does not exist.",
@@ -24,6 +26,8 @@
"File '/node_modules/foo/index.d.ts' does not exist.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"Loading module 'foo' from 'node_modules' folder, target file type 'JavaScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' has 'types' field 'foo.js' that references '/node_modules/foo/foo.js'.",
"Found 'package.json' at '/node_modules/foo/package.json'.",
"File '/node_modules/foo.js' does not exist.",
"File '/node_modules/foo.jsx' does not exist.",
@@ -2,6 +2,8 @@
"======== Resolving module 'foo/bar' from '/a.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'foo/bar' from 'node_modules' folder, target file type 'TypeScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' has 'types' field 'types.d.ts' that references '/node_modules/foo/bar/types.d.ts'.",
"Found 'package.json' at '/node_modules/foo/bar/package.json'.",
"File '/node_modules/foo/bar.ts' does not exist.",
"File '/node_modules/foo/bar.tsx' does not exist.",
@@ -2,6 +2,8 @@
"======== Resolving module 'foo/@bar' from '/a.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'foo/@bar' from 'node_modules' folder, target file type 'TypeScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' has 'types' field 'types.d.ts' that references '/node_modules/foo/@bar/types.d.ts'.",
"Found 'package.json' at '/node_modules/foo/@bar/package.json'.",
"File '/node_modules/foo/@bar.ts' does not exist.",
"File '/node_modules/foo/@bar.tsx' does not exist.",
@@ -2,6 +2,8 @@
"======== Resolving module '@foo/bar' from '/a.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module '@foo/bar' from 'node_modules' folder, target file type 'TypeScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' has 'types' field 'types.d.ts' that references '/node_modules/@foo/bar/types.d.ts'.",
"Found 'package.json' at '/node_modules/@foo/bar/package.json'.",
"File '/node_modules/@foo/bar.ts' does not exist.",
"File '/node_modules/@foo/bar.tsx' does not exist.",
@@ -3,7 +3,7 @@
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'foo/bar' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/foo/bar/package.json' does not exist.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/bar@1.2.3'.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/bar/index.d.ts@1.2.3'.",
"File '/node_modules/foo/bar.ts' does not exist.",
"File '/node_modules/foo/bar.tsx' does not exist.",
"File '/node_modules/foo/bar.d.ts' does not exist.",
@@ -13,7 +13,7 @@
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"Loading module 'foo/bar' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/foo/bar/package.json' does not exist.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/bar@1.2.3'.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/bar/index.d.ts@1.2.3'.",
"File '/node_modules/foo/bar.js' does not exist.",
"File '/node_modules/foo/bar.jsx' does not exist.",
"File '/node_modules/foo/bar/index.js' exist - use it as a name resolution result.",
@@ -3,7 +3,7 @@
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'foo/@bar' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/foo/@bar/package.json' does not exist.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/@bar@1.2.3'.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/@bar/index.d.ts@1.2.3'.",
"File '/node_modules/foo/@bar.ts' does not exist.",
"File '/node_modules/foo/@bar.tsx' does not exist.",
"File '/node_modules/foo/@bar.d.ts' does not exist.",
@@ -13,7 +13,7 @@
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"Loading module 'foo/@bar' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/foo/@bar/package.json' does not exist.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/@bar@1.2.3'.",
"Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/@bar/index.d.ts@1.2.3'.",
"File '/node_modules/foo/@bar.js' does not exist.",
"File '/node_modules/foo/@bar.jsx' does not exist.",
"File '/node_modules/foo/@bar/index.js' exist - use it as a name resolution result.",
@@ -0,0 +1,25 @@
tests/cases/compiler/file1.ts(5,1): error TS2708: Cannot use namespace 'Library' as a value.
tests/cases/compiler/file2.ts(1,8): error TS2440: Import declaration conflicts with local declaration of 'Lib'.
tests/cases/compiler/file2.ts(6,12): error TS2694: Namespace 'Lib' has no exported member 'Bar'.
==== tests/cases/compiler/file1.ts (1 errors) ====
export namespace Library {
export type Bar = { a: number };
}
var x: Library.Bar; // should work
Library.foo; // should be an error
~~~~~~~
!!! error TS2708: Cannot use namespace 'Library' as a value.
==== tests/cases/compiler/file2.ts (2 errors) ====
import * as Lib from './file1';
~~~~~~~~
!!! error TS2440: Import declaration conflicts with local declaration of 'Lib'.
namespace Lib { // should fail to merge
export const foo: string = "";
}
Lib.foo; // should work
var x: Lib.Bar; // should be an error
~~~
!!! error TS2694: Namespace 'Lib' has no exported member 'Bar'.
export { Lib }
@@ -0,0 +1,32 @@
//// [tests/cases/compiler/namespaceMergedWithImportAliasNoCrash.ts] ////
//// [file1.ts]
export namespace Library {
export type Bar = { a: number };
}
var x: Library.Bar; // should work
Library.foo; // should be an error
//// [file2.ts]
import * as Lib from './file1';
namespace Lib { // should fail to merge
export const foo: string = "";
}
Lib.foo; // should work
var x: Lib.Bar; // should be an error
export { Lib }
//// [file1.js]
"use strict";
exports.__esModule = true;
var x; // should work
Library.foo; // should be an error
//// [file2.js]
"use strict";
exports.__esModule = true;
var Lib;
(function (Lib) {
Lib.foo = "";
})(Lib || (Lib = {}));
exports.Lib = Lib;
Lib.foo; // should work
var x; // should be an error
@@ -0,0 +1,36 @@
=== tests/cases/compiler/file1.ts ===
export namespace Library {
>Library : Symbol(Library, Decl(file1.ts, 0, 0))
export type Bar = { a: number };
>Bar : Symbol(Bar, Decl(file1.ts, 0, 26))
>a : Symbol(a, Decl(file1.ts, 1, 23))
}
var x: Library.Bar; // should work
>x : Symbol(x, Decl(file1.ts, 3, 3))
>Library : Symbol(Library, Decl(file1.ts, 0, 0))
>Bar : Symbol(Library.Bar, Decl(file1.ts, 0, 26))
Library.foo; // should be an error
=== tests/cases/compiler/file2.ts ===
import * as Lib from './file1';
>Lib : Symbol(Lib, Decl(file2.ts, 0, 6), Decl(file2.ts, 0, 31))
namespace Lib { // should fail to merge
>Lib : Symbol(Lib, Decl(file2.ts, 0, 6), Decl(file2.ts, 0, 31))
export const foo: string = "";
>foo : Symbol(foo, Decl(file2.ts, 2, 16))
}
Lib.foo; // should work
>Lib.foo : Symbol(Lib.foo, Decl(file2.ts, 2, 16))
>Lib : Symbol(Lib, Decl(file2.ts, 0, 6), Decl(file2.ts, 0, 31))
>foo : Symbol(Lib.foo, Decl(file2.ts, 2, 16))
var x: Lib.Bar; // should be an error
>x : Symbol(x, Decl(file2.ts, 5, 3))
>Lib : Symbol(Lib, Decl(file2.ts, 0, 6), Decl(file2.ts, 0, 31))
export { Lib }
>Lib : Symbol(Lib, Decl(file2.ts, 6, 8))
@@ -0,0 +1,42 @@
=== tests/cases/compiler/file1.ts ===
export namespace Library {
>Library : any
export type Bar = { a: number };
>Bar : Bar
>a : number
}
var x: Library.Bar; // should work
>x : Library.Bar
>Library : any
>Bar : Library.Bar
Library.foo; // should be an error
>Library.foo : any
>Library : any
>foo : any
=== tests/cases/compiler/file2.ts ===
import * as Lib from './file1';
>Lib : typeof Lib
namespace Lib { // should fail to merge
>Lib : typeof Lib
export const foo: string = "";
>foo : string
>"" : ""
}
Lib.foo; // should work
>Lib.foo : string
>Lib : typeof Lib
>foo : string
var x: Lib.Bar; // should be an error
>x : any
>Lib : any
>Bar : No type information available!
export { Lib }
>Lib : typeof Lib
@@ -2,6 +2,9 @@
"======== Resolving module 'foo' from '/a.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' has 'main' field 'oof' that references '/node_modules/foo/oof'.",
"Found 'package.json' at '/node_modules/foo/package.json'.",
"File '/node_modules/foo.ts' does not exist.",
"File '/node_modules/foo.tsx' does not exist.",
@@ -13,6 +16,9 @@
"File '/node_modules/foo/index.d.ts' does not exist.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"Loading module 'foo' from 'node_modules' folder, target file type 'JavaScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' has 'main' field 'oof' that references '/node_modules/foo/oof'.",
"Found 'package.json' at '/node_modules/foo/package.json'.",
"File '/node_modules/foo.js' does not exist.",
"File '/node_modules/foo.jsx' does not exist.",
@@ -25,6 +31,9 @@
"======== Resolving module 'bar' from '/a.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'bar' from 'node_modules' folder, target file type 'TypeScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' has 'main' field 'rab.js' that references '/node_modules/bar/rab.js'.",
"Found 'package.json' at '/node_modules/bar/package.json'.",
"File '/node_modules/bar.ts' does not exist.",
"File '/node_modules/bar.tsx' does not exist.",
@@ -36,6 +45,9 @@
"File '/node_modules/bar/index.d.ts' does not exist.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"Loading module 'bar' from 'node_modules' folder, target file type 'JavaScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' has 'main' field 'rab.js' that references '/node_modules/bar/rab.js'.",
"Found 'package.json' at '/node_modules/bar/package.json'.",
"File '/node_modules/bar.js' does not exist.",
"File '/node_modules/bar.jsx' does not exist.",
@@ -46,6 +58,9 @@
"======== Resolving module 'baz' from '/a.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'baz' from 'node_modules' folder, target file type 'TypeScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' has 'main' field 'zab' that references '/node_modules/baz/zab'.",
"Found 'package.json' at '/node_modules/baz/package.json'.",
"File '/node_modules/baz.ts' does not exist.",
"File '/node_modules/baz.tsx' does not exist.",
@@ -57,6 +72,9 @@
"File '/node_modules/baz/index.d.ts' does not exist.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"Loading module 'baz' from 'node_modules' folder, target file type 'JavaScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' has 'main' field 'zab' that references '/node_modules/baz/zab'.",
"Found 'package.json' at '/node_modules/baz/package.json'.",
"File '/node_modules/baz.js' does not exist.",
"File '/node_modules/baz.jsx' does not exist.",
@@ -2,6 +2,9 @@
"======== Resolving module 'foo' from '/a.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
"Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' has 'main' field 'oof' that references '/node_modules/foo/oof'.",
"Found 'package.json' at '/node_modules/foo/package.json'.",
"File '/node_modules/foo.ts' does not exist.",
"File '/node_modules/foo.tsx' does not exist.",
@@ -13,6 +16,9 @@
"File '/node_modules/foo/index.d.ts' does not exist.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"Loading module 'foo' from 'node_modules' folder, target file type 'JavaScript'.",
"'package.json' does not have a 'typings' field.",
"'package.json' does not have a 'types' field.",
"'package.json' has 'main' field 'oof' that references '/node_modules/foo/oof'.",
"Found 'package.json' at '/node_modules/foo/package.json'.",
"File '/node_modules/foo.js' does not exist.",
"File '/node_modules/foo.jsx' does not exist.",
@@ -5,6 +5,7 @@
"File '/node_modules/jquery.ts' does not exist.",
"File '/node_modules/jquery.tsx' does not exist.",
"File '/node_modules/jquery.d.ts' does not exist.",
"'package.json' has 'typings' field 'jquery.d.ts' that references '/node_modules/@types/jquery/jquery.d.ts'.",
"Found 'package.json' at '/node_modules/@types/jquery/package.json'.",
"File '/node_modules/@types/jquery.d.ts' does not exist.",
"'package.json' has 'typings' field 'jquery.d.ts' that references '/node_modules/@types/jquery/jquery.d.ts'.",
@@ -17,6 +18,7 @@
"File '/node_modules/kquery.ts' does not exist.",
"File '/node_modules/kquery.tsx' does not exist.",
"File '/node_modules/kquery.d.ts' does not exist.",
"'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.",
"Found 'package.json' at '/node_modules/@types/kquery/package.json'.",
"File '/node_modules/@types/kquery.d.ts' does not exist.",
"'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.",
@@ -33,6 +35,7 @@
"File '/node_modules/lquery.ts' does not exist.",
"File '/node_modules/lquery.tsx' does not exist.",
"File '/node_modules/lquery.d.ts' does not exist.",
"'package.json' has 'typings' field 'lquery' that references '/node_modules/@types/lquery/lquery'.",
"Found 'package.json' at '/node_modules/@types/lquery/package.json'.",
"File '/node_modules/@types/lquery.d.ts' does not exist.",
"'package.json' has 'typings' field 'lquery' that references '/node_modules/@types/lquery/lquery'.",
@@ -47,6 +50,7 @@
"File '/node_modules/mquery.ts' does not exist.",
"File '/node_modules/mquery.tsx' does not exist.",
"File '/node_modules/mquery.d.ts' does not exist.",
"'package.json' has 'typings' field 'mquery' that references '/node_modules/@types/mquery/mquery'.",
"Found 'package.json' at '/node_modules/@types/mquery/package.json'.",
"File '/node_modules/@types/mquery.d.ts' does not exist.",
"'package.json' has 'typings' field 'mquery' that references '/node_modules/@types/mquery/mquery'.",
@@ -61,6 +65,7 @@
"======== Module name 'mquery' was successfully resolved to '/node_modules/@types/mquery/mquery/index.tsx'. ========",
"======== Resolving type reference directive 'jquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========",
"Resolving with primary search path '/node_modules/@types'.",
"'package.json' has 'typings' field 'jquery.d.ts' that references '/node_modules/@types/jquery/jquery.d.ts'.",
"Found 'package.json' at '/node_modules/@types/jquery/package.json'.",
"'package.json' has 'typings' field 'jquery.d.ts' that references '/node_modules/@types/jquery/jquery.d.ts'.",
"File '/node_modules/@types/jquery/jquery.d.ts' exist - use it as a name resolution result.",
@@ -68,6 +73,7 @@
"======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/jquery.d.ts', primary: true. ========",
"======== Resolving type reference directive 'kquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========",
"Resolving with primary search path '/node_modules/@types'.",
"'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.",
"Found 'package.json' at '/node_modules/@types/kquery/package.json'.",
"'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.",
"File '/node_modules/@types/kquery/kquery' does not exist.",
@@ -79,6 +85,7 @@
"======== Type reference directive 'kquery' was successfully resolved to '/node_modules/@types/kquery/kquery.d.ts', primary: true. ========",
"======== Resolving type reference directive 'lquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========",
"Resolving with primary search path '/node_modules/@types'.",
"'package.json' has 'typings' field 'lquery' that references '/node_modules/@types/lquery/lquery'.",
"Found 'package.json' at '/node_modules/@types/lquery/package.json'.",
"'package.json' has 'typings' field 'lquery' that references '/node_modules/@types/lquery/lquery'.",
"File '/node_modules/@types/lquery/lquery' does not exist.",
@@ -88,6 +95,7 @@
"======== Type reference directive 'lquery' was successfully resolved to '/node_modules/@types/lquery/lquery.ts', primary: true. ========",
"======== Resolving type reference directive 'mquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========",
"Resolving with primary search path '/node_modules/@types'.",
"'package.json' has 'typings' field 'mquery' that references '/node_modules/@types/mquery/mquery'.",
"Found 'package.json' at '/node_modules/@types/mquery/package.json'.",
"'package.json' has 'typings' field 'mquery' that references '/node_modules/@types/mquery/mquery'.",
"File '/node_modules/@types/mquery/mquery' does not exist.",
@@ -0,0 +1,18 @@
// @noImplicitReferences: true
// @filename: node_modules/troublesome-lib/package.json
{
"name": "troublesome-lib",
"typings": "lib/index.d.ts",
"version": "0.0.1"
}
// @filename: node_modules/troublesome-lib/lib/index.d.ts
import { Position } from './utilities/positioning';
export interface ISpinButton {}
// @filename: node_modules/troublesome-lib/lib/utilities/positioning.d.ts
export * from './positioning/index';
// @filename: node_modules/troublesome-lib/lib/utilities/positioning/index.d.ts
export declare enum Position {
top,
}
// @filename: index.ts
import { ISpinButton } from "troublesome-lib";
@@ -0,0 +1,14 @@
// @filename: file1.ts
export namespace Library {
export type Bar = { a: number };
}
var x: Library.Bar; // should work
Library.foo; // should be an error
// @filename: file2.ts
import * as Lib from './file1';
namespace Lib { // should fail to merge
export const foo: string = "";
}
Lib.foo; // should work
var x: Lib.Bar; // should be an error
export { Lib }
@@ -0,0 +1,15 @@
/// <reference path='fourslash.ts' />
////class C {
//// foo: number;
//// constructor() {[|
//// /* a comment */foo = 10;
//// |]}
////}
verify.codeFix({
description: "Add 'this.' to unresolved variable",
newRangeContent: `
/* a comment */this.foo = 10;
`
});