Merge remote-tracking branch 'origin/master' into release-4.3

This commit is contained in:
Daniel Rosenwasser
2021-03-31 16:04:47 -07:00
105 changed files with 854 additions and 461 deletions
+6 -6
View File
@@ -288,9 +288,9 @@
}
},
"@octokit/core": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.3.1.tgz",
"integrity": "sha512-Dc5NNQOYjgZU5S1goN6A/E500yXOfDUFRGQB8/2Tl16AcfvS3H9PudyOe3ZNE/MaVyHPIfC0htReHMJb1tMrvw==",
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.3.2.tgz",
"integrity": "sha512-Jx83n4tuX/z7QtxnPsAKxXPzH3vANtKmlCB3W3vt18JbkEaBYm+C8dgAlA1FNtqNk3L21pxsKNbWkUQAhiV7ng==",
"dev": true,
"requires": {
"@octokit/auth-token": "^2.4.4",
@@ -7940,9 +7940,9 @@
"dev": true
},
"uglify-js": {
"version": "3.13.2",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.2.tgz",
"integrity": "sha512-SbMu4D2Vo95LMC/MetNaso1194M1htEA+JrqE9Hk+G2DhI+itfS9TRu9ZKeCahLDNa/J3n4MqUJ/fOHMzQpRWw==",
"version": "3.13.3",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.3.tgz",
"integrity": "sha512-otIc7O9LyxpUcQoXzj2hL4LPWKklO6LJWoJUzNa8A17Xgi4fOeDC8FBDOLHnC/Slo1CQgsZMcM6as0M76BZaig==",
"dev": true,
"optional": true
},
+10 -18
View File
@@ -18274,6 +18274,11 @@ namespace ts {
}
}
else if (target.flags & TypeFlags.TemplateLiteral) {
if (source.flags & TypeFlags.TemplateLiteral) {
// Report unreliable variance for type variables referenced in template literal type placeholders.
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
}
const result = inferTypesFromTemplateLiteralType(source, target as TemplateLiteralType);
if (result && every(result, (r, i) => isValidTypeForTemplateLiteralPlaceholder(r, (target as TemplateLiteralType).types[i]))) {
return Ternary.True;
@@ -18318,20 +18323,6 @@ namespace ts {
return result;
}
}
else if (source.flags & TypeFlags.TemplateLiteral) {
if (target.flags & TypeFlags.TemplateLiteral &&
(source as TemplateLiteralType).texts.length === (target as TemplateLiteralType).texts.length &&
(source as TemplateLiteralType).types.length === (target as TemplateLiteralType).types.length &&
every((source as TemplateLiteralType).texts, (t, i) => t === (target as TemplateLiteralType).texts[i]) &&
every((instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers)) as TemplateLiteralType).types, (t, i) => !!((target as TemplateLiteralType).types[i].flags & (TypeFlags.Any | TypeFlags.String)) || !!isRelatedTo(t, (target as TemplateLiteralType).types[i], /*reportErrors*/ false))) {
return Ternary.True;
}
const constraint = getBaseConstraintOfType(source);
if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, reportErrors))) {
resetErrorInfo(saveErrorInfo);
return result;
}
}
else if (source.flags & TypeFlags.StringMapping) {
if (target.flags & TypeFlags.StringMapping && (<StringMappingType>source).symbol === (<StringMappingType>target).symbol) {
if (result = isRelatedTo((<StringMappingType>source).type, (<StringMappingType>target).type, reportErrors)) {
@@ -27125,7 +27116,7 @@ namespace ts {
if (isInPropertyInitializer(node)
&& !(isAccessExpression(node) && isAccessExpression(node.expression))
&& !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)
&& !isPropertyDeclaredInAncestorClass(prop)) {
&& (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) {
diagnosticMessage = error(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
}
else if (valueDeclaration.kind === SyntaxKind.ClassDeclaration &&
@@ -35254,8 +35245,8 @@ namespace ts {
errorAndMaybeSuggestAwait(
condExpr,
/*maybeMissingAwait*/ true,
Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap,
"true", getTypeNameForErrorDisplay(type), "false");
Diagnostics.This_condition_will_always_return_true_since_this_0_appears_to_always_be_defined,
getTypeNameForErrorDisplay(type));
return;
}
@@ -35288,7 +35279,7 @@ namespace ts {
const isUsed = isBinaryExpression(condExpr.parent) && isFunctionUsedInBinaryExpressionChain(condExpr.parent, testedSymbol)
|| body && isFunctionUsedInConditionBody(condExpr, body, testedNode, testedSymbol);
if (!isUsed) {
error(location, Diagnostics.This_condition_will_always_return_true_since_the_function_is_always_defined_Did_you_mean_to_call_it_instead);
error(location, Diagnostics.This_condition_will_always_return_true_since_this_function_appears_to_always_be_defined_Did_you_mean_to_call_it_instead);
}
}
@@ -36572,6 +36563,7 @@ namespace ts {
switch (name.escapedText) {
case "any":
case "unknown":
case "never":
case "number":
case "bigint":
case "boolean":
+7 -3
View File
@@ -15,7 +15,7 @@
"category": "Error",
"code": 1006
},
"The parser expected to find a '}' to match the '{' token here.": {
"The parser expected to find a '{1}' to match the '{0}' token here.": {
"category": "Error",
"code": 1007
},
@@ -3168,7 +3168,7 @@
"category": "Error",
"code": 2773
},
"This condition will always return true since the function is always defined. Did you mean to call it instead?": {
"This condition will always return true since this function appears to always be defined. Did you mean to call it instead?": {
"category": "Error",
"code": 2774
},
@@ -3276,7 +3276,7 @@
"category": "Error",
"code": 2800
},
"This condition will always return true since the Promise is always truthy.": {
"This condition will always return true since this '{0}' appears to always be defined.": {
"category": "Error",
"code": 2801
},
@@ -3308,6 +3308,10 @@
"category": "Error",
"code": 2808
},
"Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.": {
"category": "Error",
"code": 2809
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
+45 -38
View File
@@ -1335,24 +1335,27 @@ namespace ts {
return inContext(NodeFlags.AwaitContext);
}
function parseErrorAtCurrentToken(message: DiagnosticMessage, arg0?: any): void {
parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
function parseErrorAtCurrentToken(message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined {
return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
}
function parseErrorAtPosition(start: number, length: number, message: DiagnosticMessage, arg0?: any): void {
function parseErrorAtPosition(start: number, length: number, message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined {
// Don't report another error if it would just be at the same position as the last error.
const lastError = lastOrUndefined(parseDiagnostics);
let result: DiagnosticWithDetachedLocation | undefined;
if (!lastError || start !== lastError.start) {
parseDiagnostics.push(createDetachedDiagnostic(fileName, start, length, message, arg0));
result = createDetachedDiagnostic(fileName, start, length, message, arg0);
parseDiagnostics.push(result);
}
// Mark that we've encountered an error. We'll set an appropriate bit on the next
// node we finish so that it can't be reused incrementally.
parseErrorBeforeNextFinishedNode = true;
return result;
}
function parseErrorAt(start: number, end: number, message: DiagnosticMessage, arg0?: any): void {
parseErrorAtPosition(start, end - start, message, arg0);
function parseErrorAt(start: number, end: number, message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined {
return parseErrorAtPosition(start, end - start, message, arg0);
}
function parseErrorAtRange(range: TextRange, message: DiagnosticMessage, arg0?: any): void {
@@ -1542,6 +1545,20 @@ namespace ts {
return false;
}
function parseExpectedMatchingBrackets(openKind: SyntaxKind, closeKind: SyntaxKind, openPosition: number) {
if (token() === closeKind) {
nextToken();
return;
}
const lastError = parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(closeKind));
if (lastError) {
addRelatedInfo(
lastError,
createDetachedDiagnostic(fileName, openPosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, tokenToString(openKind), tokenToString(closeKind))
);
}
}
function parseOptional(t: SyntaxKind): boolean {
if (token() === t) {
nextToken();
@@ -2092,8 +2109,7 @@ namespace ts {
while (!isListTerminator(kind)) {
if (isListElement(kind, /*inErrorRecovery*/ false)) {
const element = parseListElement(kind, parseElement);
list.push(element);
list.push(parseListElement(kind, parseElement));
continue;
}
@@ -5426,10 +5442,11 @@ namespace ts {
function parseArrayLiteralExpression(): ArrayLiteralExpression {
const pos = getNodePos();
const openBracketPosition = scanner.getTokenPos();
parseExpected(SyntaxKind.OpenBracketToken);
const multiLine = scanner.hasPrecedingLineBreak();
const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement);
parseExpected(SyntaxKind.CloseBracketToken);
parseExpectedMatchingBrackets(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, openBracketPosition);
return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
}
@@ -5498,15 +5515,7 @@ namespace ts {
parseExpected(SyntaxKind.OpenBraceToken);
const multiLine = scanner.hasPrecedingLineBreak();
const properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true);
if (!parseExpected(SyntaxKind.CloseBraceToken)) {
const lastError = lastOrUndefined(parseDiagnostics);
if (lastError && lastError.code === Diagnostics._0_expected.code) {
addRelatedInfo(
lastError,
createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)
);
}
}
parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBracePosition);
return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
}
@@ -5591,16 +5600,14 @@ namespace ts {
if (parseExpected(SyntaxKind.OpenBraceToken, diagnosticMessage) || ignoreMissingOpenBrace) {
const multiLine = scanner.hasPrecedingLineBreak();
const statements = parseList(ParsingContext.BlockStatements, parseStatement);
if (!parseExpected(SyntaxKind.CloseBraceToken)) {
const lastError = lastOrUndefined(parseDiagnostics);
if (lastError && lastError.code === Diagnostics._0_expected.code) {
addRelatedInfo(
lastError,
createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)
);
}
parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBracePosition);
const result = finishNode(factory.createBlock(statements, multiLine), pos);
if (token() === SyntaxKind.EqualsToken) {
parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
nextToken();
}
return finishNode(factory.createBlock(statements, multiLine), pos);
return result;
}
else {
const statements = createMissingList<Statement>();
@@ -5647,9 +5654,10 @@ namespace ts {
function parseIfStatement(): IfStatement {
const pos = getNodePos();
parseExpected(SyntaxKind.IfKeyword);
const openParenPosition = scanner.getTokenPos();
parseExpected(SyntaxKind.OpenParenToken);
const expression = allowInAnd(parseExpression);
parseExpected(SyntaxKind.CloseParenToken);
parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition);
const thenStatement = parseStatement();
const elseStatement = parseOptional(SyntaxKind.ElseKeyword) ? parseStatement() : undefined;
return finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos);
@@ -5660,9 +5668,10 @@ namespace ts {
parseExpected(SyntaxKind.DoKeyword);
const statement = parseStatement();
parseExpected(SyntaxKind.WhileKeyword);
const openParenPosition = scanner.getTokenPos();
parseExpected(SyntaxKind.OpenParenToken);
const expression = allowInAnd(parseExpression);
parseExpected(SyntaxKind.CloseParenToken);
parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition);
// From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html
// 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in
@@ -5675,9 +5684,10 @@ namespace ts {
function parseWhileStatement(): WhileStatement {
const pos = getNodePos();
parseExpected(SyntaxKind.WhileKeyword);
const openParenPosition = scanner.getTokenPos();
parseExpected(SyntaxKind.OpenParenToken);
const expression = allowInAnd(parseExpression);
parseExpected(SyntaxKind.CloseParenToken);
parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition);
const statement = parseStatement();
return finishNode(factory.createWhileStatement(expression, statement), pos);
}
@@ -5749,9 +5759,10 @@ namespace ts {
function parseWithStatement(): WithStatement {
const pos = getNodePos();
parseExpected(SyntaxKind.WithKeyword);
const openParenPosition = scanner.getTokenPos();
parseExpected(SyntaxKind.OpenParenToken);
const expression = allowInAnd(parseExpression);
parseExpected(SyntaxKind.CloseParenToken);
parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition);
const statement = doInsideOfContext(NodeFlags.InWithStatement, parseStatement);
return finishNode(factory.createWithStatement(expression, statement), pos);
}
@@ -7973,13 +7984,9 @@ namespace ts {
hasChildren = true;
if (child.kind === SyntaxKind.JSDocTypeTag) {
if (childTypeTag) {
parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
const lastError = lastOrUndefined(parseDiagnostics);
const lastError = parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
if (lastError) {
addRelatedInfo(
lastError,
createDetachedDiagnostic(fileName, 0, 0, Diagnostics.The_tag_was_first_specified_here)
);
addRelatedInfo(lastError, createDetachedDiagnostic(fileName, 0, 0, Diagnostics.The_tag_was_first_specified_here));
}
break;
}
@@ -8011,7 +8018,7 @@ namespace ts {
}
const typedefTag = factory.createJSDocTypedefTag(tagName, typeExpression, fullName, comment);
return finishNode(typedefTag, start);
return finishNode(typedefTag, start, end);
}
function parseJSDocTypeNameWithNamespace(nested?: boolean) {
+4
View File
@@ -1717,7 +1717,11 @@ namespace ts {
continue;
}
const outputs = getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames());
if (!outputs.length) continue;
const inputFileNames = new Set(parsed.fileNames.map(f => toPath(state, f)));
for (const output of outputs) {
// If output name is same as input file name, do not delete and ignore the error
if (inputFileNames.has(toPath(state, output))) continue;
if (host.fileExists(output)) {
if (filesToDelete) {
filesToDelete.push(output);
-2
View File
@@ -135,8 +135,6 @@ namespace compiler {
}
}
}
this.diagnostics = diagnostics;
}
public get vfs(): vfs.FileSystem {
+2 -2
View File
@@ -1073,7 +1073,7 @@ interface ReadonlyArray<T> {
*/
toString(): string;
/**
* Returns a string representation of an array. The elements are converted to string using their toLocalString methods.
* Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.
*/
toLocaleString(): string;
/**
@@ -1207,7 +1207,7 @@ interface Array<T> {
*/
toString(): string;
/**
* Returns a string representation of an array. The elements are converted to string using their toLocalString methods.
* Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.
*/
toLocaleString(): string;
/**
@@ -14,6 +14,7 @@ namespace ts.codefix {
Diagnostics.Operator_0_cannot_be_applied_to_type_1.code,
Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code,
Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code,
Diagnostics.This_condition_will_always_return_true_since_this_0_appears_to_always_be_defined.code,
Diagnostics.Type_0_is_not_an_array_type.code,
Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code,
Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators.code,
+19 -9
View File
@@ -436,7 +436,9 @@ namespace ts.codefix {
/**
* Convert `import x = require("x").`
* Also converts uses like `x.y()` to `y()` and uses a named import.
* Also:
* - Convert `x.default()` to `x()` to handle ES6 default export
* - Converts uses like `x.y()` to `y()` and uses a named import.
*/
function convertSingleIdentifierImport(name: Identifier, moduleSpecifier: StringLiteralLike, checker: TypeChecker, identifiers: Identifiers, quotePreference: QuotePreference): ConvertedImports {
const nameSymbol = checker.getSymbolAtLocation(name);
@@ -454,15 +456,23 @@ namespace ts.codefix {
const { parent } = use;
if (isPropertyAccessExpression(parent)) {
const { expression, name: { text: propertyName } } = parent;
Debug.assert(expression === use, "Didn't expect expression === use"); // Else shouldn't have been in `collectIdentifiers`
let idName = namedBindingsNames.get(propertyName);
if (idName === undefined) {
idName = makeUniqueName(propertyName, identifiers);
namedBindingsNames.set(propertyName, idName);
}
const { name: { text: propertyName } } = parent;
if (propertyName === "default") {
needDefaultImport = true;
(useSitesToUnqualify ??= new Map()).set(parent, factory.createIdentifier(idName));
const importDefaultName = use.getText();
(useSitesToUnqualify ??= new Map()).set(parent, factory.createIdentifier(importDefaultName));
}
else {
Debug.assert(parent.expression === use, "Didn't expect expression === use"); // Else shouldn't have been in `collectIdentifiers`
let idName = namedBindingsNames.get(propertyName);
if (idName === undefined) {
idName = makeUniqueName(propertyName, identifiers);
namedBindingsNames.set(propertyName, idName);
}
(useSitesToUnqualify ??= new Map()).set(parent, factory.createIdentifier(idName));
}
}
else {
needDefaultImport = true;
@@ -2,7 +2,7 @@
namespace ts.codefix {
const fixId = "fixMissingCallParentheses";
const errorCodes = [
Diagnostics.This_condition_will_always_return_true_since_the_function_is_always_defined_Did_you_mean_to_call_it_instead.code,
Diagnostics.This_condition_will_always_return_true_since_this_function_appears_to_always_be_defined_Did_you_mean_to_call_it_instead.code,
];
registerCodeFix({
+4 -2
View File
@@ -2516,8 +2516,10 @@ namespace ts {
}
/* @internal */
export function needsParentheses(expression: Expression) {
return isBinaryExpression(expression) && expression.operatorToken.kind === SyntaxKind.CommaToken || isObjectLiteralExpression(expression);
export function needsParentheses(expression: Expression): boolean {
return isBinaryExpression(expression) && expression.operatorToken.kind === SyntaxKind.CommaToken
|| isObjectLiteralExpression(expression)
|| isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
}
export function getContextualTypeFromParent(node: Expression, checker: TypeChecker): Type | undefined {
+1
View File
@@ -113,6 +113,7 @@
"unittests/services/textChanges.ts",
"unittests/services/transpile.ts",
"unittests/tsbuild/amdModulesWithOut.ts",
"unittests/tsbuild/clean.ts",
"unittests/tsbuild/configFileErrors.ts",
"unittests/tsbuild/configFileExtends.ts",
"unittests/tsbuild/containerOnlyReferenced.ts",
+16
View File
@@ -0,0 +1,16 @@
namespace ts {
describe("unittests:: tsbuild - clean", () => {
verifyTsc({
scenario: "clean",
subScenario: `file name and output name clashing`,
commandLineArgs: ["--b", "/src/tsconfig.json", "-clean"],
fs: () => loadProjectFromFiles({
"/src/index.js": "",
"/src/bar.ts": "",
"/src/tsconfig.json": JSON.stringify({
compilerOptions: { allowJs: true },
}),
}),
});
});
}
@@ -13,14 +13,15 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(2
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(30,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(31,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(32,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS1128: Declaration or statement expected.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,2): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,6): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(42,36): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(44,19): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(46,27): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(50,20): error TS1128: Declaration or statement expected.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,11): error TS1005: ';' expected.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(50,20): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,11): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,13): error TS1005: ';' expected.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(54,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(57,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(58,2): error TS2631: Cannot assign to 'M' because it is a namespace.
@@ -38,7 +39,7 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(6
tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(70,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (38 errors) ====
==== tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts (39 errors) ====
// expected error for all the LHS of assignments
var value: any;
@@ -105,7 +106,7 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7
// object literals
{ a: 0} = value;
~
!!! error TS1128: Declaration or statement expected.
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
// array literals
['', ''] = value;
@@ -132,9 +133,11 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7
// function expression
function bar() { } = value;
~
!!! error TS1128: Declaration or statement expected.
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
() => { } = value;
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
~~~~~
!!! error TS1005: ';' expected.
// function calls
@@ -146,7 +146,7 @@ function bar() { } = value;
>value : any
() => { } = value;
>() => { } : () => void
>() => { } = : () => void
>value : any
// function calls
@@ -223,7 +223,7 @@
],
"documentation": [
{
"text": "Returns a string representation of an array. The elements are converted to string using their toLocalString methods.",
"text": "Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.",
"kind": "text"
}
]
@@ -121,6 +121,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
if (retValue != 0 ^= {
~~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts:22:20: The parser expected to find a ')' to match the '(' token here.
~
@@ -0,0 +1,27 @@
tests/cases/compiler/destructionAssignmentError.ts(6,3): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/compiler/destructionAssignmentError.ts(6,10): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/compiler/destructionAssignmentError.ts(11,3): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/compiler/destructionAssignmentError.ts(12,1): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
==== tests/cases/compiler/destructionAssignmentError.ts (4 errors) ====
declare function fn(): { a: 1, b: 2 }
let a: number;
let b: number;
({ a, b } = fn());
{ a, b } = fn();
~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
({ a, b } =
fn());
{ a, b }
~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
= fn();
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
@@ -0,0 +1,28 @@
//// [destructionAssignmentError.ts]
declare function fn(): { a: 1, b: 2 }
let a: number;
let b: number;
({ a, b } = fn());
{ a, b } = fn();
({ a, b } =
fn());
{ a, b }
= fn();
//// [destructionAssignmentError.js]
var _a, _b;
var a;
var b;
(_a = fn(), a = _a.a, b = _a.b);
{
a, b;
}
fn();
(_b = fn(), a = _b.a, b = _b.b);
{
a, b;
}
fn();
@@ -0,0 +1,36 @@
=== tests/cases/compiler/destructionAssignmentError.ts ===
declare function fn(): { a: 1, b: 2 }
>fn : Symbol(fn, Decl(destructionAssignmentError.ts, 0, 0))
>a : Symbol(a, Decl(destructionAssignmentError.ts, 0, 24))
>b : Symbol(b, Decl(destructionAssignmentError.ts, 0, 30))
let a: number;
>a : Symbol(a, Decl(destructionAssignmentError.ts, 1, 3))
let b: number;
>b : Symbol(b, Decl(destructionAssignmentError.ts, 2, 3))
({ a, b } = fn());
>a : Symbol(a, Decl(destructionAssignmentError.ts, 4, 2))
>b : Symbol(b, Decl(destructionAssignmentError.ts, 4, 5))
>fn : Symbol(fn, Decl(destructionAssignmentError.ts, 0, 0))
{ a, b } = fn();
>a : Symbol(a, Decl(destructionAssignmentError.ts, 1, 3))
>b : Symbol(b, Decl(destructionAssignmentError.ts, 2, 3))
>fn : Symbol(fn, Decl(destructionAssignmentError.ts, 0, 0))
({ a, b } =
>a : Symbol(a, Decl(destructionAssignmentError.ts, 7, 2))
>b : Symbol(b, Decl(destructionAssignmentError.ts, 7, 5))
fn());
>fn : Symbol(fn, Decl(destructionAssignmentError.ts, 0, 0))
{ a, b }
>a : Symbol(a, Decl(destructionAssignmentError.ts, 1, 3))
>b : Symbol(b, Decl(destructionAssignmentError.ts, 2, 3))
= fn();
>fn : Symbol(fn, Decl(destructionAssignmentError.ts, 0, 0))
@@ -0,0 +1,48 @@
=== tests/cases/compiler/destructionAssignmentError.ts ===
declare function fn(): { a: 1, b: 2 }
>fn : () => { a: 1; b: 2;}
>a : 1
>b : 2
let a: number;
>a : number
let b: number;
>b : number
({ a, b } = fn());
>({ a, b } = fn()) : { a: 1; b: 2; }
>{ a, b } = fn() : { a: 1; b: 2; }
>{ a, b } : { a: number; b: number; }
>a : number
>b : number
>fn() : { a: 1; b: 2; }
>fn : () => { a: 1; b: 2; }
{ a, b } = fn();
>a, b : number
>a : number
>b : number
>fn() : { a: 1; b: 2; }
>fn : () => { a: 1; b: 2; }
({ a, b } =
>({ a, b } =fn()) : { a: 1; b: 2; }
>{ a, b } =fn() : { a: 1; b: 2; }
>{ a, b } : { a: number; b: number; }
>a : number
>b : number
fn());
>fn() : { a: 1; b: 2; }
>fn : () => { a: 1; b: 2; }
{ a, b }
>a, b : number
>a : number
>b : number
= fn();
>fn() : { a: 1; b: 2; }
>fn : () => { a: 1; b: 2; }
@@ -16,5 +16,4 @@ tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts(9,2): err
}
!!! error TS1005: '}' expected.
!!! related TS1007 tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts:3:19: The parser expected to find a '}' to match the '{' token here.
!!! related TS1007 tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts:2:20: The parser expected to find a '}' to match the '{' token here.
!!! related TS1007 tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts:3:19: The parser expected to find a '}' to match the '{' token here.
@@ -4,9 +4,11 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefine
tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(4,11): error TS2427: Interface name cannot be 'boolean'.
tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,1): error TS2304: Cannot find name 'interface'.
tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,11): error TS1005: ';' expected.
tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(6,11): error TS2427: Interface name cannot be 'unknown'.
tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(7,11): error TS2427: Interface name cannot be 'never'.
==== tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts (6 errors) ====
==== tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts (8 errors) ====
interface any { }
~~~
!!! error TS2427: Interface name cannot be 'any'.
@@ -23,4 +25,10 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefine
~~~~~~~~~
!!! error TS2304: Cannot find name 'interface'.
~~~~
!!! error TS1005: ';' expected.
!!! error TS1005: ';' expected.
interface unknown {}
~~~~~~~
!!! error TS2427: Interface name cannot be 'unknown'.
interface never {}
~~~~~
!!! error TS2427: Interface name cannot be 'never'.
@@ -3,7 +3,9 @@ interface any { }
interface number { }
interface string { }
interface boolean { }
interface void {}
interface void {}
interface unknown {}
interface never {}
//// [interfacesWithPredefinedTypesAsNames.js]
interface;
@@ -12,3 +12,9 @@ interface boolean { }
>boolean : Symbol(boolean, Decl(interfacesWithPredefinedTypesAsNames.ts, 2, 20))
interface void {}
interface unknown {}
>unknown : Symbol(unknown, Decl(interfacesWithPredefinedTypesAsNames.ts, 4, 17))
interface never {}
>never : Symbol(never, Decl(interfacesWithPredefinedTypesAsNames.ts, 5, 20))
@@ -8,3 +8,5 @@ interface void {}
>void {} : undefined
>{} : {}
interface unknown {}
interface never {}
@@ -18,7 +18,7 @@ tests/cases/conformance/jsdoc/declarations/file.js(6,5): error TS4084: Exported
==== tests/cases/conformance/jsdoc/declarations/file.js (3 errors) ====
/** @typedef {import('./base')} BaseFactory */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4084: Exported type alias 'BaseFactory' has or is using private name 'Base' from module "tests/cases/conformance/jsdoc/declarations/base".
/**
* @callback BaseFactoryFactory
@@ -0,0 +1,9 @@
[
{
"marker": {
"fileName": "/tests/cases/fourslash/jsDocSignature-43394.ts",
"position": 58,
"name": ""
}
}
]
@@ -0,0 +1,8 @@
tests/cases/compiler/missingCloseBracketInArray.ts(1,48): error TS1005: ']' expected.
==== tests/cases/compiler/missingCloseBracketInArray.ts (1 errors) ====
var alphas:string[] = alphas = ["1","2","3","4"
!!! error TS1005: ']' expected.
!!! related TS1007 tests/cases/compiler/missingCloseBracketInArray.ts:1:32: The parser expected to find a ']' to match the '[' token here.
@@ -0,0 +1,5 @@
//// [missingCloseBracketInArray.ts]
var alphas:string[] = alphas = ["1","2","3","4"
//// [missingCloseBracketInArray.js]
var alphas = alphas = ["1", "2", "3", "4"];
@@ -0,0 +1,5 @@
=== tests/cases/compiler/missingCloseBracketInArray.ts ===
var alphas:string[] = alphas = ["1","2","3","4"
>alphas : Symbol(alphas, Decl(missingCloseBracketInArray.ts, 0, 3))
>alphas : Symbol(alphas, Decl(missingCloseBracketInArray.ts, 0, 3))
@@ -0,0 +1,11 @@
=== tests/cases/compiler/missingCloseBracketInArray.ts ===
var alphas:string[] = alphas = ["1","2","3","4"
>alphas : string[]
>alphas = ["1","2","3","4" : string[]
>alphas : string[]
>["1","2","3","4" : string[]
>"1" : "1"
>"2" : "2"
>"3" : "3"
>"4" : "4"
@@ -0,0 +1,32 @@
tests/cases/compiler/missingCloseParenStatements.ts(2,26): error TS1005: ')' expected.
tests/cases/compiler/missingCloseParenStatements.ts(4,5): error TS1005: ')' expected.
tests/cases/compiler/missingCloseParenStatements.ts(8,39): error TS1005: ')' expected.
tests/cases/compiler/missingCloseParenStatements.ts(11,35): error TS1005: ')' expected.
==== tests/cases/compiler/missingCloseParenStatements.ts (4 errors) ====
var a1, a2, a3 = 0;
if ( a1 && (a2 + a3 > 0) {
~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:2:4: The parser expected to find a ')' to match the '(' token here.
while( (a2 > 0) && a1
{
~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:3:10: The parser expected to find a ')' to match the '(' token here.
do {
var i = i + 1;
a1 = a1 + i;
with ((a2 + a3 > 0) && a1 {
~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:8:18: The parser expected to find a ')' to match the '(' token here.
console.log(x);
}
} while (i < 5 && (a1 > 5);
~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:11:17: The parser expected to find a ')' to match the '(' token here.
}
}
@@ -0,0 +1,28 @@
//// [missingCloseParenStatements.ts]
var a1, a2, a3 = 0;
if ( a1 && (a2 + a3 > 0) {
while( (a2 > 0) && a1
{
do {
var i = i + 1;
a1 = a1 + i;
with ((a2 + a3 > 0) && a1 {
console.log(x);
}
} while (i < 5 && (a1 > 5);
}
}
//// [missingCloseParenStatements.js]
var a1, a2, a3 = 0;
if (a1 && (a2 + a3 > 0)) {
while ((a2 > 0) && a1) {
do {
var i = i + 1;
a1 = a1 + i;
with ((a2 + a3 > 0) && a1) {
console.log(x);
}
} while (i < 5 && (a1 > 5));
}
}
@@ -0,0 +1,37 @@
=== tests/cases/compiler/missingCloseParenStatements.ts ===
var a1, a2, a3 = 0;
>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3))
>a2 : Symbol(a2, Decl(missingCloseParenStatements.ts, 0, 7))
>a3 : Symbol(a3, Decl(missingCloseParenStatements.ts, 0, 11))
if ( a1 && (a2 + a3 > 0) {
>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3))
>a2 : Symbol(a2, Decl(missingCloseParenStatements.ts, 0, 7))
>a3 : Symbol(a3, Decl(missingCloseParenStatements.ts, 0, 11))
while( (a2 > 0) && a1
>a2 : Symbol(a2, Decl(missingCloseParenStatements.ts, 0, 7))
>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3))
{
do {
var i = i + 1;
>i : Symbol(i, Decl(missingCloseParenStatements.ts, 5, 15))
>i : Symbol(i, Decl(missingCloseParenStatements.ts, 5, 15))
a1 = a1 + i;
>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3))
>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3))
>i : Symbol(i, Decl(missingCloseParenStatements.ts, 5, 15))
with ((a2 + a3 > 0) && a1 {
>a2 : Symbol(a2, Decl(missingCloseParenStatements.ts, 0, 7))
>a3 : Symbol(a3, Decl(missingCloseParenStatements.ts, 0, 11))
>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3))
console.log(x);
}
} while (i < 5 && (a1 > 5);
>i : Symbol(i, Decl(missingCloseParenStatements.ts, 5, 15))
>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3))
}
}
@@ -0,0 +1,67 @@
=== tests/cases/compiler/missingCloseParenStatements.ts ===
var a1, a2, a3 = 0;
>a1 : any
>a2 : any
>a3 : number
>0 : 0
if ( a1 && (a2 + a3 > 0) {
>a1 && (a2 + a3 > 0) : boolean
>a1 : any
>(a2 + a3 > 0) : boolean
>a2 + a3 > 0 : boolean
>a2 + a3 : any
>a2 : any
>a3 : number
>0 : 0
while( (a2 > 0) && a1
>(a2 > 0) && a1 : any
>(a2 > 0) : boolean
>a2 > 0 : boolean
>a2 : any
>0 : 0
>a1 : any
{
do {
var i = i + 1;
>i : any
>i + 1 : any
>i : any
>1 : 1
a1 = a1 + i;
>a1 = a1 + i : any
>a1 : any
>a1 + i : any
>a1 : any
>i : any
with ((a2 + a3 > 0) && a1 {
>(a2 + a3 > 0) && a1 : any
>(a2 + a3 > 0) : boolean
>a2 + a3 > 0 : boolean
>a2 + a3 : any
>a2 : any
>a3 : number
>0 : 0
>a1 : any
console.log(x);
>console.log(x) : any
>console.log : any
>console : any
>log : any
>x : any
}
} while (i < 5 && (a1 > 5);
>i < 5 && (a1 > 5) : boolean
>i < 5 : boolean
>i : any
>5 : 5
>(a1 > 5) : boolean
>a1 > 5 : boolean
>a1 : any
>5 : 5
}
}
@@ -32,7 +32,6 @@ tests/cases/conformance/classes/nestedClassDeclaration.ts(17,1): error TS1128: D
!!! error TS2304: Cannot find name 'C4'.
~
!!! error TS1005: ',' expected.
!!! related TS1007 tests/cases/conformance/classes/nestedClassDeclaration.ts:14:9: The parser expected to find a '}' to match the '{' token here.
}
}
~
@@ -9,5 +9,4 @@ tests/cases/compiler/objectLiteralWithSemicolons4.ts(3,1): error TS1005: ',' exp
!!! error TS18004: No value exists in scope for the shorthand property 'a'. Either declare one or provide an initializer.
;
~
!!! error TS1005: ',' expected.
!!! related TS1007 tests/cases/compiler/objectLiteralWithSemicolons4.ts:1:9: The parser expected to find a '}' to match the '{' token here.
!!! error TS1005: ',' expected.
@@ -28,7 +28,6 @@ tests/cases/conformance/types/spread/objectSpreadNegativeParse.ts(4,20): error T
!!! error TS2304: Cannot find name 'matchMedia'.
~
!!! error TS1005: ',' expected.
!!! related TS1007 tests/cases/conformance/types/spread/objectSpreadNegativeParse.ts:3:10: The parser expected to find a '}' to match the '{' token here.
~
!!! error TS1128: Declaration or statement expected.
let o10 = { ...get x() { return 12; }};
@@ -25,7 +25,6 @@ tests/cases/compiler/parseErrorIncorrectReturnToken.ts(12,1): error TS1128: Decl
m(n: number) => string {
~~
!!! error TS1005: '{' expected.
!!! related TS1007 tests/cases/compiler/parseErrorIncorrectReturnToken.ts:8:9: The parser expected to find a '}' to match the '{' token here.
~~~~~~
!!! error TS2693: 'string' only refers to a type, but is being used as a value here.
~
@@ -11,6 +11,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErro
}
~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement2.ts:3:8: The parser expected to find a ')' to match the '(' token here.
f2() {
}
f3() {
@@ -11,6 +11,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErro
}
~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement3.ts:3:8: The parser expected to find a ')' to match the '(' token here.
f2() {
}
f3() {
@@ -20,5 +20,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(2,15): e
~~~~~~
!!! error TS1005: ';' expected.
!!! error TS1005: '{' expected.
!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts:1:9: The parser expected to find a '}' to match the '{' token here.
!!! error TS1005: '{' expected.
@@ -0,0 +1,21 @@
tests/cases/conformance/classes/propertyMemberDeclarations/redeclaredProperty.ts(7,12): error TS2729: Property 'b' is used before its initialization.
==== tests/cases/conformance/classes/propertyMemberDeclarations/redeclaredProperty.ts (1 errors) ====
class Base {
b = 1;
}
class Derived extends Base {
b;
d = this.b;
~
!!! error TS2729: Property 'b' is used before its initialization.
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/redeclaredProperty.ts:6:3: 'b' is declared here.
constructor() {
super();
this.b = 2;
}
}
@@ -0,0 +1,28 @@
//// [redeclaredProperty.ts]
class Base {
b = 1;
}
class Derived extends Base {
b;
d = this.b;
constructor() {
super();
this.b = 2;
}
}
//// [redeclaredProperty.js]
class Base {
b = 1;
}
class Derived extends Base {
b;
d = this.b;
constructor() {
super();
this.b = 2;
}
}
@@ -0,0 +1,19 @@
tests/cases/conformance/classes/propertyMemberDeclarations/redefinedPararameterProperty.ts(6,14): error TS2729: Property 'a' is used before its initialization.
==== tests/cases/conformance/classes/propertyMemberDeclarations/redefinedPararameterProperty.ts (1 errors) ====
class Base {
a = 1;
}
class Derived extends Base {
b = this.a /*undefined*/;
~
!!! error TS2729: Property 'a' is used before its initialization.
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/redefinedPararameterProperty.ts:8:17: 'a' is declared here.
constructor(public a: number) {
super();
}
}
@@ -0,0 +1,26 @@
//// [redefinedPararameterProperty.ts]
class Base {
a = 1;
}
class Derived extends Base {
b = this.a /*undefined*/;
constructor(public a: number) {
super();
}
}
//// [redefinedPararameterProperty.js]
class Base {
a = 1;
}
class Derived extends Base {
a;
b = this.a /*undefined*/;
constructor(a) {
super();
this.a = a;
}
}
@@ -0,0 +1,3 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/redefinedPararameterProperty.ts ===
No type information for this code.
@@ -0,0 +1,3 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/redefinedPararameterProperty.ts ===
No type information for this code.
@@ -45,6 +45,7 @@ tests/cases/compiler/reservedWords2.ts(12,17): error TS1138: Parameter declarati
!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/compiler/reservedWords2.ts:1:14: The parser expected to find a ')' to match the '(' token here.
import * as while from "foo"
!!! error TS2300: Duplicate identifier '(Missing)'.
@@ -58,6 +59,7 @@ tests/cases/compiler/reservedWords2.ts(12,17): error TS1138: Parameter declarati
!!! error TS2304: Cannot find name 'from'.
~~~~~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/compiler/reservedWords2.ts:2:20: The parser expected to find a ')' to match the '(' token here.
var typeof = 10;
~~~~~~
@@ -1,13 +1,9 @@
tests/cases/conformance/types/literal/templateLiteralTypes2.ts(23,11): error TS2322: Type 'string' is not assignable to type '`abc${string}`'.
tests/cases/conformance/types/literal/templateLiteralTypes2.ts(29,11): error TS2322: Type 'string' is not assignable to type '`foo${string}` | `bar${string}`'.
tests/cases/conformance/types/literal/templateLiteralTypes2.ts(32,11): error TS2322: Type 'string' is not assignable to type '`foo${string}` | `bar${string}` | `baz${string}`'.
tests/cases/conformance/types/literal/templateLiteralTypes2.ts(67,9): error TS2322: Type '`foo${number}`' is not assignable to type 'String'.
tests/cases/conformance/types/literal/templateLiteralTypes2.ts(68,9): error TS2322: Type '`foo${number}`' is not assignable to type 'Object'.
tests/cases/conformance/types/literal/templateLiteralTypes2.ts(69,9): error TS2322: Type '`foo${number}`' is not assignable to type '{}'.
tests/cases/conformance/types/literal/templateLiteralTypes2.ts(70,9): error TS2322: Type '`foo${number}`' is not assignable to type '{ length: number; }'.
==== tests/cases/conformance/types/literal/templateLiteralTypes2.ts (7 errors) ====
==== tests/cases/conformance/types/literal/templateLiteralTypes2.ts (3 errors) ====
function ft1<T extends string>(s: string, n: number, u: 'foo' | 'bar' | 'baz', t: T) {
const c1 = `abc${s}`; // `abc${string}`
const c2 = `abc${n}`; // `abc${number}`
@@ -81,17 +77,9 @@ tests/cases/conformance/types/literal/templateLiteralTypes2.ts(70,9): error TS23
function ft14(t: `foo${number}`) {
let x1: string = t;
let x2: String = t;
~~
!!! error TS2322: Type '`foo${number}`' is not assignable to type 'String'.
let x3: Object = t;
~~
!!! error TS2322: Type '`foo${number}`' is not assignable to type 'Object'.
let x4: {} = t;
~~
!!! error TS2322: Type '`foo${number}`' is not assignable to type '{}'.
let x6: { length: number } = t;
~~
!!! error TS2322: Type '`foo${number}`' is not assignable to type '{ length: number; }'.
}
declare function g1<T>(x: T): T;
@@ -134,4 +122,10 @@ tests/cases/conformance/types/literal/templateLiteralTypes2.ts(70,9): error TS23
function getCardTitle(title: string): `test-${string}` {
return `test-${title}`;
}
// Repro from #43424
const interpolatedStyle = { rotate: 12 };
function C2(transform: "-moz-initial" | (string & {})) { return 12; }
C2(`rotate(${interpolatedStyle.rotate}dig)`);
@@ -111,6 +111,12 @@ const pixelStringWithTemplate: PixelValueType = `${pixelValue}px`;
function getCardTitle(title: string): `test-${string}` {
return `test-${title}`;
}
// Repro from #43424
const interpolatedStyle = { rotate: 12 };
function C2(transform: "-moz-initial" | (string & {})) { return 12; }
C2(`rotate(${interpolatedStyle.rotate}dig)`);
//// [templateLiteralTypes2.js]
@@ -194,6 +200,10 @@ var pixelStringWithTemplate = pixelValue + "px";
function getCardTitle(title) {
return "test-" + title;
}
// Repro from #43424
var interpolatedStyle = { rotate: 12 };
function C2(transform) { return 12; }
C2("rotate(" + interpolatedStyle.rotate + "dig)");
//// [templateLiteralTypes2.d.ts]
@@ -225,3 +235,7 @@ declare type PixelValueType = `${number}px`;
declare const pixelString: PixelValueType;
declare const pixelStringWithTemplate: PixelValueType;
declare function getCardTitle(title: string): `test-${string}`;
declare const interpolatedStyle: {
rotate: number;
};
declare function C2(transform: "-moz-initial" | (string & {})): number;
@@ -361,3 +361,19 @@ function getCardTitle(title: string): `test-${string}` {
>title : Symbol(title, Decl(templateLiteralTypes2.ts, 109, 22))
}
// Repro from #43424
const interpolatedStyle = { rotate: 12 };
>interpolatedStyle : Symbol(interpolatedStyle, Decl(templateLiteralTypes2.ts, 115, 5))
>rotate : Symbol(rotate, Decl(templateLiteralTypes2.ts, 115, 27))
function C2(transform: "-moz-initial" | (string & {})) { return 12; }
>C2 : Symbol(C2, Decl(templateLiteralTypes2.ts, 115, 41))
>transform : Symbol(transform, Decl(templateLiteralTypes2.ts, 116, 12))
C2(`rotate(${interpolatedStyle.rotate}dig)`);
>C2 : Symbol(C2, Decl(templateLiteralTypes2.ts, 115, 41))
>interpolatedStyle.rotate : Symbol(rotate, Decl(templateLiteralTypes2.ts, 115, 27))
>interpolatedStyle : Symbol(interpolatedStyle, Decl(templateLiteralTypes2.ts, 115, 5))
>rotate : Symbol(rotate, Decl(templateLiteralTypes2.ts, 115, 27))
@@ -392,3 +392,24 @@ function getCardTitle(title: string): `test-${string}` {
>title : string
}
// Repro from #43424
const interpolatedStyle = { rotate: 12 };
>interpolatedStyle : { rotate: number; }
>{ rotate: 12 } : { rotate: number; }
>rotate : number
>12 : 12
function C2(transform: "-moz-initial" | (string & {})) { return 12; }
>C2 : (transform: "-moz-initial" | (string & {})) => number
>transform : (string & {}) | "-moz-initial"
>12 : 12
C2(`rotate(${interpolatedStyle.rotate}dig)`);
>C2(`rotate(${interpolatedStyle.rotate}dig)`) : number
>C2 : (transform: (string & {}) | "-moz-initial") => number
>`rotate(${interpolatedStyle.rotate}dig)` : `rotate(${number}dig)`
>interpolatedStyle.rotate : number
>interpolatedStyle : { rotate: number; }
>rotate : number
@@ -1,17 +1,17 @@
tests/cases/compiler/truthinessCallExpressionCoercion.ts(2,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(18,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(36,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(50,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(66,13): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(76,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(82,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(2,9): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(18,9): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(36,9): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(50,9): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(66,13): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(76,9): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion.ts(82,9): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
==== tests/cases/compiler/truthinessCallExpressionCoercion.ts (7 errors) ====
function onlyErrorsWhenTestingNonNullableFunctionType(required: () => boolean, optional?: () => boolean) {
if (required) { // error
~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
}
if (optional) { // ok
@@ -29,7 +29,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion.ts(82,9): error TS2774: Th
if (test) { // error
~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
console.log('test');
}
@@ -49,7 +49,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion.ts(82,9): error TS2774: Th
if (test) { // error
~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
[() => null].forEach(test => {
test();
});
@@ -65,7 +65,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion.ts(82,9): error TS2774: Th
if (x.foo.bar) { // error
~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
}
if (x.foo.bar) { // ok
@@ -83,7 +83,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion.ts(82,9): error TS2774: Th
test() {
if (this.isUser) { // error
~~~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
}
if (this.maybeIsUser) { // ok
@@ -95,7 +95,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion.ts(82,9): error TS2774: Th
function A(stats: StatsBase<any>) {
if (stats.isDirectory) { // err
~~~~~~~~~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
console.log(`[Directory] ${stats.ctime}`)
}
}
@@ -103,7 +103,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion.ts(82,9): error TS2774: Th
function B(a: Nested, b: Nested) {
if (a.stats.isDirectory) { // err
~~~~~~~~~~~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
b.stats.isDirectory();
}
if (a.stats.isDirectory) { // ok
@@ -1,8 +1,8 @@
tests/cases/compiler/truthinessCallExpressionCoercion1.ts(3,5): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion1.ts(19,5): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion1.ts(33,5): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion1.ts(46,5): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion1.ts(76,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion1.ts(3,5): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion1.ts(19,5): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion1.ts(33,5): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion1.ts(46,5): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion1.ts(76,9): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
==== tests/cases/compiler/truthinessCallExpressionCoercion1.ts (5 errors) ====
@@ -10,7 +10,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion1.ts(76,9): error TS2774: T
// error
required ? console.log('required') : undefined;
~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// ok
optional ? console.log('optional') : undefined;
@@ -28,7 +28,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion1.ts(76,9): error TS2774: T
// error
test ? console.log('test') : undefined;
~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// ok
test ? console.log(test) : undefined;
@@ -44,7 +44,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion1.ts(76,9): error TS2774: T
// error
test
~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
? [() => null].forEach(test => { test() })
: undefined;
}
@@ -59,7 +59,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion1.ts(76,9): error TS2774: T
// error
x.foo.bar ? console.log('x.foo.bar') : undefined;
~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// ok
x.foo.bar ? x.foo.bar : undefined;
@@ -91,7 +91,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion1.ts(76,9): error TS2774: T
// error
this.isUser ? console.log('this.isUser') : undefined;
~~~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// ok
this.maybeIsUser ? console.log('this.maybeIsUser') : undefined;
@@ -1,14 +1,14 @@
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(11,5): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(14,10): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(41,18): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(44,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(48,11): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(65,46): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(76,5): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(79,10): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(99,5): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(109,9): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(112,14): error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(11,5): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(14,10): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(41,18): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(44,9): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(48,11): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(65,46): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(76,5): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(79,10): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(99,5): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(109,9): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
tests/cases/compiler/truthinessCallExpressionCoercion2.ts(112,14): error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
==== tests/cases/compiler/truthinessCallExpressionCoercion2.ts (11 errors) ====
@@ -24,12 +24,12 @@ tests/cases/compiler/truthinessCallExpressionCoercion2.ts(112,14): error TS2774:
// error
required1 && console.log('required');
~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// error
1 && required1 && console.log('required');
~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// ok
required1 && required1();
@@ -58,18 +58,18 @@ tests/cases/compiler/truthinessCallExpressionCoercion2.ts(112,14): error TS2774:
// error
required1 && required2 && required1() && console.log('foo');
~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// error
if (required1 && b) {
~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
}
// error
if (((required1 && b))) {
~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
}
// ok
@@ -88,7 +88,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion2.ts(112,14): error TS2774:
typeof window !== 'undefined' && window.console &&
((window.console as any).firebug || (window.console.exception && window.console.table));
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
}
function checksPropertyAccess() {
@@ -101,12 +101,12 @@ tests/cases/compiler/truthinessCallExpressionCoercion2.ts(112,14): error TS2774:
// error
x.foo.bar && console.log('x.foo.bar');
~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// error
1 && x.foo.bar && console.log('x.foo.bar');
~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// ok
x.foo.bar && x.foo.bar();
@@ -128,7 +128,7 @@ tests/cases/compiler/truthinessCallExpressionCoercion2.ts(112,14): error TS2774:
// error
x1.a.b.c && x2.a.b.c();
~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
}
class Foo {
@@ -140,12 +140,12 @@ tests/cases/compiler/truthinessCallExpressionCoercion2.ts(112,14): error TS2774:
// error
this.required && console.log('required');
~~~~~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// error
1 && this.required && console.log('required');
~~~~~~~~~~~~~
!!! error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
!!! error TS2774: This condition will always return true since this function appears to always be defined. Did you mean to call it instead?
// ok
this.required && this.required();
@@ -1,5 +1,5 @@
tests/cases/compiler/truthinessPromiseCoercion.ts(5,9): error TS2367: This condition will always return 'true' since the types 'Promise<number>' and 'false' have no overlap.
tests/cases/compiler/truthinessPromiseCoercion.ts(9,5): error TS2367: This condition will always return 'true' since the types 'Promise<number>' and 'false' have no overlap.
tests/cases/compiler/truthinessPromiseCoercion.ts(5,9): error TS2801: This condition will always return true since this 'Promise<number>' appears to always be defined.
tests/cases/compiler/truthinessPromiseCoercion.ts(9,5): error TS2801: This condition will always return true since this 'Promise<number>' appears to always be defined.
==== tests/cases/compiler/truthinessPromiseCoercion.ts (2 errors) ====
@@ -9,14 +9,14 @@ tests/cases/compiler/truthinessPromiseCoercion.ts(9,5): error TS2367: This condi
async function f() {
if (p) {} // err
~
!!! error TS2367: This condition will always return 'true' since the types 'Promise<number>' and 'false' have no overlap.
!!! error TS2801: This condition will always return true since this 'Promise<number>' appears to always be defined.
!!! related TS2773 tests/cases/compiler/truthinessPromiseCoercion.ts:5:9: Did you forget to use 'await'?
if (!!p) {} // no err
if (p2) {} // no err
p ? f.arguments : f.arguments;
~
!!! error TS2367: This condition will always return 'true' since the types 'Promise<number>' and 'false' have no overlap.
!!! error TS2801: This condition will always return true since this 'Promise<number>' appears to always be defined.
!!! related TS2773 tests/cases/compiler/truthinessPromiseCoercion.ts:9:5: Did you forget to use 'await'?
!!p ? f.arguments : f.arguments;
p2 ? f.arguments : f.arguments;
@@ -0,0 +1,20 @@
Input::
//// [/lib/lib.d.ts]
//// [/src/bar.ts]
//// [/src/index.js]
//// [/src/tsconfig.json]
{"compilerOptions":{"allowJs":true}}
Output::
/lib/tsc --b /src/tsconfig.json -clean
exitCode:: ExitStatus.Success
@@ -47,11 +47,6 @@ Output::
4 ;
  ~
src/src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
Found 1 error.
@@ -81,11 +76,6 @@ Output::
4 ;
  ~
src/src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
Found 1 error.
@@ -47,11 +47,6 @@ Output::
4 ;
  ~
src/src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
Found 1 error.
@@ -81,11 +76,6 @@ Output::
4 ;
  ~
src/src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
Found 1 error.
@@ -56,11 +56,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:35 AM] Found 1 error. Watching for file changes.
@@ -113,11 +108,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:42 AM] Found 1 error. Watching for file changes.
@@ -56,11 +56,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:35 AM] Found 1 error. Watching for file changes.
@@ -113,11 +108,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:42 AM] Found 1 error. Watching for file changes.
@@ -47,11 +47,6 @@ Output::
4 ;
  ~
src/src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
Found 1 error.
@@ -166,11 +161,6 @@ Output::
4 ;
  ~
src/src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
Found 1 error.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -186,11 +181,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:32 AM] Found 1 error. Watching for file changes.
@@ -104,11 +99,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -187,11 +182,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:32 AM] Found 1 error. Watching for file changes.
@@ -104,11 +99,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -49,11 +49,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -191,11 +186,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -49,11 +49,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:32 AM] Found 1 error. Watching for file changes.
@@ -110,11 +105,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -186,11 +181,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:32 AM] Found 1 error. Watching for file changes.
@@ -104,11 +99,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -186,11 +181,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -186,11 +181,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -187,11 +182,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -187,11 +182,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -49,11 +49,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -191,11 +186,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -49,11 +49,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -191,11 +186,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -186,11 +181,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -186,11 +181,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -186,11 +181,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -186,11 +181,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -187,11 +182,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -187,11 +182,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -186,11 +181,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:32 AM] Found 1 error. Watching for file changes.
@@ -104,11 +99,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -187,11 +182,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:44 AM] Found 1 error. Watching for file changes.
@@ -43,11 +43,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:32 AM] Found 1 error. Watching for file changes.
@@ -104,11 +99,6 @@ Output::
4 ;
  ~
src/main.ts:2:11
2 const a = {
   ~
The parser expected to find a '}' to match the '{' token here.
[12:00:37 AM] Found 1 error. Watching for file changes.
@@ -93,6 +93,7 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): err
!!! error TS2304: Cannot find name 'is'.
~~~~~~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts:44:3: The parser expected to find a ')' to match the '(' token here.
~~~~~~
!!! error TS2693: 'string' only refers to a type, but is being used as a value here.
~
@@ -108,6 +109,7 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): err
!!! error TS2749: 'numOrStr' refers to a value, but is being used as a type here. Did you mean 'typeof numOrStr'?
~~
!!! error TS1005: ')' expected.
!!! related TS1007 tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts:48:3: The parser expected to find a ')' to match the '(' token here.
~~
!!! error TS2304: Cannot find name 'is'.
~~~~~~
@@ -0,0 +1,12 @@
declare function fn(): { a: 1, b: 2 }
let a: number;
let b: number;
({ a, b } = fn());
{ a, b } = fn();
({ a, b } =
fn());
{ a, b }
= fn();
@@ -0,0 +1 @@
var alphas:string[] = alphas = ["1","2","3","4"
@@ -0,0 +1,13 @@
var a1, a2, a3 = 0;
if ( a1 && (a2 + a3 > 0) {
while( (a2 > 0) && a1
{
do {
var i = i + 1;
a1 = a1 + i;
with ((a2 + a3 > 0) && a1 {
console.log(x);
}
} while (i < 5 && (a1 > 5);
}
}
@@ -0,0 +1,17 @@
// @noTypesAndSymbols: true
// @strictNullChecks: true
// @target: esnext
// @useDefineForClassFields: true
class Base {
b = 1;
}
class Derived extends Base {
b;
d = this.b;
constructor() {
super();
this.b = 2;
}
}
@@ -0,0 +1,16 @@
// @noTypesAndSymbols: true
// @strictNullChecks: true
// @target: esnext
// @useDefineForClassFields: true
class Base {
a = 1;
}
class Derived extends Base {
b = this.a /*undefined*/;
constructor(public a: number) {
super();
}
}
@@ -2,4 +2,6 @@ interface any { }
interface number { }
interface string { }
interface boolean { }
interface void {}
interface void {}
interface unknown {}
interface never {}
@@ -1,2 +1 @@
var texCoords = [2, 2, 0.5000001192092895, 0.8749999 ; 403953552, 0.5000001192092895, 0.8749999403953552];
@@ -113,3 +113,9 @@ const pixelStringWithTemplate: PixelValueType = `${pixelValue}px`;
function getCardTitle(title: string): `test-${string}` {
return `test-${title}`;
}
// Repro from #43424
const interpolatedStyle = { rotate: 12 };
function C2(transform: "-moz-initial" | (string & {})) { return 12; }
C2(`rotate(${interpolatedStyle.rotate}dig)`);
@@ -5,7 +5,7 @@
// @allowJs: true
// @Filename: /a.js
/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|] |]*/
/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|]|] */
////
/////**
//// * @return {[|T|]}
@@ -4,7 +4,7 @@
// @Filename: /a.js
////module.exports = 0;
/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Foo|] |]*/
/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Foo|]|] */
////const dummy = 0;
// @Filename: /b.js
@@ -0,0 +1,9 @@
///<reference path="fourslash.ts" />
/////**
//// * @typedef {Object} Foo
//// * @property {number} ...
//// * /**/@typedef {number} Bar
//// */
verify.baselineSignatureHelp();

Some files were not shown because too many files have changed in this diff Show More