Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint

This commit is contained in:
Alexander T committed 2019-08-15 10:32:45 +03:00
commit f20a2828f2
103 files changed
+1539 -493

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "3.6.0",
"version": "3.7.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
+42 -18
View File
@@ -4651,9 +4651,6 @@ namespace ts {
function createExpressionFromSymbolChain(chain: Symbol[], index: number): Expression {
const typeParameterNodes = lookupTypeParameterNodes(chain, index, context);
const symbol = chain[index];
if (some(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
return createLiteral(getSpecifierForModuleSymbol(symbol, context));
}
if (index === 0) {
context.flags |= NodeBuilderFlags.InInitialEntityName;
@@ -4663,6 +4660,9 @@ namespace ts {
context.flags ^= NodeBuilderFlags.InInitialEntityName;
}
let firstChar = symbolName.charCodeAt(0);
if (isSingleOrDoubleQuote(firstChar) && some(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
return createLiteral(getSpecifierForModuleSymbol(symbol, context));
}
const canUsePropertyAccess = isIdentifierStart(firstChar, languageVersion);
if (index === 0 || canUsePropertyAccess) {
const identifier = setEmitFlags(createIdentifier(symbolName, typeParameterNodes), EmitFlags.NoAsciiEscaping);
@@ -4818,9 +4818,9 @@ namespace ts {
return "default";
}
if (symbol.declarations && symbol.declarations.length) {
const declaration = symbol.declarations[0];
const name = getNameOfDeclaration(declaration);
if (name) {
let declaration = firstDefined(symbol.declarations, d => getNameOfDeclaration(d) ? d : undefined); // Try using a declaration with a name, first
const name = declaration && getNameOfDeclaration(declaration);
if (declaration && name) {
if (isCallExpression(declaration) && isBindableObjectDefinePropertyCall(declaration)) {
return symbolName(symbol);
}
@@ -4833,6 +4833,9 @@ namespace ts {
}
return declarationNameToString(name);
}
if (!declaration) {
declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway
}
if (declaration.parent && declaration.parent.kind === SyntaxKind.VariableDeclaration) {
return declarationNameToString((<VariableDeclaration>declaration.parent).name);
}
@@ -24079,7 +24082,7 @@ namespace ts {
}
if (node.operator === SyntaxKind.PlusToken) {
if (maybeTypeOfKind(operandType, TypeFlags.BigIntLike)) {
error(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(operandType));
error(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
}
return numberType;
}
@@ -24514,7 +24517,7 @@ namespace ts {
resultType = numberType;
}
// At least one is assignable to bigint, so check that both are
else if (isTypeAssignableToKind(leftType, TypeFlags.BigIntLike) && isTypeAssignableToKind(rightType, TypeFlags.BigIntLike)) {
else if (bothAreBigIntLike(leftType, rightType)) {
switch (operator) {
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
@@ -24524,7 +24527,7 @@ namespace ts {
}
// Exactly one of leftType/rightType is assignable to bigint
else {
reportOperatorError((awaitedLeft, awaitedRight) => isTypeAssignableToKind(awaitedLeft, TypeFlags.BigIntLike) && isTypeAssignableToKind(awaitedRight, TypeFlags.BigIntLike));
reportOperatorError(bothAreBigIntLike);
resultType = errorType;
}
if (leftOk && rightOk) {
@@ -24574,9 +24577,9 @@ namespace ts {
// might be missing an await without doing an exhaustive check that inserting
// await(s) will actually be a completely valid binary expression.
const closeEnoughKind = TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.AnyOrUnknown;
reportOperatorError((awaitedLeft, awaitedRight) =>
isTypeAssignableToKind(awaitedLeft, closeEnoughKind) &&
isTypeAssignableToKind(awaitedRight, closeEnoughKind));
reportOperatorError((left, right) =>
isTypeAssignableToKind(left, closeEnoughKind) &&
isTypeAssignableToKind(right, closeEnoughKind));
return anyType;
}
@@ -24644,6 +24647,10 @@ namespace ts {
return Debug.fail();
}
function bothAreBigIntLike(left: Type, right: Type): boolean {
return isTypeAssignableToKind(left, TypeFlags.BigIntLike) && isTypeAssignableToKind(right, TypeFlags.BigIntLike);
}
function checkAssignmentDeclaration(kind: AssignmentDeclarationKind, rightType: Type) {
if (kind === AssignmentDeclarationKind.ModuleExports) {
for (const prop of getPropertiesOfObjectType(rightType)) {
@@ -24741,18 +24748,23 @@ namespace ts {
return false;
}
function reportOperatorError(awaitedTypesAreCompatible?: (left: Type, right: Type) => boolean) {
function reportOperatorError(isRelated?: (left: Type, right: Type) => boolean) {
let wouldWorkWithAwait = false;
const errNode = errorNode || operatorToken;
const [leftStr, rightStr] = getTypeNamesForErrorDisplay(leftType, rightType);
if (awaitedTypesAreCompatible) {
if (isRelated) {
const awaitedLeftType = getAwaitedType(leftType);
const awaitedRightType = getAwaitedType(rightType);
wouldWorkWithAwait = !(awaitedLeftType === leftType && awaitedRightType === rightType)
&& !!(awaitedLeftType && awaitedRightType)
&& awaitedTypesAreCompatible(awaitedLeftType, awaitedRightType);
&& isRelated(awaitedLeftType, awaitedRightType);
}
let effectiveLeft = leftType;
let effectiveRight = rightType;
if (!wouldWorkWithAwait && isRelated) {
[effectiveLeft, effectiveRight] = getBaseTypesIfUnrelated(leftType, rightType, isRelated);
}
const [leftStr, rightStr] = getTypeNamesForErrorDisplay(effectiveLeft, effectiveRight);
if (!tryGiveBetterPrimaryError(errNode, wouldWorkWithAwait, leftStr, rightStr)) {
errorAndMaybeSuggestAwait(
errNode,
@@ -24789,6 +24801,18 @@ namespace ts {
}
}
function getBaseTypesIfUnrelated(leftType: Type, rightType: Type, isRelated: (left: Type, right: Type) => boolean): [Type, Type] {
let effectiveLeft = leftType;
let effectiveRight = rightType;
const leftBase = getBaseTypeOfLiteralType(leftType);
const rightBase = getBaseTypeOfLiteralType(rightType);
if (!isRelated(leftBase, rightBase)) {
effectiveLeft = leftBase;
effectiveRight = rightBase;
}
return [ effectiveLeft, effectiveRight ];
}
function isYieldExpressionInClass(node: YieldExpression): boolean {
let current: Node = node;
let parent = node.parent;
@@ -32405,7 +32429,7 @@ namespace ts {
else if (flags & ModifierFlags.Async) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
else if (isClassLike(node.parent)) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
}
else if (node.kind === SyntaxKind.Parameter) {
@@ -32428,7 +32452,7 @@ namespace ts {
else if (flags & ModifierFlags.Async) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
else if (isClassLike(node.parent)) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
}
else if (node.kind === SyntaxKind.Parameter) {
+1 -1
View File
@@ -1,7 +1,7 @@
namespace ts {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configureNightly` too.
export const versionMajorMinor = "3.6";
export const versionMajorMinor = "3.7";
/** The version of the TypeScript compiler release */
export const version = `${versionMajorMinor}.0-dev`;
}
+8
View File
@@ -4172,6 +4172,14 @@
"category": "Message",
"code": 6381
},
"Skipping build of project '{0}' because its dependency '{1}' was not built": {
"category": "Message",
"code": 6382
},
"Project '{0}' can't be built because its dependency '{1}' was not built": {
"category": "Message",
"code": 6383
},
"The expected type comes from property '{0}' which is declared here on type '{1}'": {
"category": "Message",
+174 -53
View File
@@ -550,6 +550,12 @@ namespace ts {
allDiagnostics?: Diagnostic[];
}
interface RefFile extends TextRange {
kind: RefFileKind;
index: number;
file: SourceFile;
}
/**
* Determines if program structure is upto date or needs to be recreated
*/
@@ -714,6 +720,8 @@ namespace ts {
let noDiagnosticsTypeChecker: TypeChecker;
let classifiableNames: UnderscoreEscapedMap<true>;
const ambientModuleNameToUnmodifiedFileName = createMap<string>();
// Todo:: Use this to report why file was included in --extendedDiagnostics
let refFileMap: MultiMap<ts.RefFile> | undefined;
const cachedSemanticDiagnosticsForFile: DiagnosticCache<Diagnostic> = {};
const cachedDeclarationDiagnosticsForFile: DiagnosticCache<DiagnosticWithLocation> = {};
@@ -910,6 +918,7 @@ namespace ts {
getSourceFileByPath,
getSourceFiles: () => files,
getMissingFilePaths: () => missingFilePaths!, // TODO: GH#18217
getRefFileMap: () => refFileMap,
getCompilerOptions: () => options,
getSyntacticDiagnostics,
getOptionsDiagnostics,
@@ -1388,6 +1397,7 @@ namespace ts {
}
missingFilePaths = oldProgram.getMissingFilePaths();
refFileMap = oldProgram.getRefFileMap();
// update fileName -> file mapping
for (const newSourceFile of newSourceFiles) {
@@ -2179,25 +2189,24 @@ namespace ts {
}
/** This has side effects through `findSourceFile`. */
function processSourceFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, packageId: PackageId | undefined, refFile?: SourceFile, refPos?: number, refEnd?: number): void {
getSourceFileFromReferenceWorker(fileName,
fileName => findSourceFile(fileName, toPath(fileName), isDefaultLib, ignoreNoDefaultLib, refFile!, refPos!, refEnd!, packageId), // TODO: GH#18217
(diagnostic, ...args) => {
fileProcessingDiagnostics.add(refFile !== undefined && refEnd !== undefined && refPos !== undefined
? createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...args)
: createCompilerDiagnostic(diagnostic, ...args));
},
refFile);
function processSourceFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, packageId: PackageId | undefined, refFile?: RefFile): void {
getSourceFileFromReferenceWorker(
fileName,
fileName => findSourceFile(fileName, toPath(fileName), isDefaultLib, ignoreNoDefaultLib, refFile, packageId), // TODO: GH#18217
(diagnostic, ...args) => fileProcessingDiagnostics.add(
createRefFileDiagnostic(refFile, diagnostic, ...args)
),
refFile && refFile.file
);
}
function reportFileNamesDifferOnlyInCasingError(fileName: string, existingFileName: string, refFile: SourceFile, refPos: number, refEnd: number): void {
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName));
}
else {
fileProcessingDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName));
}
function reportFileNamesDifferOnlyInCasingError(fileName: string, existingFileName: string, refFile: RefFile | undefined): void {
fileProcessingDiagnostics.add(createRefFileDiagnostic(
refFile,
Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing,
fileName,
existingFileName
));
}
function createRedirectSourceFile(redirectTarget: SourceFile, unredirected: SourceFile, fileName: string, path: Path, resolvedPath: Path, originalFileName: string): SourceFile {
@@ -2222,7 +2231,7 @@ namespace ts {
}
// Get source file from normalized fileName
function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: SourceFile, refPos: number, refEnd: number, packageId: PackageId | undefined): SourceFile | undefined {
function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: RefFile | undefined, packageId: PackageId | undefined): SourceFile | undefined {
const originalFileName = fileName;
if (filesByName.has(path)) {
const file = filesByName.get(path);
@@ -2239,7 +2248,7 @@ namespace ts {
const checkedAbsolutePath = getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
const inputAbsolutePath = getNormalizedAbsolutePathWithoutRoot(inputName, currentDirectory);
if (checkedAbsolutePath !== inputAbsolutePath) {
reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile, refPos, refEnd);
reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile);
}
}
@@ -2266,6 +2275,7 @@ namespace ts {
}
}
addFileToRefFileMap(file || undefined, refFile);
return file || undefined;
}
@@ -2289,15 +2299,17 @@ namespace ts {
}
// We haven't looked for this file, do so now and cache result
const file = host.getSourceFile(fileName, options.target!, hostErrorMessage => { // TODO: GH#18217
if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
fileProcessingDiagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos,
Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
}
else {
fileProcessingDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
}
}, shouldCreateNewSourceFile);
const file = host.getSourceFile(
fileName,
options.target!,
hostErrorMessage => fileProcessingDiagnostics.add(createRefFileDiagnostic(
refFile,
Diagnostics.Cannot_read_file_0_Colon_1,
fileName,
hostErrorMessage
)),
shouldCreateNewSourceFile
);
if (packageId) {
const packageIdKey = packageIdToString(packageId);
@@ -2331,7 +2343,7 @@ namespace ts {
// for case-sensitive file systems check if we've already seen some file with similar filename ignoring case
const existingFile = filesByNameIgnoreCase!.get(pathLowerCase);
if (existingFile) {
reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd);
reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile);
}
else {
filesByNameIgnoreCase!.set(pathLowerCase, file);
@@ -2359,10 +2371,20 @@ namespace ts {
processingOtherFiles!.push(file);
}
}
addFileToRefFileMap(file, refFile);
return file;
}
function addFileToRefFileMap(file: SourceFile | undefined, refFile: RefFile | undefined) {
if (refFile && file) {
(refFileMap || (refFileMap = createMultiMap())).add(file.path, {
kind: refFile.kind,
index: refFile.index,
file: refFile.file.path
});
}
}
function addFileToFilesByName(file: SourceFile | undefined, path: Path, redirectedPath: Path | undefined) {
if (redirectedPath) {
filesByName.set(redirectedPath, file);
@@ -2479,9 +2501,21 @@ namespace ts {
}
function processReferencedFiles(file: SourceFile, isDefaultLib: boolean) {
forEach(file.referencedFiles, ref => {
forEach(file.referencedFiles, (ref, index) => {
const referencedFileName = resolveTripleslashReference(ref.fileName, file.originalFileName);
processSourceFile(referencedFileName, isDefaultLib, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined, file, ref.pos, ref.end);
processSourceFile(
referencedFileName,
isDefaultLib,
/*ignoreNoDefaultLib*/ false,
/*packageId*/ undefined,
{
kind: RefFileKind.ReferenceFile,
index,
file,
pos: ref.pos,
end: ref.end
}
);
});
}
@@ -2500,12 +2534,25 @@ namespace ts {
// store resolved type directive on the file
const fileName = ref.fileName.toLocaleLowerCase();
setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
processTypeReferenceDirective(fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end);
processTypeReferenceDirective(
fileName,
resolvedTypeReferenceDirective,
{
kind: RefFileKind.TypeReferenceDirective,
index: i,
file,
pos: ref.pos,
end: ref.end
}
);
}
}
function processTypeReferenceDirective(typeReferenceDirective: string, resolvedTypeReferenceDirective?: ResolvedTypeReferenceDirective,
refFile?: SourceFile, refPos?: number, refEnd?: number): void {
function processTypeReferenceDirective(
typeReferenceDirective: string,
resolvedTypeReferenceDirective?: ResolvedTypeReferenceDirective,
refFile?: RefFile
): void {
// If we already found this library as a primary reference - nothing to do
const previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective);
@@ -2518,7 +2565,7 @@ namespace ts {
if (resolvedTypeReferenceDirective.primary) {
// resolved from the primary path
processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, refFile, refPos, refEnd); // TODO: GH#18217
processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, refFile); // TODO: GH#18217
}
else {
// If we already resolved to this file, it must have been a secondary reference. Check file contents
@@ -2528,12 +2575,15 @@ namespace ts {
if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) {
const otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName!);
if (otherFileText !== getSourceFile(previousResolution.resolvedFileName!)!.text) {
fileProcessingDiagnostics.add(createDiagnostic(refFile!, refPos!, refEnd!, // TODO: GH#18217
Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict,
typeReferenceDirective,
resolvedTypeReferenceDirective.resolvedFileName,
previousResolution.resolvedFileName
));
fileProcessingDiagnostics.add(
createRefFileDiagnostic(
refFile,
Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict,
typeReferenceDirective,
resolvedTypeReferenceDirective.resolvedFileName,
previousResolution.resolvedFileName
)
);
}
}
// don't overwrite previous resolution result
@@ -2541,14 +2591,18 @@ namespace ts {
}
else {
// First resolution of this library
processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, refFile, refPos, refEnd);
processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, refFile);
}
}
if (resolvedTypeReferenceDirective.isExternalLibraryImport) currentNodeModulesDepth--;
}
else {
fileProcessingDiagnostics.add(createDiagnostic(refFile!, refPos!, refEnd!, Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); // TODO: GH#18217
fileProcessingDiagnostics.add(createRefFileDiagnostic(
refFile,
Diagnostics.Cannot_find_type_definition_file_for_0,
typeReferenceDirective
));
}
if (saveResolution) {
@@ -2568,17 +2622,24 @@ namespace ts {
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
const message = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
fileProcessingDiagnostics.add(createDiagnostic(file, libReference.pos, libReference.end, message, libName, suggestion));
fileProcessingDiagnostics.add(createFileDiagnostic(
file,
libReference.pos,
libReference.end - libReference.pos,
message,
libName,
suggestion
));
}
});
}
function createDiagnostic(refFile: SourceFile, refPos: number, refEnd: number, message: DiagnosticMessage, ...args: any[]): Diagnostic {
if (refFile === undefined || refPos === undefined || refEnd === undefined) {
function createRefFileDiagnostic(refFile: RefFile | undefined, message: DiagnosticMessage, ...args: any[]): Diagnostic {
if (!refFile) {
return createCompilerDiagnostic(message, ...args);
}
else {
return createFileDiagnostic(refFile, refPos, refEnd - refPos, message, ...args);
return createFileDiagnostic(refFile.file, refFile.pos, refFile.end - refFile.pos, message, ...args);
}
}
@@ -2632,7 +2693,20 @@ namespace ts {
else if (shouldAddFile) {
const path = toPath(resolvedFileName);
const pos = skipTrivia(file.text, file.imports[i].pos);
findSourceFile(resolvedFileName, path, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, file, pos, file.imports[i].end, resolution.packageId);
findSourceFile(
resolvedFileName,
path,
/*isDefaultLib*/ false,
/*ignoreNoDefaultLib*/ false,
{
kind: RefFileKind.Import,
index: i,
file,
pos,
end: file.imports[i].end
},
resolution.packageId
);
}
if (isFromNodeModulesSearch) {
@@ -2654,12 +2728,20 @@ namespace ts {
function checkSourceFilesBelongToPath(sourceFiles: readonly SourceFile[], rootDirectory: string): boolean {
let allFilesBelongToPath = true;
const absoluteRootDirectoryPath = host.getCanonicalFileName(getNormalizedAbsolutePath(rootDirectory, currentDirectory));
let rootPaths: Map<true> | undefined;
for (const sourceFile of sourceFiles) {
if (!sourceFile.isDeclarationFile) {
const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, rootDirectory));
if (!rootPaths) rootPaths = arrayToSet(rootNames, toPath);
addProgramDiagnosticAtRefPath(
sourceFile,
rootPaths,
Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,
sourceFile.fileName,
rootDirectory
);
allFilesBelongToPath = false;
}
}
@@ -2767,16 +2849,26 @@ namespace ts {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
}
if (options.noEmit && isIncrementalCompilation(options)) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", options.incremental ? "incremental" : "composite");
}
verifyProjectReferences();
// List of collected files is complete; validate exhautiveness if this is a project with a file list
if (options.composite) {
const rootPaths = rootNames.map(toPath);
const rootPaths = arrayToSet(rootNames, toPath);
for (const file of files) {
// Ignore file that is not emitted
if (!sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect)) continue;
if (rootPaths.indexOf(file.path) === -1) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName, options.configFilePath || ""));
if (!rootPaths.has(file.path)) {
addProgramDiagnosticAtRefPath(
file,
rootPaths,
Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
file.fileName,
options.configFilePath || ""
);
}
}
}
@@ -2984,6 +3076,35 @@ namespace ts {
}
}
function addProgramDiagnosticAtRefPath(file: SourceFile, rootPaths: Map<true>, message: DiagnosticMessage, ...args: (string | number | undefined)[]) {
const refPaths = refFileMap && refFileMap.get(file.path);
const refPathToReportErrorOn = forEach(refPaths, refPath => rootPaths.has(refPath.file) ? refPath : undefined) ||
elementAt(refPaths, 0);
if (refPathToReportErrorOn) {
const refFile = Debug.assertDefined(getSourceFileByPath(refPathToReportErrorOn.file));
const { kind, index } = refPathToReportErrorOn;
let pos: number, end: number;
switch (kind) {
case RefFileKind.Import:
pos = skipTrivia(refFile.text, refFile.imports[index].pos);
end = refFile.imports[index].end;
break;
case RefFileKind.ReferenceFile:
({ pos, end } = refFile.referencedFiles[index]);
break;
case RefFileKind.TypeReferenceDirective:
({ pos, end } = refFile.typeReferenceDirectives[index]);
break;
default:
return Debug.assertNever(kind);
}
programDiagnostics.add(createFileDiagnostic(refFile, pos, end - pos, message, ...args));
}
else {
programDiagnostics.add(createCompilerDiagnostic(message, ...args));
}
}
function verifyProjectReferences() {
const buildInfoPath = !options.noEmit && !options.suppressOutputPathCheck ? getOutputPathForBuildInfo(options) : undefined;
forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, index, parent) => {
+94 -35
View File
@@ -116,6 +116,7 @@ namespace ts {
export interface UpstreamBlocked {
type: UpToDateStatusType.UpstreamBlocked;
upstreamProjectName: string;
upstreamProjectBlocked: boolean;
}
/**
@@ -273,6 +274,26 @@ namespace ts {
export interface SolutionBuilderWithWatchHost<T extends BuilderProgram> extends SolutionBuilderHostBase<T>, WatchHost {
}
/*@internal*/
export type BuildOrder = readonly ResolvedConfigFileName[];
/*@internal*/
export interface CircularBuildOrder {
buildOrder: BuildOrder;
circularDiagnostics: readonly Diagnostic[];
}
/*@internal*/
export type AnyBuildOrder = BuildOrder | CircularBuildOrder;
/*@internal*/
export function isCircularBuildOrder(buildOrder: AnyBuildOrder): buildOrder is CircularBuildOrder {
return !!buildOrder && !!(buildOrder as CircularBuildOrder).buildOrder;
}
/*@internal*/
export function getBuildOrderFromAnyBuildOrder(anyBuildOrder: AnyBuildOrder): BuildOrder {
return isCircularBuildOrder(anyBuildOrder) ? anyBuildOrder.buildOrder : anyBuildOrder;
}
export interface SolutionBuilder<T extends BuilderProgram> {
build(project?: string, cancellationToken?: CancellationToken): ExitStatus;
clean(project?: string): ExitStatus;
@@ -281,7 +302,7 @@ namespace ts {
getNextInvalidatedProject(cancellationToken?: CancellationToken): InvalidatedProject<T> | undefined;
// Currently used for testing but can be made public if needed:
/*@internal*/ getBuildOrder(): readonly ResolvedConfigFileName[];
/*@internal*/ getBuildOrder(): AnyBuildOrder;
// Testing only
/*@internal*/ getUpToDateStatusOfProject(project: string): UpToDateStatus;
@@ -379,7 +400,7 @@ namespace ts {
readonly moduleResolutionCache: ModuleResolutionCache | undefined;
// Mutable state
buildOrder: readonly ResolvedConfigFileName[] | undefined;
buildOrder: AnyBuildOrder | undefined;
readFileWithCache: (f: string) => string | undefined;
projectCompilerOptions: CompilerOptions;
cache: SolutionBuilderStateCache | undefined;
@@ -523,16 +544,19 @@ namespace ts {
return resolveConfigFileProjectName(resolvePath(state.currentDirectory, name));
}
function createBuildOrder(state: SolutionBuilderState, roots: readonly ResolvedConfigFileName[]): readonly ResolvedConfigFileName[] {
function createBuildOrder(state: SolutionBuilderState, roots: readonly ResolvedConfigFileName[]): AnyBuildOrder {
const temporaryMarks = createMap() as ConfigFileMap<true>;
const permanentMarks = createMap() as ConfigFileMap<true>;
const circularityReportStack: string[] = [];
let buildOrder: ResolvedConfigFileName[] | undefined;
let circularDiagnostics: Diagnostic[] | undefined;
for (const root of roots) {
visit(root);
}
return buildOrder || emptyArray;
return circularDiagnostics ?
{ buildOrder: buildOrder || emptyArray, circularDiagnostics } :
buildOrder || emptyArray;
function visit(configFileName: ResolvedConfigFileName, inCircularContext?: boolean) {
const projPath = toResolvedConfigFilePath(state, configFileName);
@@ -541,8 +565,12 @@ namespace ts {
// Circular
if (temporaryMarks.has(projPath)) {
if (!inCircularContext) {
// TODO:: Do we report this as error?
reportStatus(state, Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0, circularityReportStack.join("\r\n"));
(circularDiagnostics || (circularDiagnostics = [])).push(
createCompilerDiagnostic(
Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0,
circularityReportStack.join("\r\n")
)
);
}
return;
}
@@ -569,12 +597,11 @@ namespace ts {
function createStateBuildOrder(state: SolutionBuilderState) {
const buildOrder = createBuildOrder(state, state.rootNames.map(f => resolveProjectName(state, f)));
if (arrayIsEqualTo(state.buildOrder, buildOrder)) return state.buildOrder!;
// Clear all to ResolvedConfigFilePaths cache to start fresh
state.resolvedConfigFilePaths.clear();
const currentProjects = arrayToSet(
buildOrder,
getBuildOrderFromAnyBuildOrder(buildOrder),
resolved => toResolvedConfigFilePath(state, resolved)
) as ConfigFileMap<true>;
@@ -611,9 +638,10 @@ namespace ts {
return state.buildOrder = buildOrder;
}
function getBuildOrderFor(state: SolutionBuilderState, project: string | undefined, onlyReferences: boolean | undefined) {
function getBuildOrderFor(state: SolutionBuilderState, project: string | undefined, onlyReferences: boolean | undefined): AnyBuildOrder | undefined {
const resolvedProject = project && resolveProjectName(state, project);
const buildOrderFromState = getBuildOrder(state);
if (isCircularBuildOrder(buildOrderFromState)) return buildOrderFromState;
if (resolvedProject) {
const projectPath = toResolvedConfigFilePath(state, resolvedProject);
const projectIndex = findIndex(
@@ -622,7 +650,8 @@ namespace ts {
);
if (projectIndex === -1) return undefined;
}
const buildOrder = resolvedProject ? createBuildOrder(state, [resolvedProject]) : buildOrderFromState;
const buildOrder = resolvedProject ? createBuildOrder(state, [resolvedProject]) as BuildOrder : buildOrderFromState;
Debug.assert(!isCircularBuildOrder(buildOrder));
Debug.assert(!onlyReferences || resolvedProject !== undefined);
Debug.assert(!onlyReferences || buildOrder[buildOrder.length - 1] === resolvedProject);
return onlyReferences ? buildOrder.slice(0, buildOrder.length - 1) : buildOrder;
@@ -702,7 +731,7 @@ namespace ts {
state.allProjectBuildPending = false;
if (state.options.watch) { reportWatchStatus(state, Diagnostics.Starting_compilation_in_watch_mode); }
enableCache(state);
const buildOrder = getBuildOrder(state);
const buildOrder = getBuildOrderFromAnyBuildOrder(getBuildOrder(state));
buildOrder.forEach(configFileName =>
state.projectPendingBuild.set(
toResolvedConfigFilePath(state, configFileName),
@@ -1237,10 +1266,11 @@ namespace ts {
function getNextInvalidatedProject<T extends BuilderProgram>(
state: SolutionBuilderState<T>,
buildOrder: readonly ResolvedConfigFileName[],
buildOrder: AnyBuildOrder,
reportQueue: boolean
): InvalidatedProject<T> | undefined {
if (!state.projectPendingBuild.size) return undefined;
if (isCircularBuildOrder(buildOrder)) return undefined;
if (state.currentInvalidatedProject) {
// Only if same buildOrder the currentInvalidated project can be sent again
return arrayIsEqualTo(state.currentInvalidatedProject.buildOrder, buildOrder) ?
@@ -1309,7 +1339,16 @@ namespace ts {
if (status.type === UpToDateStatusType.UpstreamBlocked) {
reportAndStoreErrors(state, projectPath, config.errors);
projectPendingBuild.delete(projectPath);
if (options.verbose) reportStatus(state, Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName);
if (options.verbose) {
reportStatus(
state,
status.upstreamProjectBlocked ?
Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built :
Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors,
project,
status.upstreamProjectName
);
}
continue;
}
@@ -1511,10 +1550,12 @@ namespace ts {
}
// An upstream project is blocked
if (refStatus.type === UpToDateStatusType.Unbuildable) {
if (refStatus.type === UpToDateStatusType.Unbuildable ||
refStatus.type === UpToDateStatusType.UpstreamBlocked) {
return {
type: UpToDateStatusType.UpstreamBlocked,
upstreamProjectName: ref.path
upstreamProjectName: ref.path,
upstreamProjectBlocked: refStatus.type === UpToDateStatusType.UpstreamBlocked
};
}
@@ -1763,17 +1804,24 @@ namespace ts {
reportErrorSummary(state, buildOrder);
startWatching(state, buildOrder);
return errorProjects ?
successfulProjects ?
ExitStatus.DiagnosticsPresent_OutputsGenerated :
ExitStatus.DiagnosticsPresent_OutputsSkipped :
ExitStatus.Success;
return isCircularBuildOrder(buildOrder) ?
ExitStatus.ProjectReferenceCycle_OutputsSkupped :
errorProjects ?
successfulProjects ?
ExitStatus.DiagnosticsPresent_OutputsGenerated :
ExitStatus.DiagnosticsPresent_OutputsSkipped :
ExitStatus.Success;
}
function clean(state: SolutionBuilderState, project?: string, onlyReferences?: boolean) {
const buildOrder = getBuildOrderFor(state, project, onlyReferences);
if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped;
if (isCircularBuildOrder(buildOrder)) {
reportErrors(state, buildOrder.circularDiagnostics);
return ExitStatus.ProjectReferenceCycle_OutputsSkupped;
}
const { options, host } = state;
const filesToDelete = options.dry ? [] as string[] : undefined;
for (const proj of buildOrder) {
@@ -1955,10 +2003,10 @@ namespace ts {
);
}
function startWatching(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]) {
function startWatching(state: SolutionBuilderState, buildOrder: AnyBuildOrder) {
if (!state.watchAllProjectsPending) return;
state.watchAllProjectsPending = false;
for (const resolved of buildOrder) {
for (const resolved of getBuildOrderFromAnyBuildOrder(buildOrder)) {
const resolvedPath = toResolvedConfigFilePath(state, resolved);
// Watch this file
watchConfigFile(state, resolved, resolvedPath);
@@ -2032,24 +2080,33 @@ namespace ts {
reportAndStoreErrors(state, proj, [state.configFileCache.get(proj) as Diagnostic]);
}
function reportErrorSummary(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]) {
if (!state.needsSummary || (!state.watch && !state.host.reportErrorSummary)) return;
function reportErrorSummary(state: SolutionBuilderState, buildOrder: AnyBuildOrder) {
if (!state.needsSummary) return;
state.needsSummary = false;
const canReportSummary = state.watch || !!state.host.reportErrorSummary;
const { diagnostics } = state;
// Report errors from the other projects
buildOrder.forEach(project => {
const projectPath = toResolvedConfigFilePath(state, project);
if (!state.projectErrorsReported.has(projectPath)) {
reportErrors(state, diagnostics.get(projectPath) || emptyArray);
}
});
let totalErrors = 0;
diagnostics.forEach(singleProjectErrors => totalErrors += getErrorCountForSummary(singleProjectErrors));
if (isCircularBuildOrder(buildOrder)) {
reportBuildQueue(state, buildOrder.buildOrder);
reportErrors(state, buildOrder.circularDiagnostics);
if (canReportSummary) totalErrors += getErrorCountForSummary(buildOrder.circularDiagnostics);
}
else {
// Report errors from the other projects
buildOrder.forEach(project => {
const projectPath = toResolvedConfigFilePath(state, project);
if (!state.projectErrorsReported.has(projectPath)) {
reportErrors(state, diagnostics.get(projectPath) || emptyArray);
}
});
if (canReportSummary) diagnostics.forEach(singleProjectErrors => totalErrors += getErrorCountForSummary(singleProjectErrors));
}
if (state.watch) {
reportWatchStatus(state, getWatchErrorSummaryDiagnosticMessage(totalErrors), totalErrors);
}
else {
state.host.reportErrorSummary!(totalErrors);
else if (state.host.reportErrorSummary) {
state.host.reportErrorSummary(totalErrors);
}
}
@@ -2122,7 +2179,9 @@ namespace ts {
case UpToDateStatusType.UpstreamBlocked:
return reportStatus(
state,
Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
status.upstreamProjectBlocked ?
Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built :
Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
relName(state, configFileName),
relName(state, status.upstreamProjectName)
);
+19
View File
@@ -2934,6 +2934,20 @@ namespace ts {
throwIfCancellationRequested(): void;
}
/*@internal*/
export enum RefFileKind {
Import,
ReferenceFile,
TypeReferenceDirective
}
/*@internal*/
export interface RefFile {
kind: RefFileKind;
index: number;
file: Path;
}
// TODO: This should implement TypeCheckerHost but that's an internal type.
export interface Program extends ScriptReferenceHost {
@@ -2953,6 +2967,8 @@ namespace ts {
*/
/* @internal */
getMissingFilePaths(): readonly Path[];
/* @internal */
getRefFileMap(): MultiMap<RefFile> | undefined;
/**
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
@@ -3099,6 +3115,9 @@ namespace ts {
// When build skipped because passed in project is invalid
InvalidProject_OutputsSkipped = 3,
// When build is skipped because project references form cycle
ProjectReferenceCycle_OutputsSkupped = 4,
}
export interface EmitResult {
+1 -1
View File
@@ -192,7 +192,7 @@ namespace ts {
export function arrayToSet<T>(array: readonly T[], makeKey: (value: T) => string | undefined): Map<true>;
export function arrayToSet<T>(array: readonly T[], makeKey: (value: T) => __String | undefined): UnderscoreEscapedMap<true>;
export function arrayToSet(array: readonly any[], makeKey?: (value: any) => string | __String | undefined): Map<true> | UnderscoreEscapedMap<true> {
return arrayToMap<any, true>(array, makeKey || (s => s), () => true);
return arrayToMap<any, true>(array, makeKey || (s => s), returnTrue);
}
export function cloneMap(map: SymbolTable): SymbolTable;
+111 -8
View File
@@ -375,8 +375,47 @@ namespace fakes {
}
}
export type ExpectedDiagnostic = [ts.DiagnosticMessage, ...(string | number)[]];
function expectedDiagnosticToText([message, ...args]: ExpectedDiagnostic) {
export type ExpectedDiagnosticMessage = [ts.DiagnosticMessage, ...(string | number)[]];
export interface ExpectedDiagnosticMessageChain {
message: ExpectedDiagnosticMessage;
next?: ExpectedDiagnosticMessageChain[];
}
export interface ExpectedDiagnosticLocation {
file: string;
start: number;
length: number;
}
export interface ExpectedDiagnosticRelatedInformation extends ExpectedDiagnosticMessageChain {
location?: ExpectedDiagnosticLocation;
}
export enum DiagnosticKind {
Error = "Error",
Status = "Status"
}
export interface ExpectedErrorDiagnostic extends ExpectedDiagnosticRelatedInformation {
relatedInformation?: ExpectedDiagnosticRelatedInformation[];
}
export type ExpectedDiagnostic = ExpectedDiagnosticMessage | ExpectedErrorDiagnostic;
interface SolutionBuilderDiagnostic {
kind: DiagnosticKind;
diagnostic: ts.Diagnostic;
}
function indentedText(indent: number, text: string) {
if (!indent) return text;
let indentText = "";
for (let i = 0; i < indent; i++) {
indentText += " ";
}
return `
${indentText}${text}`;
}
function expectedDiagnosticMessageToText([message, ...args]: ExpectedDiagnosticMessage) {
let text = ts.getLocaleSpecificMessage(message);
if (args.length) {
text = ts.formatStringFromArgs(text, args);
@@ -384,6 +423,70 @@ namespace fakes {
return text;
}
function expectedDiagnosticMessageChainToText({ message, next }: ExpectedDiagnosticMessageChain, indent = 0) {
let text = indentedText(indent, expectedDiagnosticMessageToText(message));
if (next) {
indent++;
next.forEach(kid => text += expectedDiagnosticMessageChainToText(kid, indent));
}
return text;
}
function expectedDiagnosticRelatedInformationToText({ location, ...diagnosticMessage }: ExpectedDiagnosticRelatedInformation) {
const text = expectedDiagnosticMessageChainToText(diagnosticMessage);
if (location) {
const { file, start, length } = location;
return `${file}(${start}:${length}):: ${text}`;
}
return text;
}
function expectedErrorDiagnosticToText({ relatedInformation, ...diagnosticRelatedInformation }: ExpectedErrorDiagnostic) {
let text = `${DiagnosticKind.Error}!: ${expectedDiagnosticRelatedInformationToText(diagnosticRelatedInformation)}`;
if (relatedInformation) {
for (const kid of relatedInformation) {
text += `
related:: ${expectedDiagnosticRelatedInformationToText(kid)}`;
}
}
return text;
}
function expectedDiagnosticToText(errorOrStatus: ExpectedDiagnostic) {
return ts.isArray(errorOrStatus) ?
`${DiagnosticKind.Status}!: ${expectedDiagnosticMessageToText(errorOrStatus)}` :
expectedErrorDiagnosticToText(errorOrStatus);
}
function diagnosticMessageChainToText({ messageText, next}: ts.DiagnosticMessageChain, indent = 0) {
let text = indentedText(indent, messageText);
if (next) {
indent++;
next.forEach(kid => text += diagnosticMessageChainToText(kid, indent));
}
return text;
}
function diagnosticRelatedInformationToText({ file, start, length, messageText }: ts.DiagnosticRelatedInformation) {
const text = typeof messageText === "string" ?
messageText :
diagnosticMessageChainToText(messageText);
return file ?
`${file.fileName}(${start}:${length}):: ${text}` :
text;
}
function diagnosticToText({ kind, diagnostic: { relatedInformation, ...diagnosticRelatedInformation } }: SolutionBuilderDiagnostic) {
let text = `${kind}!: ${diagnosticRelatedInformationToText(diagnosticRelatedInformation)}`;
if (relatedInformation) {
for (const kid of relatedInformation) {
text += `
related:: ${diagnosticRelatedInformationToText(kid)}`;
}
}
return text;
}
function compareProgramBuildInfoDiagnostic(a: ts.ProgramBuildInfoDiagnostic, b: ts.ProgramBuildInfoDiagnostic) {
return ts.compareStringsCaseSensitive(ts.isString(a) ? a : a[0], ts.isString(b) ? b : b[0]);
}
@@ -446,14 +549,14 @@ namespace fakes {
return new Date(this.sys.vfs.time());
}
diagnostics: ts.Diagnostic[] = [];
diagnostics: SolutionBuilderDiagnostic[] = [];
reportDiagnostic(diagnostic: ts.Diagnostic) {
this.diagnostics.push(diagnostic);
this.diagnostics.push({ kind: DiagnosticKind.Error, diagnostic });
}
reportSolutionBuilderStatus(diagnostic: ts.Diagnostic) {
this.diagnostics.push(diagnostic);
this.diagnostics.push({ kind: DiagnosticKind.Status, diagnostic });
}
clearDiagnostics() {
@@ -461,7 +564,7 @@ namespace fakes {
}
assertDiagnosticMessages(...expectedDiagnostics: ExpectedDiagnostic[]) {
const actual = this.diagnostics.slice().map(d => d.messageText as string);
const actual = this.diagnostics.slice().map(diagnosticToText);
const expected = expectedDiagnostics.map(expectedDiagnosticToText);
assert.deepEqual(actual, expected, `Diagnostic arrays did not match:
Actual: ${JSON.stringify(actual, /*replacer*/ undefined, " ")}
@@ -471,8 +574,8 @@ Expected: ${JSON.stringify(expected, /*replacer*/ undefined, " ")}`);
printDiagnostics(header = "== Diagnostics ==") {
const out = ts.createDiagnosticReporter(ts.sys);
ts.sys.write(header + "\r\n");
for (const d of this.diagnostics) {
out(d);
for (const { diagnostic } of this.diagnostics) {
out(diagnostic);
}
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> {}`
interface Array<T> { length: number; [n: number]: T; }`
};
export const safeList = {
+1 -1
View File
@@ -1289,7 +1289,7 @@ namespace ts.Completions {
if (resolvedModuleSymbol !== moduleSymbol &&
// Don't add another completion for `export =` of a symbol that's already global.
// So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`.
some(resolvedModuleSymbol.declarations, d => !!d.getSourceFile().externalModuleIndicator)) {
every(resolvedModuleSymbol.declarations, d => !!d.getSourceFile().externalModuleIndicator)) {
symbols.push(resolvedModuleSymbol);
symbolToSortTextMap[getSymbolId(resolvedModuleSymbol)] = SortText.AutoImportSuggestions;
symbolToOriginInfoMap[getSymbolId(resolvedModuleSymbol)] = { kind: SymbolOriginInfoKind.Export, moduleSymbol, isDefaultExport: false };
+1
View File
@@ -93,6 +93,7 @@
"unittests/services/transpile.ts",
"unittests/tsbuild/amdModulesWithOut.ts",
"unittests/tsbuild/containerOnlyReferenced.ts",
"unittests/tsbuild/demo.ts",
"unittests/tsbuild/emptyFiles.ts",
"unittests/tsbuild/graphOrdering.ts",
"unittests/tsbuild/inferredTypeFromTransitiveModule.ts",
@@ -193,7 +193,7 @@ namespace ts {
};
testProjectReferences(spec, "/primary/tsconfig.json", program => {
const errs = program.getOptionsDiagnostics();
const errs = program.getSemanticDiagnostics(program.getSourceFile("/primary/a.ts"));
assertHasError("Reports an error about b.ts not being in the list", errs, Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern);
});
});
@@ -343,8 +343,9 @@ namespace ts {
}
};
testProjectReferences(spec, "/alpha/tsconfig.json", (program) => {
assertHasError("Issues an error about the rootDir", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files);
assertHasError("Issues an error about the fileList", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern);
const semanticDiagnostics = program.getSemanticDiagnostics(program.getSourceFile("/alpha/src/a.ts"));
assertHasError("Issues an error about the rootDir", semanticDiagnostics, Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files);
assertHasError("Issues an error about the fileList", semanticDiagnostics, Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern);
});
});
});
+162
View File
@@ -0,0 +1,162 @@
namespace ts {
describe("unittests:: tsbuild:: on demo project", () => {
let projFs: vfs.FileSystem;
const { time } = getTime();
before(() => {
projFs = loadProjectFromDisk("tests/projects/demo", time);
});
after(() => {
projFs = undefined!; // Release the contents
});
function coreOutputs(): string[] {
return [
"/src/lib/core/utilities.js",
"/src/lib/core/utilities.d.ts",
"/src/lib/core/tsconfig.tsbuildinfo"
];
}
function animalOutputs(): string[] {
return [
"/src/lib/animals/animal.js",
"/src/lib/animals/animal.d.ts",
"/src/lib/animals/index.js",
"/src/lib/animals/index.d.ts",
"/src/lib/animals/dog.js",
"/src/lib/animals/dog.d.ts",
"/src/lib/animals/tsconfig.tsbuildinfo"
];
}
function zooOutputs(): string[] {
return [
"/src/lib/zoo/zoo.js",
"/src/lib/zoo/zoo.d.ts",
"/src/lib/zoo/tsconfig.tsbuildinfo"
];
}
interface VerifyBuild {
modifyDiskLayout: (fs: vfs.FileSystem) => void;
expectedExitStatus: ExitStatus;
expectedDiagnostics: (fs: vfs.FileSystem) => fakes.ExpectedDiagnostic[];
expectedOutputs: readonly string[];
notExpectedOutputs: readonly string[];
}
function verifyBuild({ modifyDiskLayout, expectedExitStatus, expectedDiagnostics, expectedOutputs, notExpectedOutputs }: VerifyBuild) {
const fs = projFs.shadow();
const host = new fakes.SolutionBuilderHost(fs);
modifyDiskLayout(fs);
const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], { verbose: true });
const exitStatus = builder.build();
assert.equal(exitStatus, expectedExitStatus);
host.assertDiagnosticMessages(...expectedDiagnostics(fs));
verifyOutputsPresent(fs, expectedOutputs);
verifyOutputsAbsent(fs, notExpectedOutputs);
}
it("in master branch with everything setup correctly, reports no error", () => {
verifyBuild({
modifyDiskLayout: noop,
expectedExitStatus: ExitStatus.Success,
expectedDiagnostics: () => [
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/tsconfig.json"),
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/lib/core/utilities.js"],
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/animals/tsconfig.json", "src/lib/animals/animal.js"],
[Diagnostics.Building_project_0, "/src/animals/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/zoo/tsconfig.json", "src/lib/zoo/zoo.js"],
[Diagnostics.Building_project_0, "/src/zoo/tsconfig.json"]
],
expectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()],
notExpectedOutputs: emptyArray
});
});
it("in circular branch reports the error about it by stopping build", () => {
verifyBuild({
modifyDiskLayout: fs => replaceText(
fs,
"/src/core/tsconfig.json",
"}",
`},
"references": [
{
"path": "../zoo"
}
]`
),
expectedExitStatus: ExitStatus.ProjectReferenceCycle_OutputsSkupped,
expectedDiagnostics: () => [
getExpectedDiagnosticForProjectsInBuild("src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/core/tsconfig.json", "src/tsconfig.json"),
errorDiagnostic([
Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0,
[
"/src/tsconfig.json",
"/src/core/tsconfig.json",
"/src/zoo/tsconfig.json",
"/src/animals/tsconfig.json"
].join("\r\n")
])
],
expectedOutputs: emptyArray,
notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()]
});
});
it("in bad-ref branch reports the error about files not in rootDir at the import location", () => {
verifyBuild({
modifyDiskLayout: fs => prependText(
fs,
"/src/core/utilities.ts",
`import * as A from '../animals';
`
),
expectedExitStatus: ExitStatus.DiagnosticsPresent_OutputsSkipped,
expectedDiagnostics: fs => [
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/tsconfig.json"),
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/lib/core/utilities.js"],
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
{
message: [Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/animal.ts", "/src/core"],
location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./animal'`),
},
{
message: [Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/animal.ts", "/src/core/tsconfig.json"],
location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./animal'`),
},
{
message: [Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/dog.ts", "/src/core"],
location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./dog'`),
},
{
message: [Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/dog.ts", "/src/core/tsconfig.json"],
location: expectedLocationIndexOf(fs, "/src/animals/index.ts", `'./dog'`),
},
{
message: [Diagnostics._0_is_declared_but_its_value_is_never_read, "A"],
location: expectedLocationIndexOf(fs, "/src/core/utilities.ts", `import * as A from '../animals';`),
},
{
message: [Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/index.ts", "/src/core"],
location: expectedLocationIndexOf(fs, "/src/core/utilities.ts", `'../animals'`),
},
{
message: [Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/index.ts", "/src/core/tsconfig.json"],
location: expectedLocationIndexOf(fs, "/src/core/utilities.ts", `'../animals'`),
},
[Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, "src/animals/tsconfig.json", "src/core"],
[Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, "/src/animals/tsconfig.json", "/src/core"],
[Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built, "src/zoo/tsconfig.json", "src/animals"],
[Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built, "/src/zoo/tsconfig.json", "/src/animals"],
],
expectedOutputs: emptyArray,
notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()]
});
});
});
}
@@ -15,7 +15,10 @@ namespace ts {
host.clearDiagnostics();
builder.build();
host.assertDiagnosticMessages([Diagnostics.The_files_list_in_config_file_0_is_empty, "/src/no-references/tsconfig.json"]);
host.assertDiagnosticMessages({
message: [Diagnostics.The_files_list_in_config_file_0_is_empty, "/src/no-references/tsconfig.json"],
location: expectedLocationLastIndexOf(fs, "/src/no-references/tsconfig.json", "[]"),
});
// Check for outputs to not be written.
verifyOutputsAbsent(fs, allExpectedOutputs);
@@ -8,13 +8,17 @@ namespace ts {
["B", "D"],
["C", "D"],
["C", "E"],
["F", "E"]
["F", "E"],
["H", "I"],
["I", "J"],
["J", "H"],
["J", "E"]
];
before(() => {
const fs = new vfs.FileSystem(false);
host = new fakes.SolutionBuilderHost(fs);
writeProjects(fs, ["A", "B", "C", "D", "E", "F", "G"], deps);
writeProjects(fs, ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"], deps);
});
after(() => {
@@ -37,17 +41,25 @@ namespace ts {
checkGraphOrdering(["F", "C", "A"], ["E", "F", "D", "C", "B", "A"]);
});
function checkGraphOrdering(rootNames: string[], expectedBuildSet: string[]) {
const builder = createSolutionBuilder(host!, rootNames.map(getProjectFileName), { dry: true, force: false, verbose: false });
const buildQueue = builder.getBuildOrder();
it("returns circular order", () => {
checkGraphOrdering(["H"], ["E", "J", "I", "H"], /*circular*/ true);
checkGraphOrdering(["A", "H"], ["D", "E", "C", "B", "A", "J", "I", "H"], /*circular*/ true);
});
function checkGraphOrdering(rootNames: string[], expectedBuildSet: string[], circular?: true) {
const builder = createSolutionBuilder(host!, rootNames.map(getProjectFileName), { dry: true, force: false, verbose: false });
const buildOrder = builder.getBuildOrder();
assert.equal(isCircularBuildOrder(buildOrder), !!circular);
const buildQueue = getBuildOrderFromAnyBuildOrder(buildOrder);
assert.deepEqual(buildQueue, expectedBuildSet.map(getProjectFileName));
for (const dep of deps) {
const child = getProjectFileName(dep[0]);
if (buildQueue.indexOf(child) < 0) continue;
const parent = getProjectFileName(dep[1]);
assert.isAbove(buildQueue.indexOf(child), buildQueue.indexOf(parent), `Expecting child ${child} to be built after parent ${parent}`);
if (!circular) {
for (const dep of deps) {
const child = getProjectFileName(dep[0]);
if (buildQueue.indexOf(child) < 0) continue;
const parent = getProjectFileName(dep[1]);
assert.isAbove(buildQueue.indexOf(child), buildQueue.indexOf(parent), `Expecting child ${child} to be built after parent ${parent}`);
}
}
}
@@ -1,4 +1,8 @@
namespace ts {
export function errorDiagnostic(message: fakes.ExpectedDiagnosticMessage): fakes.ExpectedErrorDiagnostic {
return { message };
}
export function getExpectedDiagnosticForProjectsInBuild(...projects: string[]): fakes.ExpectedDiagnostic {
return [Diagnostics.Projects_in_this_build_Colon_0, projects.map(p => "\r\n * " + p).join("")];
}
@@ -42,6 +46,38 @@ namespace ts {
fs.writeFileSync(path, `${old}${additionalContent}`);
}
export function indexOf(fs: vfs.FileSystem, path: string, searchStr: string) {
if (!fs.statSync(path).isFile()) {
throw new Error(`File ${path} does not exist`);
}
const content = fs.readFileSync(path, "utf-8");
return content.indexOf(searchStr);
}
export function lastIndexOf(fs: vfs.FileSystem, path: string, searchStr: string) {
if (!fs.statSync(path).isFile()) {
throw new Error(`File ${path} does not exist`);
}
const content = fs.readFileSync(path, "utf-8");
return content.lastIndexOf(searchStr);
}
export function expectedLocationIndexOf(fs: vfs.FileSystem, file: string, searchStr: string): fakes.ExpectedDiagnosticLocation {
return {
file,
start: indexOf(fs, file, searchStr),
length: searchStr.length
};
}
export function expectedLocationLastIndexOf(fs: vfs.FileSystem, file: string, searchStr: string): fakes.ExpectedDiagnosticLocation {
return {
file,
start: lastIndexOf(fs, file, searchStr),
length: searchStr.length
};
}
export function getTime() {
let currentTime = 100;
return { tick, time, touch };
@@ -7,10 +7,10 @@ namespace ts {
const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], {});
builder.build();
host.assertDiagnosticMessages(
[Diagnostics.The_specified_path_does_not_exist_Colon_0, "/src/foobar.json"],
[Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, "/src/tsconfig.first.json", "[\"**/*\"]", "[]"],
[Diagnostics.The_specified_path_does_not_exist_Colon_0, "/src/foobar.json"],
[Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, "/src/tsconfig.second.json", "[\"**/*\"]", "[]"]
errorDiagnostic([Diagnostics.The_specified_path_does_not_exist_Colon_0, "/src/foobar.json"]),
errorDiagnostic([Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, "/src/tsconfig.first.json", "[\"**/*\"]", "[]"]),
errorDiagnostic([Diagnostics.The_specified_path_does_not_exist_Colon_0, "/src/foobar.json"]),
errorDiagnostic([Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, "/src/tsconfig.second.json", "[\"**/*\"]", "[]"])
);
});
});
@@ -43,7 +43,10 @@ namespace ts {
[Diagnostics.Building_project_0, "/src/src/other/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/main/tsconfig.json", "src/dist/a.js"],
[Diagnostics.Building_project_0, "/src/src/main/tsconfig.json"],
[Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, "/src/dist/tsconfig.tsbuildinfo", "/src/src/other"]
{
message: [Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, "/src/dist/tsconfig.tsbuildinfo", "/src/src/other"],
location: expectedLocationIndexOf(fs, "/src/src/main/tsconfig.json", `{ "path": "../other" }`),
}
);
verifyOutputsPresent(fs, allExpectedOutputs);
verifyOutputsAbsent(fs, missingOutputs);
@@ -75,7 +78,10 @@ namespace ts {
[Diagnostics.Building_project_0, "/src/src/other/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/main/tsconfig.json", "src/dist/a.js"],
[Diagnostics.Building_project_0, "/src/src/main/tsconfig.json"],
[Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, "/src/dist/tsconfig.tsbuildinfo", "/src/src/other"]
{
message: [Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, "/src/dist/tsconfig.tsbuildinfo", "/src/src/other"],
location: expectedLocationIndexOf(fs, "/src/src/main/tsconfig.json", `{"path":"../other"}`),
}
);
verifyOutputsPresent(fs, allExpectedOutputs);
verifyOutputsAbsent(fs, missingOutputs);
@@ -28,11 +28,17 @@ namespace ts {
}
it("with resolveJsonModule and include only", () => {
verifyProjectWithResolveJsonModule("/src/tsconfig_withInclude.json", [
Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
"/src/src/hello.json",
"/src/tsconfig_withInclude.json"
]);
verifyProjectWithResolveJsonModule(
"/src/tsconfig_withInclude.json",
{
message: [
Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
"/src/src/hello.json",
"/src/tsconfig_withInclude.json"
],
location: expectedLocationIndexOf(projFs, "/src/src/index.ts", `"./hello.json"`)
}
);
});
it("with resolveJsonModule and include of *.json along with other include", () => {
+4 -1
View File
@@ -450,7 +450,10 @@ namespace ts {
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"],
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
[Diagnostics.Property_0_does_not_exist_on_type_1, "muitply", `typeof import("/src/core/index")`],
{
message: [Diagnostics.Property_0_does_not_exist_on_type_1, "muitply", `typeof import("/src/core/index")`],
location: expectedLocationIndexOf(fs, "/src/logic/index.ts", "muitply"),
},
[Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, "src/tests/tsconfig.json", "src/logic"],
[Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, "/src/tests/tsconfig.json", "/src/logic"]
);
@@ -69,7 +69,14 @@ export const b = new A();`);
verifyBuild(fs => modifyFsBTsToNonRelativeImport(fs, "node"),
allExpectedOutputs,
expectedFileTraces,
[Diagnostics.Cannot_find_module_0, "a"],
{
message: [Diagnostics.Cannot_find_module_0, "a"],
location: {
file: "/src/b.ts",
start: `import {A} from 'a';`.indexOf(`'a'`),
length: `'a'`.length
}
},
);
});
});
+142 -1
View File
@@ -16,7 +16,6 @@ namespace ts.tscWatch {
return host;
}
export function createSolutionBuilder(system: WatchedSystem, rootNames: readonly string[], defaultOptions?: BuildOptions) {
const host = createSolutionBuilderHost(system);
host.now = system.now.bind(system);
@@ -1229,4 +1228,146 @@ export function someFn() { }`);
]);
});
});
describe("unittests:: tsbuild:: watchMode:: with demo project", () => {
const projectLocation = `${projectsLocation}/demo`;
let coreFiles: File[];
let animalFiles: File[];
let zooFiles: File[];
let solutionFile: File;
let baseConfig: File;
let allFilesExceptBase: File[];
before(() => {
coreFiles = subProjectFiles("core", ["tsconfig.json", "utilities.ts"]);
animalFiles = subProjectFiles("animals", ["tsconfig.json", "animal.ts", "dog.ts", "index.ts"]);
zooFiles = subProjectFiles("zoo", ["tsconfig.json", "zoo.ts"]);
solutionFile = projectFile("tsconfig.json");
baseConfig = projectFile("tsconfig-base.json");
allFilesExceptBase = [...coreFiles, ...animalFiles, ...zooFiles, solutionFile];
});
after(() => {
coreFiles = undefined!;
animalFiles = undefined!;
zooFiles = undefined!;
solutionFile = undefined!;
baseConfig = undefined!;
allFilesExceptBase = undefined!;
});
it("updates with circular reference", () => {
const host = createTsBuildWatchSystem([
...allFilesExceptBase,
baseConfig,
{ path: libFile.path, content: libContent }
], { currentDirectory: projectLocation });
host.writeFile(coreFiles[0].path, coreFiles[0].content.replace(
"}",
`},
"references": [
{
"path": "../zoo"
}
]`
));
createSolutionBuilderWithWatch(host, ["tsconfig.json"], { verbose: true, watch: true });
checkOutputErrorsInitial(host, [
`error TS6202: Project references may not form a circular graph. Cycle detected: /user/username/projects/demo/tsconfig.json\r\n/user/username/projects/demo/core/tsconfig.json\r\n/user/username/projects/demo/zoo/tsconfig.json\r\n/user/username/projects/demo/animals/tsconfig.json\n`
], /*disableConsoleClears*/ undefined, [
`Projects in this build: \r\n * animals/tsconfig.json\r\n * zoo/tsconfig.json\r\n * core/tsconfig.json\r\n * tsconfig.json\n\n`
]);
verifyWatches(host);
// Make changes
host.writeFile(coreFiles[0].path, coreFiles[0].content);
host.checkTimeoutQueueLengthAndRun(1); // build core
host.checkTimeoutQueueLengthAndRun(1); // build animals
host.checkTimeoutQueueLengthAndRun(1); // build zoo
host.checkTimeoutQueueLengthAndRun(1); // build solution
host.checkTimeoutQueueLength(0);
checkOutputErrorsIncremental(host, emptyArray, /*disableConsoleClears*/ undefined, /*logsBeforeWatchDiagnostics*/ undefined, [
`Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist\n\n`,
`Building project '/user/username/projects/demo/core/tsconfig.json'...\n\n`,
`Project 'animals/tsconfig.json' is out of date because output file 'lib/animals/animal.js' does not exist\n\n`,
`Building project '/user/username/projects/demo/animals/tsconfig.json'...\n\n`,
`Project 'zoo/tsconfig.json' is out of date because output file 'lib/zoo/zoo.js' does not exist\n\n`,
`Building project '/user/username/projects/demo/zoo/tsconfig.json'...\n\n`,
]);
});
it("updates with bad reference", () => {
const host = createTsBuildWatchSystem([
...allFilesExceptBase,
baseConfig,
{ path: libFile.path, content: libContent }
], { currentDirectory: projectLocation });
host.writeFile(coreFiles[1].path, `import * as A from '../animals';
${coreFiles[1].content}`);
createSolutionBuilderWithWatch(host, ["tsconfig.json"], { verbose: true, watch: true });
const errors = [
`animals/index.ts(1,20): error TS6059: File '/user/username/projects/demo/animals/animal.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`,
`animals/index.ts(1,20): error TS6307: File '/user/username/projects/demo/animals/animal.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n`,
`animals/index.ts(4,32): error TS6059: File '/user/username/projects/demo/animals/dog.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`,
`animals/index.ts(4,32): error TS6307: File '/user/username/projects/demo/animals/dog.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n`,
`core/utilities.ts(1,1): error TS6133: 'A' is declared but its value is never read.\n`,
`core/utilities.ts(1,20): error TS6059: File '/user/username/projects/demo/animals/index.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`,
`core/utilities.ts(1,20): error TS6307: File '/user/username/projects/demo/animals/index.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n`
].map(hostOutputDiagnostic);
checkOutputErrors(host, [
startingCompilationInWatchMode(),
hostOutputLog(`Projects in this build: \r\n * core/tsconfig.json\r\n * animals/tsconfig.json\r\n * zoo/tsconfig.json\r\n * tsconfig.json\n\n`),
hostOutputLog(`Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist\n\n`),
hostOutputLog(`Building project '/user/username/projects/demo/core/tsconfig.json'...\n\n`),
...errors,
hostOutputLog(`Project 'animals/tsconfig.json' can't be built because its dependency 'core' has errors\n\n`),
hostOutputLog(`Skipping build of project '/user/username/projects/demo/animals/tsconfig.json' because its dependency '/user/username/projects/demo/core' has errors\n\n`),
hostOutputLog(`Project 'zoo/tsconfig.json' can't be built because its dependency 'animals' was not built\n\n`),
hostOutputLog(`Skipping build of project '/user/username/projects/demo/zoo/tsconfig.json' because its dependency '/user/username/projects/demo/animals' was not built\n\n`),
foundErrorsWatching(errors)
]);
verifyWatches(host);
// Make changes
host.writeFile(coreFiles[1].path, `
import * as A from '../animals';
${coreFiles[1].content}`);
const newErrors = [
`animals/index.ts(1,20): error TS6059: File '/user/username/projects/demo/animals/animal.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`,
`animals/index.ts(1,20): error TS6307: File '/user/username/projects/demo/animals/animal.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n`,
`animals/index.ts(4,32): error TS6059: File '/user/username/projects/demo/animals/dog.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`,
`animals/index.ts(4,32): error TS6307: File '/user/username/projects/demo/animals/dog.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n`,
`core/utilities.ts(2,1): error TS6133: 'A' is declared but its value is never read.\n`,
`core/utilities.ts(2,20): error TS6059: File '/user/username/projects/demo/animals/index.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`,
`core/utilities.ts(2,20): error TS6307: File '/user/username/projects/demo/animals/index.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n`
].map(hostOutputDiagnostic);
host.checkTimeoutQueueLengthAndRun(1); // build core
host.checkTimeoutQueueLength(0);
checkOutputErrors(host, [
fileChangeDetected(),
hostOutputLog(`Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist\n\n`),
hostOutputLog(`Building project '/user/username/projects/demo/core/tsconfig.json'...\n\n`),
...newErrors,
foundErrorsWatching(newErrors)
]);
});
function subProjectFiles(subProject: string, fileNames: readonly string[]): File[] {
return fileNames.map(file => projectFile(`${subProject}/${file}`));
}
function projectFile(fileName: string): File {
return getFileFromProject("demo", fileName);
}
function verifyWatches(host: TsBuildWatchSystem) {
checkWatchedFilesDetailed(host, allFilesExceptBase.map(f => f.path), 1);
checkWatchedDirectories(host, emptyArray, /*recursive*/ false);
checkWatchedDirectoriesDetailed(
host,
[`${projectLocation}/core`, `${projectLocation}/animals`, `${projectLocation}/zoo`],
1,
/*recursive*/ true
);
}
});
}
+96 -50
View File
@@ -54,30 +54,51 @@ namespace ts.tscWatch {
const elapsedRegex = /^Elapsed:: [0-9]+ms/;
const buildVerboseLogRegEx = /^.+ \- /;
function checkOutputErrors(
export enum HostOutputKind {
Log,
Diagnostic,
WatchDiagnostic
}
export interface HostOutputLog {
kind: HostOutputKind.Log;
expected: string;
caption?: string;
}
export interface HostOutputDiagnostic {
kind: HostOutputKind.Diagnostic;
diagnostic: Diagnostic | string;
}
export interface HostOutputWatchDiagnostic {
kind: HostOutputKind.WatchDiagnostic;
diagnostic: Diagnostic | string;
}
export type HostOutput = HostOutputLog | HostOutputDiagnostic | HostOutputWatchDiagnostic;
export function checkOutputErrors(
host: WatchedSystem,
logsBeforeWatchDiagnostic: string[] | undefined,
preErrorsWatchDiagnostic: Diagnostic | undefined,
logsBeforeErrors: string[] | undefined,
errors: readonly Diagnostic[] | readonly string[],
disableConsoleClears?: boolean | undefined,
...postErrorsWatchDiagnostics: Diagnostic[] | string[]
expected: readonly HostOutput[],
disableConsoleClears?: boolean | undefined
) {
let screenClears = 0;
const outputs = host.getOutput();
const expectedOutputCount = (preErrorsWatchDiagnostic ? 1 : 0) +
errors.length +
postErrorsWatchDiagnostics.length +
(logsBeforeWatchDiagnostic ? logsBeforeWatchDiagnostic.length : 0) +
(logsBeforeErrors ? logsBeforeErrors.length : 0);
assert.equal(outputs.length, expectedOutputCount, JSON.stringify(outputs));
assert.equal(outputs.length, expected.length, JSON.stringify(outputs));
let index = 0;
forEach(logsBeforeWatchDiagnostic, log => assertLog("logsBeforeWatchDiagnostic", log));
if (preErrorsWatchDiagnostic) assertWatchDiagnostic(preErrorsWatchDiagnostic);
forEach(logsBeforeErrors, log => assertLog("logBeforeError", log));
// Verify errors
forEach(errors, assertDiagnostic);
forEach(postErrorsWatchDiagnostics, assertWatchDiagnostic);
forEach(expected, expected => {
switch (expected.kind) {
case HostOutputKind.Log:
return assertLog(expected);
case HostOutputKind.Diagnostic:
return assertDiagnostic(expected);
case HostOutputKind.WatchDiagnostic:
return assertWatchDiagnostic(expected);
default:
return Debug.assertNever(expected);
}
});
assert.equal(host.screenClears.length, screenClears, "Expected number of screen clears");
host.clearOutput();
@@ -85,7 +106,7 @@ namespace ts.tscWatch {
return !!(diagnostic as Diagnostic).messageText;
}
function assertDiagnostic(diagnostic: Diagnostic | string) {
function assertDiagnostic({ diagnostic }: HostOutputDiagnostic) {
const expected = isDiagnostic(diagnostic) ? formatDiagnostic(diagnostic, host) : diagnostic;
assert.equal(outputs[index], expected, getOutputAtFailedMessage("Diagnostic", expected));
index++;
@@ -95,13 +116,13 @@ namespace ts.tscWatch {
return log.replace(elapsedRegex, "").replace(buildVerboseLogRegEx, "");
}
function assertLog(caption: string, expected: string) {
function assertLog({ caption, expected }: HostOutputLog) {
const actual = outputs[index];
assert.equal(getCleanLogString(actual), getCleanLogString(expected), getOutputAtFailedMessage(caption, expected));
assert.equal(getCleanLogString(actual), getCleanLogString(expected), getOutputAtFailedMessage(caption || "Log", expected));
index++;
}
function assertWatchDiagnostic(diagnostic: Diagnostic | string) {
function assertWatchDiagnostic({ diagnostic }: HostOutputWatchDiagnostic) {
if (isString(diagnostic)) {
assert.equal(outputs[index], diagnostic, getOutputAtFailedMessage("Diagnostic", diagnostic));
}
@@ -128,54 +149,79 @@ namespace ts.tscWatch {
}
}
function createErrorsFoundCompilerDiagnostic(errors: readonly Diagnostic[] | readonly string[]) {
return errors.length === 1
? createCompilerDiagnostic(Diagnostics.Found_1_error_Watching_for_file_changes)
: createCompilerDiagnostic(Diagnostics.Found_0_errors_Watching_for_file_changes, errors.length);
export function hostOutputLog(expected: string, caption?: string): HostOutputLog {
return { kind: HostOutputKind.Log, expected, caption };
}
export function hostOutputDiagnostic(diagnostic: Diagnostic | string): HostOutputDiagnostic {
return { kind: HostOutputKind.Diagnostic, diagnostic };
}
export function hostOutputWatchDiagnostic(diagnostic: Diagnostic | string): HostOutputWatchDiagnostic {
return { kind: HostOutputKind.WatchDiagnostic, diagnostic };
}
export function startingCompilationInWatchMode() {
return hostOutputWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Starting_compilation_in_watch_mode));
}
export function foundErrorsWatching(errors: readonly any[]) {
return hostOutputWatchDiagnostic(errors.length === 1 ?
createCompilerDiagnostic(Diagnostics.Found_1_error_Watching_for_file_changes) :
createCompilerDiagnostic(Diagnostics.Found_0_errors_Watching_for_file_changes, errors.length)
);
}
export function fileChangeDetected() {
return hostOutputWatchDiagnostic(createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation));
}
export function checkOutputErrorsInitial(host: WatchedSystem, errors: readonly Diagnostic[] | readonly string[], disableConsoleClears?: boolean, logsBeforeErrors?: string[]) {
checkOutputErrors(
host,
/*logsBeforeWatchDiagnostic*/ undefined,
createCompilerDiagnostic(Diagnostics.Starting_compilation_in_watch_mode),
logsBeforeErrors,
errors,
disableConsoleClears,
createErrorsFoundCompilerDiagnostic(errors));
[
startingCompilationInWatchMode(),
...map(logsBeforeErrors || emptyArray, expected => hostOutputLog(expected, "logBeforeError")),
...map(errors, hostOutputDiagnostic),
foundErrorsWatching(errors)
],
disableConsoleClears
);
}
export function checkOutputErrorsIncremental(host: WatchedSystem, errors: readonly Diagnostic[] | readonly string[], disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) {
checkOutputErrors(
host,
logsBeforeWatchDiagnostic,
createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation),
logsBeforeErrors,
errors,
disableConsoleClears,
createErrorsFoundCompilerDiagnostic(errors));
[
...map(logsBeforeWatchDiagnostic || emptyArray, expected => hostOutputLog(expected, "logsBeforeWatchDiagnostic")),
fileChangeDetected(),
...map(logsBeforeErrors || emptyArray, expected => hostOutputLog(expected, "logBeforeError")),
...map(errors, hostOutputDiagnostic),
foundErrorsWatching(errors)
],
disableConsoleClears
);
}
export function checkOutputErrorsIncrementalWithExit(host: WatchedSystem, errors: readonly Diagnostic[] | readonly string[], expectedExitCode: ExitStatus, disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) {
checkOutputErrors(
host,
logsBeforeWatchDiagnostic,
createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation),
logsBeforeErrors,
errors,
disableConsoleClears);
[
...map(logsBeforeWatchDiagnostic || emptyArray, expected => hostOutputLog(expected, "logsBeforeWatchDiagnostic")),
fileChangeDetected(),
...map(logsBeforeErrors || emptyArray, expected => hostOutputLog(expected, "logBeforeError")),
...map(errors, hostOutputDiagnostic),
],
disableConsoleClears
);
assert.equal(host.exitCode, expectedExitCode);
}
export function checkNormalBuildErrors(host: WatchedSystem, errors: readonly Diagnostic[] | readonly string[], reportErrorSummary?: boolean) {
checkOutputErrors(
host,
/*logsBeforeWatchDiagnostic*/ undefined,
/*preErrorsWatchDiagnostic*/ undefined,
/*logsBeforeErrors*/ undefined,
errors,
/*disableConsoleClears*/ undefined,
...(reportErrorSummary ? [getErrorSummaryText(errors.length, host.newLine)] : emptyArray)
[
...map(errors, hostOutputDiagnostic),
...reportErrorSummary ?
[hostOutputWatchDiagnostic(getErrorSummaryText(errors.length, host.newLine))] :
emptyArray
]
);
}
@@ -1335,5 +1335,42 @@ exports.a = 1;
checkProgramActualFiles(watch(), [aFile.path, bFile.path, libFile.path]);
}
});
it("reports errors correctly with file not in rootDir", () => {
const currentDirectory = "/user/username/projects/myproject";
const aFile: File = {
path: `${currentDirectory}/a.ts`,
content: `import { x } from "../b";`
};
const bFile: File = {
path: `/user/username/projects/b.ts`,
content: `export const x = 10;`
};
const configFile: File = {
path: `${currentDirectory}/tsconfig.json`,
content: JSON.stringify({
compilerOptions: {
rootDir: ".",
outDir: "lib"
}
})
};
const files = [aFile, bFile, libFile, configFile];
const host = createWatchedSystem(files, { currentDirectory });
const watch = createWatchOfConfigFile("tsconfig.json", host);
checkOutputErrorsInitial(host, [
getDiagnosticOfFileFromProgram(watch(), aFile.path, aFile.content.indexOf(`"../b"`), `"../b"`.length, Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, bFile.path, currentDirectory)
]);
const aContent = `
${aFile.content}`;
host.writeFile(aFile.path, aContent);
host.runQueuedTimeoutCallbacks();
checkOutputErrorsIncremental(host, [
getDiagnosticOfFileFromProgram(watch(), aFile.path, aContent.indexOf(`"../b"`), `"../b"`.length, Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, bFile.path, currentDirectory)
]);
});
});
}
@@ -6,17 +6,17 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(25,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(26,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(27,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(30,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'true'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(31,11): error TS2365: Operator '+' cannot be applied to types 'true' and 'false'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(32,11): error TS2365: Operator '+' cannot be applied to types 'true' and '123'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(30,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(31,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(32,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(33,11): error TS2365: Operator '+' cannot be applied to types '{}' and '{}'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(34,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'Number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(35,11): error TS2365: Operator '+' cannot be applied to types 'number' and '() => void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(36,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(37,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'typeof C'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(38,11): error TS2365: Operator '+' cannot be applied to types 'E.a' and 'C'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(39,11): error TS2365: Operator '+' cannot be applied to types 'E.a' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(40,11): error TS2365: Operator '+' cannot be applied to types 'E.a' and 'typeof M'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(38,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'C'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(39,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(40,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'typeof M'.
==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts (19 errors) ====
@@ -67,13 +67,13 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
// other cases
var r10 = a + true;
~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'true'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r11 = true + false;
~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'true' and 'false'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
var r12 = true + 123;
~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'true' and '123'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'.
var r13 = {} + {};
~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types '{}' and '{}'.
@@ -91,10 +91,10 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'typeof C'.
var r18 = E.a + new C();
~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'E.a' and 'C'.
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'C'.
var r19 = E.a + C.foo();
~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'E.a' and 'void'.
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'void'.
var r20 = E.a + M;
~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'E.a' and 'typeof M'.
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'typeof M'.
@@ -5,7 +5,7 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'null'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(19,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'Number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'true'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(21,10): error TS2365: Operator '+' cannot be applied to types 'null' and '{ a: string; }'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(22,11): error TS2365: Operator '+' cannot be applied to types 'null' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(23,11): error TS2365: Operator '+' cannot be applied to types 'null' and '() => void'.
@@ -47,7 +47,7 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'Number'.
var r8 = null + true;
~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'true'.
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'boolean'.
var r9 = null + { a: '' };
~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'null' and '{ a: string; }'.
@@ -5,7 +5,7 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'undefined'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(19,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'Number'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'true'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(21,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and '{ a: string; }'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(22,11): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'void'.
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(23,11): error TS2365: Operator '+' cannot be applied to types 'undefined' and '() => void'.
@@ -47,7 +47,7 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'Number'.
var r8 = undefined + true;
~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'true'.
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'boolean'.
var r9 = undefined + { a: '' };
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and '{ a: string; }'.
+3 -2
View File
@@ -14,7 +14,7 @@ and limitations under the License.
***************************************************************************** */
declare namespace ts {
const versionMajorMinor = "3.6";
const versionMajorMinor = "3.7";
/** The version of the TypeScript compiler release */
const version: string;
}
@@ -1925,7 +1925,8 @@ declare namespace ts {
Success = 0,
DiagnosticsPresent_OutputsSkipped = 1,
DiagnosticsPresent_OutputsGenerated = 2,
InvalidProject_OutputsSkipped = 3
InvalidProject_OutputsSkipped = 3,
ProjectReferenceCycle_OutputsSkupped = 4
}
export interface EmitResult {
emitSkipped: boolean;
+3 -2
View File
@@ -14,7 +14,7 @@ and limitations under the License.
***************************************************************************** */
declare namespace ts {
const versionMajorMinor = "3.6";
const versionMajorMinor = "3.7";
/** The version of the TypeScript compiler release */
const version: string;
}
@@ -1925,7 +1925,8 @@ declare namespace ts {
Success = 0,
DiagnosticsPresent_OutputsSkipped = 1,
DiagnosticsPresent_OutputsGenerated = 2,
InvalidProject_OutputsSkipped = 3
InvalidProject_OutputsSkipped = 3,
ProjectReferenceCycle_OutputsSkupped = 4
}
export interface EmitResult {
emitSkipped: boolean;
@@ -1,9 +1,9 @@
=== tests/cases/compiler/file1.ts ===
function foo() {}
>foo : Symbol("tests/cases/compiler/file1.ts", Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 17), Decl(file2.ts, 1, 8))
>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 17), Decl(file2.ts, 1, 8))
namespace foo {
>foo : Symbol("tests/cases/compiler/file1.ts", Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 17), Decl(file2.ts, 1, 8))
>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 17), Decl(file2.ts, 1, 8))
export var v = 1;
>v : Symbol(v, Decl(file1.ts, 2, 14))
@@ -3,10 +3,10 @@ declare module "file1" {
>"file1" : Symbol("file1", Decl(file1.d.ts, 0, 0))
function foo(): void;
>foo : Symbol("tests/cases/compiler/file1.d.ts", Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 25), Decl(file2.ts, 2, 8))
>foo : Symbol(foo, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 25), Decl(file2.ts, 2, 8))
namespace foo {
>foo : Symbol("tests/cases/compiler/file1.d.ts", Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 25), Decl(file2.ts, 2, 8))
>foo : Symbol(foo, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 25), Decl(file2.ts, 2, 8))
export var v: number;
>v : Symbol(v, Decl(file1.d.ts, 3, 18))
@@ -1,9 +1,9 @@
=== tests/cases/compiler/file1.ts ===
class foo {}
>foo : Symbol("tests/cases/compiler/file1.ts", Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 12), Decl(file2.ts, 1, 8))
>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 12), Decl(file2.ts, 1, 8))
namespace foo {
>foo : Symbol("tests/cases/compiler/file1.ts", Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 12), Decl(file2.ts, 1, 8))
>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 12), Decl(file2.ts, 1, 8))
export var v = 1;
>v : Symbol(v, Decl(file1.ts, 2, 14))
@@ -3,10 +3,10 @@ declare module "file1" {
>"file1" : Symbol("file1", Decl(file1.d.ts, 0, 0))
class foo {}
>foo : Symbol("tests/cases/compiler/file1.d.ts", Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 16), Decl(file2.ts, 2, 8))
>foo : Symbol(foo, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 16), Decl(file2.ts, 2, 8))
namespace foo {
>foo : Symbol("tests/cases/compiler/file1.d.ts", Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 16), Decl(file2.ts, 2, 8))
>foo : Symbol(foo, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 16), Decl(file2.ts, 2, 8))
export var v: number;
>v : Symbol(v, Decl(file1.d.ts, 3, 18))
@@ -16,12 +16,12 @@ declare module "express" {
>"express" : Symbol("express", Decl(express.d.ts, 4, 1))
function e(): e.Express;
>e : Symbol("tests/cases/compiler/express.d.ts", Decl(express.d.ts, 6, 26), Decl(express.d.ts, 7, 28), Decl(augmentation.ts, 1, 29))
>e : Symbol(e, Decl(express.d.ts, 6, 26), Decl(express.d.ts, 7, 28), Decl(augmentation.ts, 1, 29))
>e : Symbol(e, Decl(express.d.ts, 6, 26), Decl(express.d.ts, 7, 28))
>Express : Symbol(Express, Decl(express.d.ts, 52, 9))
namespace e {
>e : Symbol("tests/cases/compiler/express.d.ts", Decl(express.d.ts, 6, 26), Decl(express.d.ts, 7, 28), Decl(augmentation.ts, 1, 29))
>e : Symbol(e, Decl(express.d.ts, 6, 26), Decl(express.d.ts, 7, 28), Decl(augmentation.ts, 1, 29))
interface IRoute {
>IRoute : Symbol(IRoute, Decl(express.d.ts, 8, 17))
@@ -1,9 +1,9 @@
=== tests/cases/compiler/file1.ts ===
class foo {}
>foo : Symbol("tests/cases/compiler/file1.ts", Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 12), Decl(file2.ts, 1, 10))
>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 12), Decl(file2.ts, 1, 10))
namespace foo {
>foo : Symbol("tests/cases/compiler/file1.ts", Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 12), Decl(file2.ts, 1, 10))
>foo : Symbol(foo, Decl(file1.ts, 0, 0), Decl(file1.ts, 0, 12), Decl(file2.ts, 1, 10))
export class A {}
>A : Symbol(A, Decl(file1.ts, 1, 15), Decl(file2.ts, 4, 26))
@@ -3,10 +3,10 @@ declare module "file1" {
>"file1" : Symbol("file1", Decl(file1.d.ts, 0, 0))
class foo {}
>foo : Symbol("tests/cases/compiler/file1.d.ts", Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 16), Decl(file2.ts, 1, 28))
>foo : Symbol(foo, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 16), Decl(file2.ts, 1, 28))
namespace foo {
>foo : Symbol("tests/cases/compiler/file1.d.ts", Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 16), Decl(file2.ts, 1, 28))
>foo : Symbol(foo, Decl(file1.d.ts, 0, 24), Decl(file1.d.ts, 1, 16), Decl(file2.ts, 1, 28))
class A {}
>A : Symbol(A, Decl(file1.d.ts, 2, 19), Decl(file2.ts, 4, 24))
@@ -17,12 +17,12 @@ declare global {
>global : Symbol(global, Decl(global.d.ts, 2, 26))
export const THREE: typeof _three;
>THREE : Symbol("tests/cases/compiler/global", Decl(global.d.ts, 0, 0), Decl(global.d.ts, 5, 14))
>THREE : Symbol(THREE, Decl(global.d.ts, 0, 0), Decl(global.d.ts, 5, 14))
>_three : Symbol(_three, Decl(global.d.ts, 0, 6))
}
=== tests/cases/compiler/test.ts ===
const m = THREE
>m : Symbol(m, Decl(test.ts, 0, 5))
>THREE : Symbol("tests/cases/compiler/global", Decl(global.d.ts, 0, 0), Decl(global.d.ts, 5, 14))
>THREE : Symbol(THREE, Decl(global.d.ts, 0, 0), Decl(global.d.ts, 5, 14))
@@ -0,0 +1,14 @@
tests/cases/compiler/classExpressionPropertyModifiers.ts(2,5): error TS1031: 'declare' modifier cannot appear on a class element.
tests/cases/compiler/classExpressionPropertyModifiers.ts(3,5): error TS1031: 'export' modifier cannot appear on a class element.
==== tests/cases/compiler/classExpressionPropertyModifiers.ts (2 errors) ====
const a = class Cat {
declare [Symbol.toStringTag] = "uh";
~~~~~~~
!!! error TS1031: 'declare' modifier cannot appear on a class element.
export foo = 1;
~~~~~~
!!! error TS1031: 'export' modifier cannot appear on a class element.
}
@@ -1,29 +1,29 @@
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(6,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'void'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(7,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'true'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(8,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and '0'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E.a'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(7,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(8,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'number'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and '{}'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(11,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'null'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(12,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'undefined'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(15,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'void'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(16,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'true'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(17,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '0'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(18,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'E.a'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(16,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'boolean'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(17,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'number'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(18,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'E'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(19,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(20,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'null'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(21,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'undefined'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(24,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(25,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'true'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(26,1): error TS2365: Operator '+=' cannot be applied to types 'void' and '0'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(27,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'E.a'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(25,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'boolean'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(26,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'number'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(27,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'E'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(28,1): error TS2365: Operator '+=' cannot be applied to types 'void' and '{}'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(29,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'null'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(30,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'undefined'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(33,1): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(34,1): error TS2365: Operator '+=' cannot be applied to types 'number' and 'true'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(34,1): error TS2365: Operator '+=' cannot be applied to types 'number' and 'boolean'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(35,1): error TS2365: Operator '+=' cannot be applied to types 'number' and '{}'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(38,1): error TS2365: Operator '+=' cannot be applied to types 'E' and 'void'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(39,1): error TS2365: Operator '+=' cannot be applied to types 'E' and 'true'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(39,1): error TS2365: Operator '+=' cannot be applied to types 'E' and 'boolean'.
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(40,1): error TS2365: Operator '+=' cannot be applied to types 'E' and '{}'.
@@ -38,13 +38,13 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'void'.
x1 += true;
~~~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'true'.
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'.
x1 += 0;
~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and '0'.
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'number'.
x1 += E.a;
~~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E.a'.
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E'.
x1 += {};
~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and '{}'.
@@ -61,13 +61,13 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'void'.
x2 += true;
~~~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'true'.
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'boolean'.
x2 += 0;
~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and '0'.
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'number'.
x2 += E.a;
~~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'E.a'.
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'E'.
x2 += {};
~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'.
@@ -84,13 +84,13 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'.
x3 += true;
~~~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'true'.
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'boolean'.
x3 += 0;
~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and '0'.
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'number'.
x3 += E.a;
~~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'E.a'.
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'E'.
x3 += {};
~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and '{}'.
@@ -107,7 +107,7 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'.
x4 += true;
~~~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and 'true'.
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and 'boolean'.
x4 += {};
~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and '{}'.
@@ -118,7 +118,7 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
!!! error TS2365: Operator '+=' cannot be applied to types 'E' and 'void'.
x5 += true;
~~~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'E' and 'true'.
!!! error TS2365: Operator '+=' cannot be applied to types 'E' and 'boolean'.
x5 += {};
~~~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'E' and '{}'.
@@ -19,7 +19,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,4): error TS2349:
Type 'String' has no call signatures.
tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,4): error TS2538: Type 'any' cannot be used as an index type.
tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,4): error TS2538: Type 'any' cannot be used as an index type.
tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: Operator '+' cannot be applied to types '1' and '{}'.
tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: Operator '+' cannot be applied to types 'number' and '{}'.
==== tests/cases/compiler/computedPropertiesInDestructuring1.ts (20 errors) ====
@@ -98,7 +98,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365:
~~~~~~~~
!!! error TS2538: Type 'any' cannot be used as an index type.
~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types '1' and '{}'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and '{}'.
@@ -19,7 +19,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,4): error TS23
Type 'String' has no call signatures.
tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,4): error TS2538: Type 'any' cannot be used as an index type.
tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,4): error TS2538: Type 'any' cannot be used as an index type.
tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS2365: Operator '+' cannot be applied to types '1' and '{}'.
tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS2365: Operator '+' cannot be applied to types 'number' and '{}'.
==== tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts (20 errors) ====
@@ -99,5 +99,5 @@ tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS23
~~~~~~~~
!!! error TS2538: Type 'any' cannot be used as an index type.
~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types '1' and '{}'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and '{}'.
+9 -11
View File
@@ -33,7 +33,6 @@ npm ERR! /root/.npm/_logs/XXXX-XX-XXXXXXXXX-debug.log
ERROR: "build:lib" exited with 1.
XX of XX: [@azure/core-paging] completed successfully in ? seconds
XX of XX: [@azure/core-tracing] completed successfully in ? seconds
XX of XX: [@azure/cosmos] completed successfully in ? seconds
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @azure/keyvault-certificates@X.X.X extract-api: `tsc -p . && api-extractor run --local`
@@ -45,19 +44,19 @@ npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/XXXX-XX-XXXXXXXXX-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @azure/keyvault-keys@X.X.X-preview.3 extract-api: `tsc -p . && api-extractor run --local`
npm ERR! @azure/keyvault-keys@X.X.X-preview.4 extract-api: `tsc -p . && api-extractor run --local`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @azure/keyvault-keys@X.X.X-preview.3 extract-api script.
npm ERR! Failed at the @azure/keyvault-keys@X.X.X-preview.4 extract-api script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/XXXX-XX-XXXXXXXXX-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @azure/keyvault-secrets@X.X.X-preview.4 extract-api: `tsc -p . && api-extractor run --local`
npm ERR! @azure/keyvault-secrets@X.X.X-preview.5 extract-api: `tsc -p . && api-extractor run --local`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @azure/keyvault-secrets@X.X.X-preview.4 extract-api script.
npm ERR! Failed at the @azure/keyvault-secrets@X.X.X-preview.5 extract-api script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/XXXX-XX-XXXXXXXXX-debug.log
@@ -67,7 +66,7 @@ XX of XX: [@azure/storage-file] completed successfully in ? seconds
XX of XX: [@azure/storage-queue] completed successfully in ? seconds
XX of XX: [@azure/template] completed successfully in ? seconds
XX of XX: [testhub] completed successfully in ? seconds
SUCCESS (15)
SUCCESS (14)
================================
@azure/abort-controller (? seconds)
@azure/core-arm (? seconds)
@@ -75,7 +74,6 @@ SUCCESS (15)
@azure/core-auth (? seconds)
@azure/core-paging (? seconds)
@azure/core-tracing (? seconds)
@azure/cosmos (? seconds)
@azure/event-processor-host (? seconds)
@azure/identity (? seconds)
@azure/service-bus (? seconds)
@@ -132,20 +130,20 @@ npm ERR! /root/.npm/_logs/XXXX-XX-XXXXXXXXX-debug.log
@azure/keyvault-keys ( ? seconds)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @azure/keyvault-keys@X.X.X-preview.3 extract-api: `tsc -p . && api-extractor run --local`
npm ERR! @azure/keyvault-keys@X.X.X-preview.4 extract-api: `tsc -p . && api-extractor run --local`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @azure/keyvault-keys@X.X.X-preview.3 extract-api script.
npm ERR! Failed at the @azure/keyvault-keys@X.X.X-preview.4 extract-api script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/XXXX-XX-XXXXXXXXX-debug.log
@azure/keyvault-secrets ( ? seconds)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @azure/keyvault-secrets@X.X.X-preview.4 extract-api: `tsc -p . && api-extractor run --local`
npm ERR! @azure/keyvault-secrets@X.X.X-preview.5 extract-api: `tsc -p . && api-extractor run --local`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @azure/keyvault-secrets@X.X.X-preview.4 extract-api script.
npm ERR! Failed at the @azure/keyvault-secrets@X.X.X-preview.5 extract-api script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/XXXX-XX-XXXXXXXXX-debug.log
@@ -3,7 +3,7 @@ export = foo;
>foo : Symbol(foo, Decl(index.d.ts, 0, 13))
declare namespace foo {
>foo : Symbol("/node_modules/foo/index.d.ts", Decl(index.d.ts, 0, 13), Decl(a.ts, 0, 27), Decl(b.ts, 0, 27))
>foo : Symbol(foo, Decl(index.d.ts, 0, 13), Decl(a.ts, 0, 27), Decl(b.ts, 0, 27))
export type T = number;
>T : Symbol(T, Decl(index.d.ts, 1, 23))
+12 -12
View File
@@ -1,17 +1,17 @@
tests/cases/compiler/expr.ts(87,5): error TS2367: This condition will always return 'false' since the types 'number' and 'string' have no overlap.
tests/cases/compiler/expr.ts(88,5): error TS2367: This condition will always return 'false' since the types 'number' and 'false' have no overlap.
tests/cases/compiler/expr.ts(88,5): error TS2367: This condition will always return 'false' since the types 'number' and 'boolean' have no overlap.
tests/cases/compiler/expr.ts(94,5): error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
tests/cases/compiler/expr.ts(95,5): error TS2367: This condition will always return 'false' since the types 'string' and 'false' have no overlap.
tests/cases/compiler/expr.ts(95,5): error TS2367: This condition will always return 'false' since the types 'string' and 'boolean' have no overlap.
tests/cases/compiler/expr.ts(98,5): error TS2367: This condition will always return 'false' since the types 'string' and 'E' have no overlap.
tests/cases/compiler/expr.ts(115,5): error TS2367: This condition will always return 'false' since the types 'E' and 'string' have no overlap.
tests/cases/compiler/expr.ts(116,5): error TS2367: This condition will always return 'false' since the types 'E' and 'false' have no overlap.
tests/cases/compiler/expr.ts(142,5): error TS2365: Operator '+' cannot be applied to types 'number' and 'false'.
tests/cases/compiler/expr.ts(116,5): error TS2367: This condition will always return 'false' since the types 'E' and 'boolean' have no overlap.
tests/cases/compiler/expr.ts(142,5): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
tests/cases/compiler/expr.ts(143,5): error TS2365: Operator '+' cannot be applied to types 'number' and 'I'.
tests/cases/compiler/expr.ts(161,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'number'.
tests/cases/compiler/expr.ts(163,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'false'.
tests/cases/compiler/expr.ts(163,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'boolean'.
tests/cases/compiler/expr.ts(165,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'I'.
tests/cases/compiler/expr.ts(166,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'E'.
tests/cases/compiler/expr.ts(170,5): error TS2365: Operator '+' cannot be applied to types 'E' and 'false'.
tests/cases/compiler/expr.ts(170,5): error TS2365: Operator '+' cannot be applied to types 'E' and 'boolean'.
tests/cases/compiler/expr.ts(172,5): error TS2365: Operator '+' cannot be applied to types 'E' and 'I'.
tests/cases/compiler/expr.ts(176,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/compiler/expr.ts(177,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
@@ -161,7 +161,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'string' have no overlap.
n==b;
~~~~
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'false' have no overlap.
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'boolean' have no overlap.
n==i;
n==n;
n==e;
@@ -172,7 +172,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
s==b;
~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'false' have no overlap.
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'boolean' have no overlap.
s==i;
s==s;
s==e;
@@ -199,7 +199,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'string' have no overlap.
e==b;
~~~~
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'false' have no overlap.
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'boolean' have no overlap.
e==a;
e==i;
e==e;
@@ -227,7 +227,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
n+s;
n+b;
~~~
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'false'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
n+i;
~~~
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'I'.
@@ -254,7 +254,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
i+s;
i+b;
~~~
!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'false'.
!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'boolean'.
i+a;
i+i;
~~~
@@ -267,7 +267,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
e+s;
e+b;
~~~
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'false'.
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'boolean'.
e+a;
e+i;
~~~
@@ -1,6 +1,6 @@
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(4,16): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(5,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(6,9): error TS2367: This condition will always return 'false' since the types 'string' and '1' have no overlap.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(6,9): error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(8,16): error TS2339: Property 'unknownProperty' does not exist on type 'string'.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(12,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'number', but here has type 'string'.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(16,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type 'any', but here has type 'string'.
@@ -18,7 +18,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
if (x === 1) {
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and '1' have no overlap.
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
}
let a3 = x.unknownProperty;
~~~~~~~~~~~~~~~
@@ -6,12 +6,12 @@ import moment = require("moment-timezone");
=== tests/cases/compiler/node_modules/moment/index.d.ts ===
declare function moment(): moment.Moment;
>moment : Symbol("tests/cases/compiler/node_modules/moment/index.d.ts", Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41), Decl(idx.ts, 0, 34), Decl(index.d.ts, 1, 16))
>moment : Symbol(moment, Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41), Decl(idx.ts, 0, 34), Decl(index.d.ts, 1, 16))
>moment : Symbol(moment, Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41))
>Moment : Symbol(Moment, Decl(index.d.ts, 1, 26))
declare namespace moment {
>moment : Symbol("tests/cases/compiler/node_modules/moment/index.d.ts", Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41), Decl(idx.ts, 0, 34), Decl(index.d.ts, 1, 16))
>moment : Symbol(moment, Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41), Decl(idx.ts, 0, 34), Decl(index.d.ts, 1, 16))
interface Moment extends Object {
>Moment : Symbol(Moment, Decl(index.d.ts, 1, 26), Decl(idx.ts, 1, 25), Decl(idx.ts, 6, 34), Decl(index.d.ts, 2, 25))
@@ -32,7 +32,7 @@ export = moment;
>moment : Symbol(moment, Decl(index.d.ts, 0, 6))
declare module "moment" {
>"moment" : Symbol("tests/cases/compiler/node_modules/moment/index.d.ts", Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41), Decl(idx.ts, 0, 34), Decl(index.d.ts, 1, 16))
>"moment" : Symbol(moment, Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41), Decl(idx.ts, 0, 34), Decl(index.d.ts, 1, 16))
interface Moment {
>Moment : Symbol(Moment, Decl(index.d.ts, 1, 26), Decl(idx.ts, 1, 25), Decl(idx.ts, 6, 34), Decl(index.d.ts, 2, 25))
@@ -46,7 +46,7 @@ import * as _moment from "moment";
>_moment : Symbol(_moment, Decl(idx.ts, 0, 6))
declare module "moment" {
>"moment" : Symbol("tests/cases/compiler/node_modules/moment/index.d.ts", Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41), Decl(idx.ts, 0, 34), Decl(index.d.ts, 1, 16))
>"moment" : Symbol(moment, Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41), Decl(idx.ts, 0, 34), Decl(index.d.ts, 1, 16))
interface Moment {
>Moment : Symbol(Moment, Decl(index.d.ts, 1, 26), Decl(idx.ts, 1, 25), Decl(idx.ts, 6, 34), Decl(index.d.ts, 2, 25))
@@ -57,7 +57,7 @@ declare module "moment" {
}
}
declare module "moment-timezone" {
>"moment-timezone" : Symbol("tests/cases/compiler/node_modules/moment/index.d.ts", Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41), Decl(idx.ts, 0, 34), Decl(idx.ts, 5, 1))
>"moment-timezone" : Symbol(moment, Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 41), Decl(idx.ts, 0, 34), Decl(idx.ts, 5, 1))
interface Moment {
>Moment : Symbol(Moment, Decl(index.d.ts, 1, 26), Decl(idx.ts, 1, 25), Decl(idx.ts, 6, 34), Decl(index.d.ts, 2, 25))
@@ -3,10 +3,10 @@ declare module "foo" {
>"foo" : Symbol("foo", Decl(module_augmentUninstantiatedModule.ts, 0, 0))
namespace M {}
>M : Symbol("tests/cases/compiler/module_augmentUninstantiatedModule.ts", Decl(module_augmentUninstantiatedModule.ts, 0, 22), Decl(module_augmentUninstantiatedModule.ts, 2, 6), Decl(module_augmentUninstantiatedModule.ts, 6, 22))
>M : Symbol(M, Decl(module_augmentUninstantiatedModule.ts, 0, 22), Decl(module_augmentUninstantiatedModule.ts, 2, 6), Decl(module_augmentUninstantiatedModule.ts, 6, 22))
var M;
>M : Symbol("tests/cases/compiler/module_augmentUninstantiatedModule.ts", Decl(module_augmentUninstantiatedModule.ts, 0, 22), Decl(module_augmentUninstantiatedModule.ts, 2, 6), Decl(module_augmentUninstantiatedModule.ts, 6, 22))
>M : Symbol(M, Decl(module_augmentUninstantiatedModule.ts, 0, 22), Decl(module_augmentUninstantiatedModule.ts, 2, 6), Decl(module_augmentUninstantiatedModule.ts, 6, 22))
export = M;
>M : Symbol(M, Decl(module_augmentUninstantiatedModule.ts, 0, 22), Decl(module_augmentUninstantiatedModule.ts, 2, 6))
@@ -16,5 +16,5 @@ declare module "bar" {
>"bar" : Symbol("bar", Decl(module_augmentUninstantiatedModule.ts, 4, 1))
module "foo" {}
>"foo" : Symbol("tests/cases/compiler/module_augmentUninstantiatedModule.ts", Decl(module_augmentUninstantiatedModule.ts, 0, 22), Decl(module_augmentUninstantiatedModule.ts, 2, 6), Decl(module_augmentUninstantiatedModule.ts, 6, 22))
>"foo" : Symbol(M, Decl(module_augmentUninstantiatedModule.ts, 0, 22), Decl(module_augmentUninstantiatedModule.ts, 2, 6), Decl(module_augmentUninstantiatedModule.ts, 6, 22))
}
@@ -7,12 +7,12 @@ export type Action = "PUSH" | "POP" | "REPLACE";
=== /main.ts ===
interface SomeInterface {
>SomeInterface : Symbol("/other", Decl(other.d.ts, 0, 0), Decl(main.ts, 0, 0))
>SomeInterface : Symbol(SomeInterface, Decl(other.d.ts, 0, 0), Decl(main.ts, 0, 0))
readonly length: number;
>length : Symbol(length, Decl(main.ts, 0, 25))
}
declare const value: SomeInterface;
>value : Symbol(value, Decl(main.ts, 3, 13))
>SomeInterface : Symbol("/other", Decl(other.d.ts, 0, 0), Decl(main.ts, 0, 0))
>SomeInterface : Symbol(SomeInterface, Decl(other.d.ts, 0, 0), Decl(main.ts, 0, 0))
@@ -0,0 +1,19 @@
/tsconfig.json(3,9): error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
/tsconfig.json(4,9): error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
==== /tsconfig.json (2 errors) ====
{
"compilerOptions": {
"noEmit": true,
~~~~~~~~
!!! error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
"composite": true
~~~~~~~~~~~
!!! error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
}
}
==== /a.ts (0 errors) ====
const x = 10;
@@ -0,0 +1,4 @@
=== /a.ts ===
const x = 10;
>x : Symbol(x, Decl(a.ts, 0, 5))
@@ -0,0 +1,5 @@
=== /a.ts ===
const x = 10;
>x : 10
>10 : 10
@@ -0,0 +1,20 @@
/tsconfig.json(3,9): error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
/tsconfig.json(4,9): error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
==== /tsconfig.json (2 errors) ====
{
"compilerOptions": {
"noEmit": true,
~~~~~~~~
!!! error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
"incremental": true
~~~~~~~~~~~~~
!!! error TS5053: Option 'noEmit' cannot be specified with option 'incremental'.
}
}
==== /a.ts (0 errors) ====
const x = 10;
@@ -0,0 +1,4 @@
=== /a.ts ===
const x = 10;
>x : Symbol(x, Decl(a.ts, 0, 5))
@@ -0,0 +1,5 @@
=== /a.ts ===
const x = 10;
>x : 10
>10 : 10
@@ -2,48 +2,48 @@ tests/cases/compiler/numberVsBigIntOperations.ts(3,14): error TS2322: Type '2' i
tests/cases/compiler/numberVsBigIntOperations.ts(3,26): error TS2322: Type '1n' is not assignable to type 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(4,15): error TS2365: Operator '+=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(4,28): error TS2365: Operator '+=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(5,15): error TS2365: Operator '-=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(5,28): error TS2365: Operator '-=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(6,15): error TS2365: Operator '*=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(6,28): error TS2365: Operator '*=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(7,15): error TS2365: Operator '/=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(7,28): error TS2365: Operator '/=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(8,15): error TS2365: Operator '%=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(8,28): error TS2365: Operator '%=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(9,16): error TS2365: Operator '**=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(9,30): error TS2365: Operator '**=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(10,16): error TS2365: Operator '<<=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(10,30): error TS2365: Operator '<<=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(11,16): error TS2365: Operator '>>=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(11,30): error TS2365: Operator '>>=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(12,15): error TS2365: Operator '&=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(12,28): error TS2365: Operator '&=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(13,15): error TS2365: Operator '^=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(13,28): error TS2365: Operator '^=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(14,15): error TS2365: Operator '|=' cannot be applied to types 'bigint' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(14,28): error TS2365: Operator '|=' cannot be applied to types 'number' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(5,15): error TS2365: Operator '-=' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(5,28): error TS2365: Operator '-=' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(6,15): error TS2365: Operator '*=' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(6,28): error TS2365: Operator '*=' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(7,15): error TS2365: Operator '/=' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(7,28): error TS2365: Operator '/=' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(8,15): error TS2365: Operator '%=' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(8,28): error TS2365: Operator '%=' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(9,16): error TS2365: Operator '**=' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(9,30): error TS2365: Operator '**=' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(10,16): error TS2365: Operator '<<=' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(10,30): error TS2365: Operator '<<=' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(11,16): error TS2365: Operator '>>=' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(11,30): error TS2365: Operator '>>=' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(12,15): error TS2365: Operator '&=' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(12,28): error TS2365: Operator '&=' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(13,15): error TS2365: Operator '^=' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(13,28): error TS2365: Operator '^=' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(14,15): error TS2365: Operator '|=' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(14,28): error TS2365: Operator '|=' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(15,32): error TS2365: Operator '+' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(15,40): error TS2365: Operator '+' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(16,32): error TS2365: Operator '-' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(16,40): error TS2365: Operator '-' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(17,32): error TS2365: Operator '*' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(17,40): error TS2365: Operator '*' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(18,32): error TS2365: Operator '/' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(18,40): error TS2365: Operator '/' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(19,32): error TS2365: Operator '%' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(19,40): error TS2365: Operator '%' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(20,34): error TS2365: Operator '**' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(20,43): error TS2365: Operator '**' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(21,32): error TS2365: Operator '&' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(21,40): error TS2365: Operator '&' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(22,32): error TS2365: Operator '|' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(22,40): error TS2365: Operator '|' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(23,32): error TS2365: Operator '^' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(23,40): error TS2365: Operator '^' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(24,34): error TS2365: Operator '<<' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(24,43): error TS2365: Operator '<<' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(25,34): error TS2365: Operator '>>' cannot be applied to types '1' and '2n'.
tests/cases/compiler/numberVsBigIntOperations.ts(25,43): error TS2365: Operator '>>' cannot be applied to types '1n' and '2'.
tests/cases/compiler/numberVsBigIntOperations.ts(16,32): error TS2365: Operator '-' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(16,40): error TS2365: Operator '-' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(17,32): error TS2365: Operator '*' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(17,40): error TS2365: Operator '*' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(18,32): error TS2365: Operator '/' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(18,40): error TS2365: Operator '/' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(19,32): error TS2365: Operator '%' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(19,40): error TS2365: Operator '%' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(20,34): error TS2365: Operator '**' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(20,43): error TS2365: Operator '**' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(21,32): error TS2365: Operator '&' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(21,40): error TS2365: Operator '&' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(22,32): error TS2365: Operator '|' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(22,40): error TS2365: Operator '|' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(23,32): error TS2365: Operator '^' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(23,40): error TS2365: Operator '^' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(24,34): error TS2365: Operator '<<' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(24,43): error TS2365: Operator '<<' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(25,34): error TS2365: Operator '>>' cannot be applied to types 'number' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(25,43): error TS2365: Operator '>>' cannot be applied to types 'bigint' and 'number'.
tests/cases/compiler/numberVsBigIntOperations.ts(38,1): error TS2365: Operator '>>>=' cannot be applied to types 'bigint' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(39,10): error TS2365: Operator '>>>' cannot be applied to types 'bigint' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(40,8): error TS2736: Operator '+' cannot be applied to type 'bigint'.
@@ -54,8 +54,8 @@ tests/cases/compiler/numberVsBigIntOperations.ts(53,10): error TS2367: This cond
tests/cases/compiler/numberVsBigIntOperations.ts(56,7): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/compiler/numberVsBigIntOperations.ts(56,27): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/compiler/numberVsBigIntOperations.ts(57,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/compiler/numberVsBigIntOperations.ts(57,1): error TS2365: Operator '&' cannot be applied to types '"3"' and '5n'.
tests/cases/compiler/numberVsBigIntOperations.ts(57,11): error TS2365: Operator '**' cannot be applied to types '2n' and 'false'.
tests/cases/compiler/numberVsBigIntOperations.ts(57,1): error TS2365: Operator '&' cannot be applied to types 'string' and 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(57,11): error TS2365: Operator '**' cannot be applied to types 'bigint' and 'boolean'.
tests/cases/compiler/numberVsBigIntOperations.ts(57,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/compiler/numberVsBigIntOperations.ts(60,1): error TS2365: Operator '+' cannot be applied to types 'number | bigint' and 'number | bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(61,1): error TS2365: Operator '<<' cannot be applied to types 'number | bigint' and 'number | bigint'.
@@ -79,54 +79,54 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,7): error TS1155: 'const' de
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and '1n'.
bigInt -= 1n; bigInt -= 2; num -= 1n; num -= 2;
~~~~~~~~~~~
!!! error TS2365: Operator '-=' cannot be applied to types 'bigint' and '2'.
!!! error TS2365: Operator '-=' cannot be applied to types 'bigint' and 'number'.
~~~~~~~~~
!!! error TS2365: Operator '-=' cannot be applied to types 'number' and '1n'.
!!! error TS2365: Operator '-=' cannot be applied to types 'number' and 'bigint'.
bigInt *= 1n; bigInt *= 2; num *= 1n; num *= 2;
~~~~~~~~~~~
!!! error TS2365: Operator '*=' cannot be applied to types 'bigint' and '2'.
!!! error TS2365: Operator '*=' cannot be applied to types 'bigint' and 'number'.
~~~~~~~~~
!!! error TS2365: Operator '*=' cannot be applied to types 'number' and '1n'.
!!! error TS2365: Operator '*=' cannot be applied to types 'number' and 'bigint'.
bigInt /= 1n; bigInt /= 2; num /= 1n; num /= 2;
~~~~~~~~~~~
!!! error TS2365: Operator '/=' cannot be applied to types 'bigint' and '2'.
!!! error TS2365: Operator '/=' cannot be applied to types 'bigint' and 'number'.
~~~~~~~~~
!!! error TS2365: Operator '/=' cannot be applied to types 'number' and '1n'.
!!! error TS2365: Operator '/=' cannot be applied to types 'number' and 'bigint'.
bigInt %= 1n; bigInt %= 2; num %= 1n; num %= 2;
~~~~~~~~~~~
!!! error TS2365: Operator '%=' cannot be applied to types 'bigint' and '2'.
!!! error TS2365: Operator '%=' cannot be applied to types 'bigint' and 'number'.
~~~~~~~~~
!!! error TS2365: Operator '%=' cannot be applied to types 'number' and '1n'.
!!! error TS2365: Operator '%=' cannot be applied to types 'number' and 'bigint'.
bigInt **= 1n; bigInt **= 2; num **= 1n; num **= 2;
~~~~~~~~~~~~
!!! error TS2365: Operator '**=' cannot be applied to types 'bigint' and '2'.
!!! error TS2365: Operator '**=' cannot be applied to types 'bigint' and 'number'.
~~~~~~~~~~
!!! error TS2365: Operator '**=' cannot be applied to types 'number' and '1n'.
!!! error TS2365: Operator '**=' cannot be applied to types 'number' and 'bigint'.
bigInt <<= 1n; bigInt <<= 2; num <<= 1n; num <<= 2;
~~~~~~~~~~~~
!!! error TS2365: Operator '<<=' cannot be applied to types 'bigint' and '2'.
!!! error TS2365: Operator '<<=' cannot be applied to types 'bigint' and 'number'.
~~~~~~~~~~
!!! error TS2365: Operator '<<=' cannot be applied to types 'number' and '1n'.
!!! error TS2365: Operator '<<=' cannot be applied to types 'number' and 'bigint'.
bigInt >>= 1n; bigInt >>= 2; num >>= 1n; num >>= 2;
~~~~~~~~~~~~
!!! error TS2365: Operator '>>=' cannot be applied to types 'bigint' and '2'.
!!! error TS2365: Operator '>>=' cannot be applied to types 'bigint' and 'number'.
~~~~~~~~~~
!!! error TS2365: Operator '>>=' cannot be applied to types 'number' and '1n'.
!!! error TS2365: Operator '>>=' cannot be applied to types 'number' and 'bigint'.
bigInt &= 1n; bigInt &= 2; num &= 1n; num &= 2;
~~~~~~~~~~~
!!! error TS2365: Operator '&=' cannot be applied to types 'bigint' and '2'.
!!! error TS2365: Operator '&=' cannot be applied to types 'bigint' and 'number'.
~~~~~~~~~
!!! error TS2365: Operator '&=' cannot be applied to types 'number' and '1n'.
!!! error TS2365: Operator '&=' cannot be applied to types 'number' and 'bigint'.
bigInt ^= 1n; bigInt ^= 2; num ^= 1n; num ^= 2;
~~~~~~~~~~~
!!! error TS2365: Operator '^=' cannot be applied to types 'bigint' and '2'.
!!! error TS2365: Operator '^=' cannot be applied to types 'bigint' and 'number'.
~~~~~~~~~
!!! error TS2365: Operator '^=' cannot be applied to types 'number' and '1n'.
!!! error TS2365: Operator '^=' cannot be applied to types 'number' and 'bigint'.
bigInt |= 1n; bigInt |= 2; num |= 1n; num |= 2;
~~~~~~~~~~~
!!! error TS2365: Operator '|=' cannot be applied to types 'bigint' and '2'.
!!! error TS2365: Operator '|=' cannot be applied to types 'bigint' and 'number'.
~~~~~~~~~
!!! error TS2365: Operator '|=' cannot be applied to types 'number' and '1n'.
!!! error TS2365: Operator '|=' cannot be applied to types 'number' and 'bigint'.
bigInt = 1n + 2n; num = 1 + 2; 1 + 2n; 1n + 2;
~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types '1' and '2n'.
@@ -134,54 +134,54 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,7): error TS1155: 'const' de
!!! error TS2365: Operator '+' cannot be applied to types '1n' and '2'.
bigInt = 1n - 2n; num = 1 - 2; 1 - 2n; 1n - 2;
~~~~~~
!!! error TS2365: Operator '-' cannot be applied to types '1' and '2n'.
!!! error TS2365: Operator '-' cannot be applied to types 'number' and 'bigint'.
~~~~~~
!!! error TS2365: Operator '-' cannot be applied to types '1n' and '2'.
!!! error TS2365: Operator '-' cannot be applied to types 'bigint' and 'number'.
bigInt = 1n * 2n; num = 1 * 2; 1 * 2n; 1n * 2;
~~~~~~
!!! error TS2365: Operator '*' cannot be applied to types '1' and '2n'.
!!! error TS2365: Operator '*' cannot be applied to types 'number' and 'bigint'.
~~~~~~
!!! error TS2365: Operator '*' cannot be applied to types '1n' and '2'.
!!! error TS2365: Operator '*' cannot be applied to types 'bigint' and 'number'.
bigInt = 1n / 2n; num = 1 / 2; 1 / 2n; 1n / 2;
~~~~~~
!!! error TS2365: Operator '/' cannot be applied to types '1' and '2n'.
!!! error TS2365: Operator '/' cannot be applied to types 'number' and 'bigint'.
~~~~~~
!!! error TS2365: Operator '/' cannot be applied to types '1n' and '2'.
!!! error TS2365: Operator '/' cannot be applied to types 'bigint' and 'number'.
bigInt = 1n % 2n; num = 1 % 2; 1 % 2n; 1n % 2;
~~~~~~
!!! error TS2365: Operator '%' cannot be applied to types '1' and '2n'.
!!! error TS2365: Operator '%' cannot be applied to types 'number' and 'bigint'.
~~~~~~
!!! error TS2365: Operator '%' cannot be applied to types '1n' and '2'.
!!! error TS2365: Operator '%' cannot be applied to types 'bigint' and 'number'.
bigInt = 1n ** 2n; num = 1 ** 2; 1 ** 2n; 1n ** 2;
~~~~~~~
!!! error TS2365: Operator '**' cannot be applied to types '1' and '2n'.
!!! error TS2365: Operator '**' cannot be applied to types 'number' and 'bigint'.
~~~~~~~
!!! error TS2365: Operator '**' cannot be applied to types '1n' and '2'.
!!! error TS2365: Operator '**' cannot be applied to types 'bigint' and 'number'.
bigInt = 1n & 2n; num = 1 & 2; 1 & 2n; 1n & 2;
~~~~~~
!!! error TS2365: Operator '&' cannot be applied to types '1' and '2n'.
!!! error TS2365: Operator '&' cannot be applied to types 'number' and 'bigint'.
~~~~~~
!!! error TS2365: Operator '&' cannot be applied to types '1n' and '2'.
!!! error TS2365: Operator '&' cannot be applied to types 'bigint' and 'number'.
bigInt = 1n | 2n; num = 1 | 2; 1 | 2n; 1n | 2;
~~~~~~
!!! error TS2365: Operator '|' cannot be applied to types '1' and '2n'.
!!! error TS2365: Operator '|' cannot be applied to types 'number' and 'bigint'.
~~~~~~
!!! error TS2365: Operator '|' cannot be applied to types '1n' and '2'.
!!! error TS2365: Operator '|' cannot be applied to types 'bigint' and 'number'.
bigInt = 1n ^ 2n; num = 1 ^ 2; 1 ^ 2n; 1n ^ 2;
~~~~~~
!!! error TS2365: Operator '^' cannot be applied to types '1' and '2n'.
!!! error TS2365: Operator '^' cannot be applied to types 'number' and 'bigint'.
~~~~~~
!!! error TS2365: Operator '^' cannot be applied to types '1n' and '2'.
!!! error TS2365: Operator '^' cannot be applied to types 'bigint' and 'number'.
bigInt = 1n << 2n; num = 1 << 2; 1 << 2n; 1n << 2;
~~~~~~~
!!! error TS2365: Operator '<<' cannot be applied to types '1' and '2n'.
!!! error TS2365: Operator '<<' cannot be applied to types 'number' and 'bigint'.
~~~~~~~
!!! error TS2365: Operator '<<' cannot be applied to types '1n' and '2'.
!!! error TS2365: Operator '<<' cannot be applied to types 'bigint' and 'number'.
bigInt = 1n >> 2n; num = 1 >> 2; 1 >> 2n; 1n >> 2;
~~~~~~~
!!! error TS2365: Operator '>>' cannot be applied to types '1' and '2n'.
!!! error TS2365: Operator '>>' cannot be applied to types 'number' and 'bigint'.
~~~~~~~
!!! error TS2365: Operator '>>' cannot be applied to types '1n' and '2'.
!!! error TS2365: Operator '>>' cannot be applied to types 'bigint' and 'number'.
// Plus should still coerce to strings
let str: string;
@@ -235,9 +235,9 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,7): error TS1155: 'const' de
~~~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
~~~~~~~~
!!! error TS2365: Operator '&' cannot be applied to types '"3"' and '5n'.
!!! error TS2365: Operator '&' cannot be applied to types 'string' and 'bigint'.
~~~~~~~~~~~
!!! error TS2365: Operator '**' cannot be applied to types '2n' and 'false'.
!!! error TS2365: Operator '**' cannot be applied to types 'bigint' and 'boolean'.
~~~~~
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
num = ~"3"; num = -false; // should infer number
@@ -1,5 +1,5 @@
tests/cases/compiler/parseBigInt.ts(51,20): error TS2736: Operator '+' cannot be applied to type '123n'.
tests/cases/compiler/parseBigInt.ts(52,23): error TS2736: Operator '+' cannot be applied to type '291n'.
tests/cases/compiler/parseBigInt.ts(51,20): error TS2736: Operator '+' cannot be applied to type 'bigint'.
tests/cases/compiler/parseBigInt.ts(52,23): error TS2736: Operator '+' cannot be applied to type 'bigint'.
tests/cases/compiler/parseBigInt.ts(56,25): error TS1005: ',' expected.
tests/cases/compiler/parseBigInt.ts(57,22): error TS1352: A bigint literal cannot use exponential notation.
tests/cases/compiler/parseBigInt.ts(58,19): error TS1353: A bigint literal must be an integer.
@@ -70,10 +70,10 @@ tests/cases/compiler/parseBigInt.ts(70,72): error TS2345: Argument of type '3' i
// Plus not allowed on literals
const unaryPlus = +123n;
~~~~
!!! error TS2736: Operator '+' cannot be applied to type '123n'.
!!! error TS2736: Operator '+' cannot be applied to type 'bigint'.
const unaryPlusHex = +0x123n;
~~~~~~
!!! error TS2736: Operator '+' cannot be applied to type '291n'.
!!! error TS2736: Operator '+' cannot be applied to type 'bigint'.
// Parsing errors
// In separate blocks because they each declare an "n" variable
@@ -1,6 +1,6 @@
=== tests/cases/compiler/node_modules/react/index.d.ts ===
declare namespace React {
>React : Symbol("tests/cases/compiler/node_modules/react/index.d.ts", Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 0))
>React : Symbol(React, Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 0))
export interface DetailedHTMLProps<T, U> {}
>DetailedHTMLProps : Symbol(DetailedHTMLProps, Decl(index.d.ts, 0, 25))
@@ -20,7 +20,7 @@ export as namespace React;
=== tests/cases/compiler/node_modules/create-emotion-styled/types/react/index.d.ts ===
/// <reference types="react" />
declare module 'react' { // augment
>'react' : Symbol("tests/cases/compiler/node_modules/react/index.d.ts", Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 0))
>'react' : Symbol(React, Decl(index.d.ts, 0, 0), Decl(index.d.ts, 0, 0))
interface HTMLAttributes<T> {
>HTMLAttributes : Symbol(HTMLAttributes, Decl(index.d.ts, 1, 47), Decl(index.d.ts, 1, 24))
@@ -1,8 +1,8 @@
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(6,9): error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and '100'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(7,9): error TS2365: Operator '+' cannot be applied to types '100' and 'number | "ABC" | "XYZ"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(8,9): error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'number | "ABC" | "XYZ"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(9,9): error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'true'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(10,9): error TS2365: Operator '+' cannot be applied to types 'false' and 'number | "ABC" | "XYZ"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(6,9): error TS2365: Operator '+' cannot be applied to types 'string | number' and 'number'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(7,9): error TS2365: Operator '+' cannot be applied to types 'number' and 'string | number'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(8,9): error TS2365: Operator '+' cannot be applied to types 'string | number' and 'string | number'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(9,9): error TS2365: Operator '+' cannot be applied to types 'string | number' and 'boolean'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(10,9): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'string | number'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(11,9): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(12,11): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(13,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
@@ -19,19 +19,19 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato
let a = abcOrXyzOrNumber + 100;
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and '100'.
!!! error TS2365: Operator '+' cannot be applied to types 'string | number' and 'number'.
let b = 100 + abcOrXyzOrNumber;
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types '100' and 'number | "ABC" | "XYZ"'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'string | number'.
let c = abcOrXyzOrNumber + abcOrXyzOrNumber;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'number | "ABC" | "XYZ"'.
!!! error TS2365: Operator '+' cannot be applied to types 'string | number' and 'string | number'.
let d = abcOrXyzOrNumber + true;
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'true'.
!!! error TS2365: Operator '+' cannot be applied to types 'string | number' and 'boolean'.
let e = false + abcOrXyzOrNumber;
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'false' and 'number | "ABC" | "XYZ"'.
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'string | number'.
let f = abcOrXyzOrNumber++;
~~~~~~~~~~~~~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
@@ -1,5 +1,5 @@
tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(3,9): error TS2367: This condition will always return 'false' since the types '"foo"' and '"baz"' have no overlap.
tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(5,9): error TS2367: This condition will always return 'false' since the types '"foo"' and 'number' have no overlap.
tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(5,9): error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(5,19): error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
@@ -12,7 +12,7 @@ tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparis
var b = "foo" !== ("bar" as "foo");
var c = "foo" == (<number>"bar");
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types '"foo"' and 'number' have no overlap.
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
~~~~~~~~~~~~~
!!! error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
var d = "foo" === ("bar" as EnhancedString);
@@ -8,7 +8,7 @@ tests/cases/conformance/es6/Symbols/symbolType12.ts(7,1): error TS2362: The left
tests/cases/conformance/es6/Symbols/symbolType12.ts(7,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/es6/Symbols/symbolType12.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/es6/Symbols/symbolType12.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'.
tests/cases/conformance/es6/Symbols/symbolType12.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and '0'.
tests/cases/conformance/es6/Symbols/symbolType12.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'.
tests/cases/conformance/es6/Symbols/symbolType12.ts(11,1): error TS2469: The '+=' operator cannot be applied to type 'symbol'.
tests/cases/conformance/es6/Symbols/symbolType12.ts(12,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'.
tests/cases/conformance/es6/Symbols/symbolType12.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
@@ -67,7 +67,7 @@ tests/cases/conformance/es6/Symbols/symbolType12.ts(28,8): error TS2469: The '+=
!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'.
s += 0;
~~~~~~
!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and '0'.
!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'.
s += "";
~
!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'.
@@ -3,10 +3,10 @@ tests/cases/conformance/es6/Symbols/symbolType6.ts(4,1): error TS2362: The left-
tests/cases/conformance/es6/Symbols/symbolType6.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/es6/Symbols/symbolType6.ts(5,1): error TS2469: The '+' operator cannot be applied to type 'symbol'.
tests/cases/conformance/es6/Symbols/symbolType6.ts(6,1): error TS2469: The '+' operator cannot be applied to type 'symbol'.
tests/cases/conformance/es6/Symbols/symbolType6.ts(7,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and '0'.
tests/cases/conformance/es6/Symbols/symbolType6.ts(7,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'.
tests/cases/conformance/es6/Symbols/symbolType6.ts(8,6): error TS2469: The '+' operator cannot be applied to type 'symbol'.
tests/cases/conformance/es6/Symbols/symbolType6.ts(9,5): error TS2469: The '+' operator cannot be applied to type 'symbol'.
tests/cases/conformance/es6/Symbols/symbolType6.ts(10,1): error TS2365: Operator '+' cannot be applied to types '0' and 'symbol'.
tests/cases/conformance/es6/Symbols/symbolType6.ts(10,1): error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'.
tests/cases/conformance/es6/Symbols/symbolType6.ts(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/es6/Symbols/symbolType6.ts(12,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/es6/Symbols/symbolType6.ts(14,1): error TS2469: The '+' operator cannot be applied to type 'symbol'.
@@ -32,7 +32,7 @@ tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+'
!!! error TS2469: The '+' operator cannot be applied to type 'symbol'.
s + 0;
~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and '0'.
!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'.
"" + s;
~
!!! error TS2469: The '+' operator cannot be applied to type 'symbol'.
@@ -41,7 +41,7 @@ tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+'
!!! error TS2469: The '+' operator cannot be applied to type 'symbol'.
0 + s;
~~~~~
!!! error TS2365: Operator '+' cannot be applied to types '0' and 'symbol'.
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'.
s - 0;
~
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
@@ -1,7 +1,7 @@
tests/cases/conformance/es6/Symbols/symbolType9.ts(3,1): error TS2367: This condition will always return 'false' since the types 'symbol' and 'true' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(5,1): error TS2367: This condition will always return 'true' since the types '0' and 'symbol' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(7,1): error TS2367: This condition will always return 'false' since the types 'symbol' and '1' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2367: This condition will always return 'true' since the types 'false' and 'symbol' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(3,1): error TS2367: This condition will always return 'false' since the types 'symbol' and 'boolean' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(5,1): error TS2367: This condition will always return 'true' since the types 'number' and 'symbol' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(7,1): error TS2367: This condition will always return 'false' since the types 'symbol' and 'number' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2367: This condition will always return 'true' since the types 'boolean' and 'symbol' have no overlap.
==== tests/cases/conformance/es6/Symbols/symbolType9.ts (4 errors) ====
@@ -9,16 +9,16 @@ tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2367: This cond
s == s;
s == true;
~~~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'symbol' and 'true' have no overlap.
!!! error TS2367: This condition will always return 'false' since the types 'symbol' and 'boolean' have no overlap.
s != s;
0 != s;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types '0' and 'symbol' have no overlap.
!!! error TS2367: This condition will always return 'true' since the types 'number' and 'symbol' have no overlap.
s === s;
s === 1;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'symbol' and '1' have no overlap.
!!! error TS2367: This condition will always return 'false' since the types 'symbol' and 'number' have no overlap.
s !== s;
false !== s;
~~~~~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'false' and 'symbol' have no overlap.
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'symbol' have no overlap.
@@ -31,8 +31,8 @@ export declare const lazyBar: LazyAction<() => void, typeof import("./lazyIndex"
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../bar.ts": {
"version": "747071916",
@@ -69,8 +69,8 @@ exports.bar = bar_1.default;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../bar.ts": {
"version": "5936740878",
@@ -22,8 +22,8 @@ type A = HKT<number>[typeof sym];
"program": {
"fileInfos": {
"../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./src/globals.d.ts": {
"version": "-1994196675",
@@ -15,8 +15,8 @@ var x = 10;
"program": {
"fileInfos": {
"../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./src/globals.d.ts": {
"version": "-1994196675",
@@ -172,8 +172,8 @@ export class someClass { }
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -212,8 +212,8 @@ export class someClass { }
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-2069755619",
@@ -262,8 +262,8 @@ export class someClass { }
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-2069755619",
@@ -21,8 +21,8 @@ export declare function multiply(a: number, b: number): number;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -37,8 +37,8 @@ exports.m = mod;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -25,8 +25,8 @@ export declare const m: typeof mod;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -76,8 +76,8 @@ export declare const m: typeof mod;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -31,8 +31,8 @@ define(["require", "exports"], function (require, exports) {
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -33,8 +33,8 @@ exports.multiply = multiply;
"signature": "8926001564"
},
"../../lib/lib.esnext.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -25,8 +25,8 @@ class someClass { }
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -185,8 +185,8 @@ exports.multiply = multiply;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -370,8 +370,8 @@ sourceFile:index.ts
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -436,8 +436,8 @@ exports.m = mod;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -27,8 +27,8 @@ exports.multiply = multiply;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -35,8 +35,8 @@ exports.multiply = multiply;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -96,8 +96,8 @@ exports.m = mod;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -178,8 +178,8 @@ exports.m = mod;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -185,8 +185,8 @@ exports.multiply = multiply;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -370,8 +370,8 @@ sourceFile:index.ts
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -436,8 +436,8 @@ exports.m = mod;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -185,8 +185,8 @@ exports.multiply = multiply;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -370,8 +370,8 @@ sourceFile:index.ts
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -453,8 +453,8 @@ exports.m = mod;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../core/index.ts": {
"version": "-13851440507",
@@ -27,8 +27,8 @@ exports.multiply = multiply;
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"./anothermodule.ts": {
"version": "-2676574883",
@@ -13,7 +13,7 @@ interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> {}
interface Array<T> { length: number; [n: number]: T; }
interface ReadonlyArray<T> {}
declare const console: { log(msg: any): void; };
@@ -46,8 +46,8 @@ export function multiply(a, b) { return a * b; }
"program": {
"fileInfos": {
"../../lib/lib.esnext.d.ts": {
"version": "-15964756381",
"signature": "-15964756381"
"version": "3858781397",
"signature": "3858781397"
},
"../../lib/lib.esnext.full.d.ts": {
"version": "8926001564",
@@ -44,7 +44,7 @@ export = M2D;
>M2D : Symbol(M2D, Decl(index.d.ts, 2, 13))
declare namespace M2D {
>M2D : Symbol("tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts", Decl(index.d.ts, 2, 13), Decl(math2d-augment.d.ts, 0, 33))
>M2D : Symbol(M2D, Decl(index.d.ts, 2, 13), Decl(math2d-augment.d.ts, 0, 33))
interface Point {
>Point : Symbol(Point, Decl(index.d.ts, 4, 23))
@@ -42,7 +42,7 @@ export = M2D;
>M2D : Symbol(M2D, Decl(index.d.ts, 2, 13))
declare namespace M2D {
>M2D : Symbol("tests/cases/conformance/externalModules/node_modules/math2d/index.d.ts", Decl(index.d.ts, 2, 13), Decl(math2d-augment.d.ts, 0, 33))
>M2D : Symbol(M2D, Decl(index.d.ts, 2, 13), Decl(math2d-augment.d.ts, 0, 33))
interface Point {
>Point : Symbol(Point, Decl(index.d.ts, 4, 23))
@@ -3,7 +3,7 @@ declare global {
>global : Symbol(global, Decl(global.d.ts, 0, 0))
const React: typeof import("./module");
>React : Symbol("tests/cases/compiler/module", Decl(module.d.ts, 0, 0), Decl(global.d.ts, 1, 9))
>React : Symbol(React, Decl(module.d.ts, 0, 0), Decl(global.d.ts, 1, 9))
}
export {};
@@ -18,7 +18,7 @@ export function foo(): string;
export {}
React.foo;
>React.foo : Symbol(foo, Decl(module.d.ts, 0, 26))
>React : Symbol("tests/cases/compiler/module", Decl(module.d.ts, 0, 0), Decl(global.d.ts, 1, 9))
>React : Symbol(React, Decl(module.d.ts, 0, 0), Decl(global.d.ts, 1, 9))
>foo : Symbol(foo, Decl(module.d.ts, 0, 26))
=== tests/cases/compiler/emits.ts ===
@@ -29,6 +29,6 @@ console.log("hello");
React.foo;
>React.foo : Symbol(foo, Decl(module.d.ts, 0, 26))
>React : Symbol("tests/cases/compiler/module", Decl(module.d.ts, 0, 0), Decl(global.d.ts, 1, 9))
>React : Symbol(React, Decl(module.d.ts, 0, 0), Decl(global.d.ts, 1, 9))
>foo : Symbol(foo, Decl(module.d.ts, 0, 26))
+17 -12
View File
@@ -4,18 +4,23 @@ node_modules/graceful-fs/clone.js(12,9): error TS2403: Subsequent variable decla
node_modules/graceful-fs/clone.js(15,38): error TS2345: Argument of type 'PropertyDescriptor | undefined' is not assignable to parameter of type 'PropertyDescriptor & ThisType<any>'.
Type 'undefined' is not assignable to type 'PropertyDescriptor & ThisType<any>'.
Type 'undefined' is not assignable to type 'PropertyDescriptor'.
node_modules/graceful-fs/graceful-fs.js(14,3): error TS2322: Type '(msg: string, ...param: any[]) => void' is not assignable to type '() => void'.
node_modules/graceful-fs/graceful-fs.js(17,37): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any, ...any[]]'.
node_modules/graceful-fs/graceful-fs.js(24,11): error TS2554: Expected 0 arguments, but got 1.
node_modules/graceful-fs/graceful-fs.js(30,54): error TS2339: Property '__patched' does not exist on type 'typeof import("fs")'.
node_modules/graceful-fs/graceful-fs.js(32,8): error TS2339: Property '__patched' does not exist on type 'typeof import("fs")'.
node_modules/graceful-fs/graceful-fs.js(52,37): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[number]'.
node_modules/graceful-fs/graceful-fs.js(174,5): error TS2539: Cannot assign to 'ReadStream' because it is not a variable.
node_modules/graceful-fs/graceful-fs.js(175,5): error TS2539: Cannot assign to 'WriteStream' because it is not a variable.
node_modules/graceful-fs/graceful-fs.js(197,68): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, any?, ...any[]]'.
node_modules/graceful-fs/graceful-fs.js(220,70): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, any?, ...any[]]'.
node_modules/graceful-fs/graceful-fs.js(269,9): error TS2554: Expected 0 arguments, but got 3.
node_modules/graceful-fs/graceful-fs.js(276,11): error TS2554: Expected 0 arguments, but got 3.
node_modules/graceful-fs/graceful-fs.js(26,3): error TS2322: Type '(msg: string, ...param: any[]) => void' is not assignable to type '() => void'.
node_modules/graceful-fs/graceful-fs.js(29,37): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any, ...any[]]'.
node_modules/graceful-fs/graceful-fs.js(48,3): error TS2741: Property '__promisify__' is missing in type '(fd: any, cb: any) => void' but required in type 'typeof close'.
node_modules/graceful-fs/graceful-fs.js(70,30): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[number]'.
node_modules/graceful-fs/graceful-fs.js(82,13): error TS2554: Expected 0 arguments, but got 1.
node_modules/graceful-fs/graceful-fs.js(89,54): error TS2339: Property '__patched' does not exist on type 'typeof import("fs")'.
node_modules/graceful-fs/graceful-fs.js(91,8): error TS2339: Property '__patched' does not exist on type 'typeof import("fs")'.
node_modules/graceful-fs/graceful-fs.js(199,5): error TS2539: Cannot assign to 'ReadStream' because it is not a variable.
node_modules/graceful-fs/graceful-fs.js(200,5): error TS2539: Cannot assign to 'WriteStream' because it is not a variable.
node_modules/graceful-fs/graceful-fs.js(220,7): error TS2539: Cannot assign to 'ReadStream' because it is not a variable.
node_modules/graceful-fs/graceful-fs.js(230,7): error TS2539: Cannot assign to 'WriteStream' because it is not a variable.
node_modules/graceful-fs/graceful-fs.js(242,7): error TS2539: Cannot assign to 'ReadStream' because it is not a variable.
node_modules/graceful-fs/graceful-fs.js(252,7): error TS2539: Cannot assign to 'WriteStream' because it is not a variable.
node_modules/graceful-fs/graceful-fs.js(262,68): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, any?, ...any[]]'.
node_modules/graceful-fs/graceful-fs.js(285,70): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, any?, ...any[]]'.
node_modules/graceful-fs/graceful-fs.js(334,9): error TS2554: Expected 0 arguments, but got 3.
node_modules/graceful-fs/graceful-fs.js(341,11): error TS2554: Expected 0 arguments, but got 3.
@@ -0,0 +1,8 @@
// @noEmit: true
// @noTypesAndSymbols: true
// @lib: es6
const a = class Cat {
declare [Symbol.toStringTag] = "uh";
export foo = 1;
}
@@ -0,0 +1,10 @@
// @Filename: /a.ts
const x = 10;
// @Filename: /tsconfig.json
{
"compilerOptions": {
"noEmit": true,
"composite": true
}
}
@@ -0,0 +1,11 @@
// @Filename: /a.ts
const x = 10;
// @Filename: /tsconfig.json
{
"compilerOptions": {
"noEmit": true,
"incremental": true
}
}
@@ -0,0 +1,31 @@
/// <reference path="fourslash.ts" />
// @module: es6
// @Filename: /console.d.ts
////interface Console {}
////declare var console: Console;
////declare module "console" {
//// export = console;
////}
// @Filename: /react-native.d.ts
//// import 'console';
////declare global {
//// interface Console {}
//// var console: Console;
////}
// @Filename: /a.ts
////conso/**/
verify.completions({
exact: completion.globalsPlus([{
hasAction: undefined, // asserts that it does *not* have an action
name: "console"
}]),
preferences: {
includeCompletionsForModuleExports: true,
includeInsertTextCompletions: true
}
});
@@ -39,7 +39,5 @@
////}
const [r0Def, r0, r1Def, r1, r2Def, ...rest] = test.ranges();
// GH#29533
// TODO:: this should be var THREE: typeof import instead of module name as var but thats existing issue and repros with quickInfo too.
verify.singleReferenceGroup(`module "/node_modules/@types/three/index"
var "/node_modules/@types/three/index": typeof import("/node_modules/@types/three/index")`, [r0, r1, ...rest]);
verify.singleReferenceGroup(`module THREE
var THREE: typeof import("/node_modules/@types/three/index")`, [r0, r1, ...rest]);
@@ -0,0 +1,16 @@
/// <reference path="fourslash.ts" />
// @Filename: /node_modules/@types/three/index.d.ts
////export class Vector3 {}
////export as namespace THREE;
// @Filename: /global.d.ts
////import * as _THREE from 'three';
////
////declare global {
//// const THREE: typeof _THREE;
////}
// @Filename: /index.ts
////let v = new /*1*/THREE.Vector3();
verify.quickInfoAt("1", `module THREE
var THREE: typeof import("/node_modules/@types/three/index")`);
+4
View File
@@ -0,0 +1,4 @@
export type Size = "small" | "medium" | "large";
export default interface Animal {
size: Size;
}
+18
View File
@@ -0,0 +1,18 @@
import Animal from '.';
import { makeRandomName } from '../core/utilities';
export interface Dog extends Animal {
woof(): void;
name: string;
}
export function createDog(): Dog {
return ({
size: "medium",
woof: function(this: Dog) {
console.log(`${this.name} says "Woof"!`);
},
name: makeRandomName()
});
}
+5
View File
@@ -0,0 +1,5 @@
import Animal from './animal';
export default Animal;
import { createDog, Dog } from './dog';
export { createDog, Dog };
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"outDir": "../lib/animals",
"rootDir": ".",
},
"references": [
{ "path": "../core" }
]
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"outDir": "../lib/core",
"rootDir": "."
}
}
+10
View File
@@ -0,0 +1,10 @@
export function makeRandomName() {
return "Bob!?! ";
}
export function lastElementOf<T>(arr: T[]): T | undefined {
if (arr.length === 0) return undefined;
return arr[arr.length - 1];
}
+13
View File
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"declaration": true,
"target": "es5",
"module": "commonjs",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"composite": true
}
}
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff. Show more