diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 56948b2288ca0..9f56a299df659 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -596,7 +596,7 @@ namespace ts { const definitelyAssignableRelation = createMap(); const comparableRelation = createMap(); const identityRelation = createMap(); - const enumRelation = createMap(); + const enumRelation = createMap(); type TypeSystemEntity = Symbol | Type | Signature; @@ -10103,8 +10103,163 @@ namespace ts { return isTypeComparableTo(type1, type2) || isTypeComparableTo(type2, type1); } - function checkTypeAssignableTo(source: Type, target: Type, errorNode: Node | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined): boolean { - return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); + function checkTypeAssignableTo(source: Type, target: Type, errorNode: Node | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined, errorOutputObject?: { error?: Diagnostic }): boolean { + return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain, errorOutputObject); + } + + /** + * Like `checkTypeAssignableTo`, but if it would issue an error, instead performs structural comparisons of the types using the given expression node to + * attempt to issue more specific errors on, for example, specific object literal properties or tuple members. + */ + function checkTypeAssignableToAndOptionallyElaborate(source: Type, target: Type, errorNode: Node | undefined, expr: Expression | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined): boolean { + if (isTypeAssignableTo(source, target)) return true; + if (!elaborateError(expr, source, target)) { + return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); + } + return false; + } + + function elaborateError(node: Expression | undefined, source: Type, target: Type): boolean { + if (!node) return false; + switch (node.kind) { + case SyntaxKind.JsxExpression: + case SyntaxKind.ParenthesizedExpression: + return elaborateError((node as ParenthesizedExpression | JsxExpression).expression, source, target); + case SyntaxKind.BinaryExpression: + switch ((node as BinaryExpression).operatorToken.kind) { + case SyntaxKind.EqualsToken: + case SyntaxKind.CommaToken: + return elaborateError((node as BinaryExpression).right, source, target); + } + break; + case SyntaxKind.ObjectLiteralExpression: + return elaborateObjectLiteral(node as ObjectLiteralExpression, source, target); + case SyntaxKind.ArrayLiteralExpression: + return elaborateArrayLiteral(node as ArrayLiteralExpression, source, target); + case SyntaxKind.JsxAttributes: + return elaborateJsxAttributes(node as JsxAttributes, source, target); + } + return false; + } + + type ElaborationIterator = IterableIterator<{ errorNode: Node, innerExpression: Expression | undefined, nameType: Type, errorMessage?: DiagnosticMessage | undefined }>; + /** + * For every element returned from the iterator, checks that element to issue an error on a property of that element's type + * If that element would issue an error, we first attempt to dive into that element's inner expression and issue a more specific error by recuring into `elaborateError` + * Otherwise, we issue an error on _every_ element which fail the assignability check + */ + function elaborateElementwise(iterator: ElaborationIterator, source: Type, target: Type) { + // Assignability failure - check each prop individually, and if that fails, fall back on the bad error span + let reportedError = false; + for (let status = iterator.next(); !status.done; status = iterator.next()) { + const { errorNode: prop, innerExpression: next, nameType, errorMessage } = status.value; + const sourcePropType = getIndexedAccessType(source, nameType); + const targetPropType = getIndexedAccessType(target, nameType); + if (!isTypeAssignableTo(sourcePropType, targetPropType)) { + const elaborated = next && elaborateError(next, sourcePropType, targetPropType); + if (elaborated) { + reportedError = true; + } + else { + // Issue error on the prop itself, since the prop couldn't elaborate the error + const resultObj: { error?: Diagnostic } = {}; + // Use the expression type, if available + const specificSource = next ? checkExpressionForMutableLocation(next, CheckMode.Normal, sourcePropType) : sourcePropType; + const result = checkTypeAssignableTo(specificSource, targetPropType, prop, errorMessage, /*containingChain*/ undefined, resultObj); + if (result && specificSource !== sourcePropType) { + // If for whatever reason the expression type doesn't yield an error, make sure we still issue an error on the sourcePropType + checkTypeAssignableTo(sourcePropType, targetPropType, prop, errorMessage, /*containingChain*/ undefined, resultObj); + } + if (resultObj.error) { + const reportedDiag = resultObj.error; + const propertyName = isTypeUsableAsLateBoundName(nameType) ? getLateBoundNameFromType(nameType) : undefined; + const targetProp = propertyName !== undefined ? getPropertyOfType(target, propertyName) : undefined; + + let issuedElaboration = false; + if (!targetProp) { + const indexInfo = isTypeAssignableToKind(nameType, TypeFlags.NumberLike) && getIndexInfoOfType(target, IndexKind.Number) || + getIndexInfoOfType(target, IndexKind.String) || + undefined; + if (indexInfo && indexInfo.declaration) { + issuedElaboration = true; + addRelatedInfo(reportedDiag, createDiagnosticForNode(indexInfo.declaration, Diagnostics.The_expected_type_comes_from_this_index_signature)); + } + } + + if (!issuedElaboration && (length(targetProp && targetProp.declarations) || length(target.symbol && target.symbol.declarations))) { + addRelatedInfo(reportedDiag, createDiagnosticForNode( + targetProp ? targetProp.declarations[0] : target.symbol.declarations[0], + Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, + propertyName && !(nameType.flags & TypeFlags.UniqueESSymbol) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType), + typeToString(target) + )); + } + } + reportedError = true; + } + } + } + return reportedError; + } + + function *generateJsxAttributes(node: JsxAttributes): ElaborationIterator { + if (!length(node.properties)) return; + for (const prop of node.properties) { + if (isJsxSpreadAttribute(prop)) continue; + yield { errorNode: prop.name, innerExpression: prop.initializer, nameType: getLiteralType(idText(prop.name)) }; + } + } + + function elaborateJsxAttributes(node: JsxAttributes, source: Type, target: Type) { + return elaborateElementwise(generateJsxAttributes(node), source, target); + } + + function *generateLimitedTupleElements(node: ArrayLiteralExpression, target: Type): ElaborationIterator { + const len = length(node.elements); + if (!len) return; + for (let i = 0; i < len; i++) { + // Skip elements which do not exist in the target - a length error on the tuple overall is likely better than an error on a mismatched index signature + if (isTupleLikeType(target) && !getPropertyOfType(target, ("" + i) as __String)) continue; + const elem = node.elements[i]; + if (isOmittedExpression(elem)) continue; + const nameType = getLiteralType(i); + yield { errorNode: elem, innerExpression: elem, nameType }; + } + } + + function elaborateArrayLiteral(node: ArrayLiteralExpression, source: Type, target: Type) { + if (isTupleLikeType(source)) { + return elaborateElementwise(generateLimitedTupleElements(node, target), source, target); + } + return false; + } + + function *generateObjectLiteralElements(node: ObjectLiteralExpression): ElaborationIterator { + if (!length(node.properties)) return; + for (const prop of node.properties) { + if (isSpreadAssignment(prop)) continue; + const type = getLiteralTypeFromPropertyName(getSymbolOfNode(prop), TypeFlags.StringOrNumberLiteralOrUnique); + if (!type || (type.flags & TypeFlags.Never)) { + continue; + } + switch (prop.kind) { + case SyntaxKind.SetAccessor: + case SyntaxKind.GetAccessor: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.ShorthandPropertyAssignment: + yield { errorNode: prop.name, innerExpression: undefined, nameType: type }; + break; + case SyntaxKind.PropertyAssignment: + yield { errorNode: prop.name, innerExpression: prop.initializer, nameType: type, errorMessage: isComputedNonLiteralName(prop.name) ? Diagnostics.Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1 : undefined }; + break; + default: + Debug.assertNever(prop); + } + } + } + + function elaborateObjectLiteral(node: ObjectLiteralExpression, source: Type, target: Type) { + return elaborateElementwise(generateObjectLiteralElements(node), source, target); } /** @@ -10319,11 +10474,11 @@ namespace ts { } const id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol); const relation = enumRelation.get(id); - if (relation !== undefined) { - return relation; + if (relation !== undefined && !(relation === RelationComparisonResult.Failed && errorReporter)) { + return relation === RelationComparisonResult.Succeeded; } if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & SymbolFlags.RegularEnum) || !(targetSymbol.flags & SymbolFlags.RegularEnum)) { - enumRelation.set(id, false); + enumRelation.set(id, RelationComparisonResult.FailedAndReported); return false; } const targetEnumType = getTypeOfSymbol(targetSymbol); @@ -10334,13 +10489,16 @@ namespace ts { if (errorReporter) { errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property), typeToString(getDeclaredTypeOfSymbol(targetSymbol), /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType)); + enumRelation.set(id, RelationComparisonResult.FailedAndReported); + } + else { + enumRelation.set(id, RelationComparisonResult.Failed); } - enumRelation.set(id, false); return false; } } } - enumRelation.set(id, true); + enumRelation.set(id, RelationComparisonResult.Succeeded); return true; } @@ -10425,7 +10583,9 @@ namespace ts { relation: Map, errorNode: Node | undefined, headMessage?: DiagnosticMessage, - containingMessageChain?: () => DiagnosticMessageChain | undefined): boolean { + containingMessageChain?: () => DiagnosticMessageChain | undefined, + errorOutputContainer?: { error?: Diagnostic } + ): boolean { let errorInfo: DiagnosticMessageChain | undefined; let maybeKeys: string[]; @@ -10465,7 +10625,11 @@ namespace ts { } } - diagnostics.add(createDiagnosticForNodeFromMessageChain(errorNode!, errorInfo, relatedInformation)); // TODO: GH#18217 + const diag = createDiagnosticForNodeFromMessageChain(errorNode!, errorInfo, relatedInformation); + if (errorOutputContainer) { + errorOutputContainer.error = diag; + } + diagnostics.add(diag); // TODO: GH#18217 } return result !== Ternary.False; @@ -10987,9 +11151,8 @@ namespace ts { const related = relation.get(id); if (related !== undefined) { if (reportErrors && related === RelationComparisonResult.Failed) { - // We are elaborating errors and the cached result is an unreported failure. Record the result as a reported - // failure and continue computing the relation such that errors get reported. - relation.set(id, RelationComparisonResult.FailedAndReported); + // We are elaborating errors and the cached result is an unreported failure. The result will be reported + // as a failure, and should be updated as a reported failure by the bottom of this function. } else { return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False; @@ -15627,7 +15790,7 @@ namespace ts { const discriminatingType = checkExpression(prop.initializer); for (const type of (contextualType as UnionType).types) { const targetType = getTypeOfPropertyOfType(type, prop.symbol.escapedName); - if (targetType && checkTypeAssignableTo(discriminatingType, targetType, /*errorNode*/ undefined)) { + if (targetType && isTypeAssignableTo(discriminatingType, targetType)) { if (match) { if (type === match) continue; // Finding multiple fields which discriminate to the same type is fine match = undefined; @@ -17144,30 +17307,7 @@ namespace ts { } } else if (!isSourceAttributeTypeAssignableToTarget) { - // Assignability failure - check each prop individually, and if that fails, fall back on the bad error span - if (length(openingLikeElement.attributes.properties)) { - let reportedError = false; - for (const prop of openingLikeElement.attributes.properties) { - if (isJsxSpreadAttribute(prop)) continue; - const name = idText(prop.name); - const sourcePropType = getIndexedAccessType(sourceAttributesType, getLiteralType(name)); - const targetPropType = getIndexedAccessType(targetAttributesType, getLiteralType(name)); - const rootChain = () => chainDiagnosticMessages( - /*details*/ undefined, - Diagnostics.Types_of_property_0_are_incompatible, - name, - ); - if (!checkTypeAssignableTo(sourcePropType, targetPropType, prop, /*headMessage*/ undefined, rootChain)) { - reportedError = true; - } - } - - if (reportedError) { - return; - } - } - // Report fallback error on just the component name - checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.tagName); + checkTypeAssignableToAndOptionallyElaborate(sourceAttributesType, targetAttributesType, openingLikeElement.tagName, openingLikeElement.attributes); } } @@ -20118,10 +20258,10 @@ namespace ts { if (returnOrPromisedType) { if ((functionFlags & FunctionFlags.AsyncGenerator) === FunctionFlags.Async) { // Async function const awaitedType = checkAwaitedType(exprType, node.body, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); - checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); + checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, node.body, node.body); } else { // Normal function - checkTypeAssignableTo(exprType, returnOrPromisedType, node.body); + checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, node.body, node.body); } } } @@ -20539,7 +20679,7 @@ namespace ts { Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { - checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined); + checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target); } return sourceType; } @@ -20838,7 +20978,7 @@ namespace ts { if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access) && (!isIdentifier(left) || unescapeLeadingUnderscores(left.escapedText) !== "exports")) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported - checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined); + checkTypeAssignableToAndOptionallyElaborate(valueType, leftType, left, right); } } } @@ -20950,7 +21090,7 @@ namespace ts { const returnType = getEffectiveReturnTypeNode(func); if (returnType) { const signatureElementType = getIteratedTypeOfGenerator(getTypeFromTypeNode(returnType), isAsync) || anyType; - checkTypeAssignableTo(yieldedType, signatureElementType, node.expression || node, /*headMessage*/ undefined); + checkTypeAssignableToAndOptionallyElaborate(yieldedType, signatureElementType, node.expression || node, node.expression); } // Both yield and yield* expressions have type 'any' @@ -23671,7 +23811,7 @@ namespace ts { checkNonNullType(initializerType, node); } else { - checkTypeAssignableTo(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); + checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer); } checkParameterInitializer(node); } @@ -23689,7 +23829,7 @@ namespace ts { (initializer.properties.length === 0 || isPrototypeAccess(node.name)) && hasEntries(symbol.exports); if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== SyntaxKind.ForInStatement) { - checkTypeAssignableTo(checkExpressionCached(initializer), type, node, /*headMessage*/ undefined); + checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); checkParameterInitializer(node); } } @@ -23705,7 +23845,7 @@ namespace ts { errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType); } if (node.initializer) { - checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); + checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, /*headMessage*/ undefined); } if (!areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) { error(getNameOfDeclaration(symbol.valueDeclaration), Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); @@ -23878,7 +24018,7 @@ namespace ts { // because we accessed properties from anyType, or it may have led to an error inside // getElementTypeOfIterable. if (iteratedType) { - checkTypeAssignableTo(iteratedType, leftType, varExpr, /*headMessage*/ undefined); + checkTypeAssignableToAndOptionallyElaborate(iteratedType, leftType, varExpr, node.expression); } } } @@ -24322,7 +24462,7 @@ namespace ts { } } else if (func.kind === SyntaxKind.Constructor) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } @@ -24338,7 +24478,7 @@ namespace ts { } } else { - checkTypeAssignableTo(exprType, returnType, node); + checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e70339ae1271f..af27042b17f16 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1452,6 +1452,10 @@ "category": "Error", "code": 2417 }, + "Type of computed property's value is '{0}', which is not assignable to type '{1}'.": { + "category": "Error", + "code": 2418 + }, "Class '{0}' incorrectly implements interface '{1}'.": { "category": "Error", "code": 2420 @@ -3746,6 +3750,15 @@ "code": 6371 }, + "The expected type comes from property '{0}' which is declared here on type '{1}'": { + "category": "Message", + "code": 6500 + }, + "The expected type comes from this index signature.": { + "category": "Message", + "code": 6501 + }, + "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 diff --git a/src/tsconfig-base.json b/src/tsconfig-base.json index 4aa4932a61af3..acbd4a3574aeb 100644 --- a/src/tsconfig-base.json +++ b/src/tsconfig-base.json @@ -1,7 +1,7 @@ { "compilerOptions": { "pretty": true, - "lib": ["es5"], + "lib": ["es2015"], "target": "es5", "declaration": true, diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index c4dd269688045..b6d98f589bc90 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -5182,6 +5182,7 @@ declare namespace ts { Class_0_incorrectly_extends_base_class_1: DiagnosticMessage; Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2: DiagnosticMessage; Class_static_side_0_incorrectly_extends_base_class_static_side_1: DiagnosticMessage; + Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1: DiagnosticMessage; Class_0_incorrectly_implements_interface_1: DiagnosticMessage; A_class_may_only_implement_another_class_or_interface: DiagnosticMessage; Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: DiagnosticMessage; @@ -5752,6 +5753,8 @@ declare namespace ts { Option_build_must_be_the_first_command_line_argument: DiagnosticMessage; Options_0_and_1_cannot_be_combined: DiagnosticMessage; Skipping_clean_because_not_all_projects_could_be_located: DiagnosticMessage; + The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: DiagnosticMessage; + The_expected_type_comes_from_this_index_signature: DiagnosticMessage; Variable_0_implicitly_has_an_1_type: DiagnosticMessage; Parameter_0_implicitly_has_an_1_type: DiagnosticMessage; Member_0_implicitly_has_an_1_type: DiagnosticMessage; diff --git a/tests/baselines/reference/arrayLiterals3.errors.txt b/tests/baselines/reference/arrayLiterals3.errors.txt index 8ce34900b0a7b..329c9061e0dfd 100644 --- a/tests/baselines/reference/arrayLiterals3.errors.txt +++ b/tests/baselines/reference/arrayLiterals3.errors.txt @@ -1,7 +1,8 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(10,5): error TS2322: Type '[]' is not assignable to type '[any, any, any]'. Property '0' is missing in type '[]'. -tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,5): error TS2322: Type '[string, number, boolean]' is not assignable to type '[boolean, string, number]'. - Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,38): error TS2322: Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,48): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,51): error TS2322: Type 'true' is not assignable to type 'number'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'. Types of property 'length' are incompatible. Type '4' is not assignable to type '2'. @@ -18,7 +19,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error 'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible. -==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (6 errors) ==== +==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (8 errors) ==== // Each element expression in a non-empty array literal is processed as follows: // - If the array literal contains no spread elements, and if the array literal is contextually typed (section 4.19) // by a type T and T has a property with the numeric name N, where N is the index of the element expression in the array literal, @@ -33,9 +34,12 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error !!! error TS2322: Type '[]' is not assignable to type '[any, any, any]'. !!! error TS2322: Property '0' is missing in type '[]'. var a1: [boolean, string, number] = ["string", 1, true]; // Error - ~~ -!!! error TS2322: Type '[string, number, boolean]' is not assignable to type '[boolean, string, number]'. -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + ~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~~ +!!! error TS2322: Type 'true' is not assignable to type 'number'. // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1), diff --git a/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt b/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt index 204135cd004e5..8ba04d8ab2c29 100644 --- a/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt +++ b/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt @@ -1,6 +1,4 @@ -tests/cases/compiler/assignmentToObjectAndFunction.ts(1,5): error TS2322: Type '{ toString: number; }' is not assignable to type 'Object'. - Types of property 'toString' are incompatible. - Type 'number' is not assignable to type '() => string'. +tests/cases/compiler/assignmentToObjectAndFunction.ts(1,24): error TS2322: Type 'number' is not assignable to type '() => string'. tests/cases/compiler/assignmentToObjectAndFunction.ts(8,5): error TS2322: Type '{}' is not assignable to type 'Function'. Property 'apply' is missing in type '{}'. tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type 'typeof bad' is not assignable to type 'Function'. @@ -10,10 +8,9 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type ==== tests/cases/compiler/assignmentToObjectAndFunction.ts (3 errors) ==== var errObj: Object = { toString: 0 }; // Error, incompatible toString - ~~~~~~ -!!! error TS2322: Type '{ toString: number; }' is not assignable to type 'Object'. -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type '() => string'. + ~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type '() => string'. +!!! related TS6500 /.ts/lib.es5.d.ts:125:5: The expected type comes from property 'toString' which is declared here on type 'Object' var goodObj: Object = { toString(x?) { return ""; diff --git a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt index 907fcce4c315b..b5d6d0668a7dc 100644 --- a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt +++ b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt @@ -6,15 +6,9 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(17,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(18,2): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(25,5): error TS2539: Cannot assign to 'M3' because it is not a variable. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(31,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'. - Types of property 'x' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(32,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'. - Types of property 'x' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(33,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'. - Types of property 'x' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(31,11): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(32,13): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(33,13): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(37,1): error TS2539: Cannot assign to 'fn' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(38,2): error TS2539: Cannot assign to 'fn' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(43,5): error TS2322: Type '""' is not assignable to type 'number'. @@ -78,20 +72,17 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize (M2.M3) = { x: 3 }; // OK M2.M3 = { x: '' }; // Error - ~~~~~ -!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'. -!!! error TS2322: Types of property 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts:22:20: The expected type comes from property 'x' which is declared here on type 'typeof M3' (M2).M3 = { x: '' }; // Error - ~~~~~~~ -!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'. -!!! error TS2322: Types of property 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts:22:20: The expected type comes from property 'x' which is declared here on type 'typeof M3' (M2.M3) = { x: '' }; // Error - ~~~~~~~ -!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'. -!!! error TS2322: Types of property 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts:22:20: The expected type comes from property 'x' which is declared here on type 'typeof M3' function fn() { } diff --git a/tests/baselines/reference/baseClassImprovedMismatchErrors.errors.txt b/tests/baselines/reference/baseClassImprovedMismatchErrors.errors.txt index 031fe18375415..5f46ee70d2aaa 100644 --- a/tests/baselines/reference/baseClassImprovedMismatchErrors.errors.txt +++ b/tests/baselines/reference/baseClassImprovedMismatchErrors.errors.txt @@ -5,7 +5,6 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(8,5): error TS2416: Prop Types of property 'n' are incompatible. Type 'string | Derived' is not assignable to type 'string | Base'. Type 'Derived' is not assignable to type 'string | Base'. - Type 'Derived' is not assignable to type 'Base'. tests/cases/compiler/baseClassImprovedMismatchErrors.ts(9,5): error TS2416: Property 'fn' in type 'Derived' is not assignable to the same property in base type 'Base'. Type '() => string | number' is not assignable to type '() => number'. Type 'string | number' is not assignable to type 'number'. @@ -17,7 +16,6 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(14,5): error TS2416: Pro Types of property 'n' are incompatible. Type 'string | DerivedInterface' is not assignable to type 'string | Base'. Type 'DerivedInterface' is not assignable to type 'string | Base'. - Type 'DerivedInterface' is not assignable to type 'Base'. tests/cases/compiler/baseClassImprovedMismatchErrors.ts(15,5): error TS2416: Property 'fn' in type 'DerivedInterface' is not assignable to the same property in base type 'Base'. Type '() => string | number' is not assignable to type '() => number'. Type 'string | number' is not assignable to type 'number'. @@ -41,7 +39,6 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(15,5): error TS2416: Pro !!! error TS2416: Types of property 'n' are incompatible. !!! error TS2416: Type 'string | Derived' is not assignable to type 'string | Base'. !!! error TS2416: Type 'Derived' is not assignable to type 'string | Base'. -!!! error TS2416: Type 'Derived' is not assignable to type 'Base'. fn() { ~~ !!! error TS2416: Property 'fn' in type 'Derived' is not assignable to the same property in base type 'Base'. @@ -61,7 +58,6 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(15,5): error TS2416: Pro !!! error TS2416: Types of property 'n' are incompatible. !!! error TS2416: Type 'string | DerivedInterface' is not assignable to type 'string | Base'. !!! error TS2416: Type 'DerivedInterface' is not assignable to type 'string | Base'. -!!! error TS2416: Type 'DerivedInterface' is not assignable to type 'Base'. fn() { ~~ !!! error TS2416: Property 'fn' in type 'DerivedInterface' is not assignable to the same property in base type 'Base'. diff --git a/tests/baselines/reference/checkJsxGenericTagHasCorrectInferences.errors.txt b/tests/baselines/reference/checkJsxGenericTagHasCorrectInferences.errors.txt index 6a7143b85b2ed..6b81ccd77e1b7 100644 --- a/tests/baselines/reference/checkJsxGenericTagHasCorrectInferences.errors.txt +++ b/tests/baselines/reference/checkJsxGenericTagHasCorrectInferences.errors.txt @@ -1,6 +1,5 @@ -tests/cases/conformance/jsx/file.tsx(13,54): error TS2326: Types of property 'nextValues' are incompatible. - Type '(a: { x: string; }) => string' is not assignable to type '(cur: { x: string; }) => { x: string; }'. - Type 'string' is not assignable to type '{ x: string; }'. +tests/cases/conformance/jsx/file.tsx(13,54): error TS2322: Type '(a: { x: string; }) => string' is not assignable to type '(cur: { x: string; }) => { x: string; }'. + Type 'string' is not assignable to type '{ x: string; }'. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -17,7 +16,7 @@ tests/cases/conformance/jsx/file.tsx(13,54): error TS2326: Types of property 'ne let b = a} />; // No error - Values should be reinstantiated with `number` (since `object` is a default, not a constraint) let c = ({ x: a.x })} />; // No Error let d = a.x} />; // Error - `string` is not assignable to `{x: string}` - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'nextValues' are incompatible. -!!! error TS2326: Type '(a: { x: string; }) => string' is not assignable to type '(cur: { x: string; }) => { x: string; }'. -!!! error TS2326: Type 'string' is not assignable to type '{ x: string; }'. \ No newline at end of file + ~~~~~~~~~~ +!!! error TS2322: Type '(a: { x: string; }) => string' is not assignable to type '(cur: { x: string; }) => { x: string; }'. +!!! error TS2322: Type 'string' is not assignable to type '{ x: string; }'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:13:54: The expected type comes from property 'nextValues' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & { initialValues: { x: string; }; nextValues: {}; } & BaseProps<{ x: string; }> & { children?: ReactNode; }' \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt index ee36609095a04..56e374f0d5352 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt @@ -1,21 +1,20 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. - Index signatures are incompatible. - Type 'string | number' is not assignable to type 'boolean'. - Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(7,5): error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(8,5): error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (2 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; } var o: I = { - ~ -!!! error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. -!!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. [""+"foo"]: "", + ~~~~~~~~~~ +!!! error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'. +!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts:2:5: The expected type comes from this index signature. [""+"bar"]: 0 + ~~~~~~~~~~ +!!! error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'. +!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts:2:5: The expected type comes from this index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt index 1048fd2e119e7..c24b53eaa1709 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt @@ -1,21 +1,20 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. - Index signatures are incompatible. - Type 'string | number' is not assignable to type 'boolean'. - Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(7,5): error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(8,5): error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts (2 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; } var o: I = { - ~ -!!! error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'. -!!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. [""+"foo"]: "", + ~~~~~~~~~~ +!!! error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'. +!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts:2:5: The expected type comes from this index signature. [""+"bar"]: 0 + ~~~~~~~~~~ +!!! error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'. +!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts:2:5: The expected type comes from this index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt index ef1765eb017a1..6d3644eabb035 100644 --- a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt +++ b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt @@ -1,9 +1,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2322: Type '1' is not assignable to type 'D'. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. -tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2322: Type '{ x: number; }' is not assignable to type 'F'. - Types of property 'x' are incompatible. - Type 'number' is not assignable to type 'T'. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. +tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,18): error TS2322: Type 'number' is not assignable to type 'T'. ==== tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts (4 errors) ==== @@ -38,11 +36,10 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl constructor() { return { x: 1 }; // error ~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ x: number; }' is not assignable to type 'F'. -!!! error TS2322: Types of property 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'T'. - ~~~~~~~~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! related TS6500 tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts:24:5: The expected type comes from property 'x' which is declared here on type 'F' } } diff --git a/tests/baselines/reference/contextualTypeAny.errors.txt b/tests/baselines/reference/contextualTypeAny.errors.txt index 09970be986ddb..90f11f7c0140b 100644 --- a/tests/baselines/reference/contextualTypeAny.errors.txt +++ b/tests/baselines/reference/contextualTypeAny.errors.txt @@ -1,15 +1,12 @@ -tests/cases/compiler/contextualTypeAny.ts(3,5): error TS2322: Type '{ p: string; q: any; }' is not assignable to type '{ [s: string]: number; }'. - Property 'p' is incompatible with index signature. - Type 'string' is not assignable to type 'number'. +tests/cases/compiler/contextualTypeAny.ts(3,38): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/contextualTypeAny.ts (1 errors) ==== var x: any; var obj: { [s: string]: number } = { p: "", q: x }; - ~~~ -!!! error TS2322: Type '{ p: string; q: any; }' is not assignable to type '{ [s: string]: number; }'. -!!! error TS2322: Property 'p' is incompatible with index signature. -!!! error TS2322: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6501 tests/cases/compiler/contextualTypeAny.ts:3:12: The expected type comes from this index signature. var arr: number[] = ["", x]; \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypeWithTuple.errors.txt b/tests/baselines/reference/contextualTypeWithTuple.errors.txt index 58a90919c5b29..9d9c015457bbc 100644 --- a/tests/baselines/reference/contextualTypeWithTuple.errors.txt +++ b/tests/baselines/reference/contextualTypeWithTuple.errors.txt @@ -2,9 +2,8 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS232 Types of property 'length' are incompatible. Type '3' is not assignable to type '2'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(15,1): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'. -tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(18,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'. - Type '{}' is not assignable to type '{ a: string; }'. - Property 'a' is missing in type '{}'. +tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(18,17): error TS2322: Type '{}' is not assignable to type '{ a: string; }'. + Property 'a' is missing in type '{}'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(19,1): error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]'. Property '2' is missing in type '[number, string]'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(20,5): error TS2322: Type '[string, string, number]' is not assignable to type '[string, string]'. @@ -45,10 +44,9 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(25,1): error TS23 // error objNumTuple = [ {}, 5]; - ~~~~~~~~~~~ -!!! error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'. -!!! error TS2322: Type '{}' is not assignable to type '{ a: string; }'. -!!! error TS2322: Property 'a' is missing in type '{}'. + ~~ +!!! error TS2322: Type '{}' is not assignable to type '{ a: string; }'. +!!! error TS2322: Property 'a' is missing in type '{}'. numStrBoolTuple = numStrTuple; ~~~~~~~~~~~~~~~ !!! error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]'. diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.errors.txt b/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.errors.txt index 651d4f5381f4d..e4ffa209e6fd2 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.errors.txt +++ b/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.errors.txt @@ -21,12 +21,10 @@ tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts( Types of property 'prop' are incompatible. Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(57,5): error TS2322: Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I11 | I21'. - Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I21'. - Types of property 'commonMethodDifferentReturnType' are incompatible. - Type '(a: string, b: number) => string | number' is not assignable to type '(a: string, b: number) => number'. - Type 'string | number' is not assignable to type 'number'. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(58,5): error TS2322: Type '(a: string, b: number) => string | number' is not assignable to type '((a: string, b: number) => string) | ((a: string, b: number) => number)'. + Type '(a: string, b: number) => string | number' is not assignable to type '(a: string, b: number) => number'. + Type 'string | number' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts (6 errors) ==== @@ -115,12 +113,11 @@ tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts( }; var strOrNumber: string | number; var i11Ori21: I11 | I21 = { // Like i1 and i2 both - ~~~~~~~~ -!!! error TS2322: Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I11 | I21'. -!!! error TS2322: Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I21'. -!!! error TS2322: Types of property 'commonMethodDifferentReturnType' are incompatible. -!!! error TS2322: Type '(a: string, b: number) => string | number' is not assignable to type '(a: string, b: number) => number'. -!!! error TS2322: Type 'string | number' is not assignable to type 'number'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. commonMethodDifferentReturnType: (a, b) => strOrNumber, + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(a: string, b: number) => string | number' is not assignable to type '((a: string, b: number) => string) | ((a: string, b: number) => number)'. +!!! error TS2322: Type '(a: string, b: number) => string | number' is not assignable to type '(a: string, b: number) => number'. +!!! error TS2322: Type 'string | number' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts:35:5: The expected type comes from property 'commonMethodDifferentReturnType' which is declared here on type 'I11 | I21' }; \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypedBindingInitializerNegative.errors.txt b/tests/baselines/reference/contextuallyTypedBindingInitializerNegative.errors.txt index 447ccec5ddf91..1bc381ec39db0 100644 --- a/tests/baselines/reference/contextuallyTypedBindingInitializerNegative.errors.txt +++ b/tests/baselines/reference/contextuallyTypedBindingInitializerNegative.errors.txt @@ -4,14 +4,11 @@ tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTyp Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(6,25): error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(11,23): error TS2322: Type '{ show: (v: number) => number; }' is not assignable to type 'Show'. - Types of property 'show' are incompatible. - Type '(v: number) => number' is not assignable to type '(x: number) => string'. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(16,23): error TS2322: Type '(arg: string) => number' is not assignable to type '(s: string) => string'. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(11,40): error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(21,14): error TS2322: Type '[number, number]' is not assignable to type '[string, number]'. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(16,23): error TS2322: Type '(arg: string) => number' is not assignable to type '(s: string) => string'. Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(21,22): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(26,14): error TS2322: Type '"baz"' is not assignable to type '"foo" | "bar"'. @@ -36,11 +33,10 @@ tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTyp nested: Show } function ff({ nested: nestedRename = { show: v => v } }: Nested) {} - ~~~~~~~~~~~~ -!!! error TS2322: Type '{ show: (v: number) => number; }' is not assignable to type 'Show'. -!!! error TS2322: Types of property 'show' are incompatible. -!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~~ +!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts:2:5: The expected type comes from property 'show' which is declared here on type 'Show' interface StringIdentity { stringIdentity(s: string): string; @@ -54,9 +50,8 @@ tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTyp prop: [string, number]; } function g({ prop = [101, 1234] }: Tuples) {} - ~~~~ -!!! error TS2322: Type '[number, number]' is not assignable to type '[string, number]'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. interface StringUnion { prop: "foo" | "bar"; diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt index a3ddd397a6495..bfd0462953a81 100644 --- a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt +++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt @@ -1,7 +1,5 @@ -tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(15,15): error TS2326: Types of property 'foo' are incompatible. - Type '"f"' is not assignable to type '"A" | "B" | "C"'. -tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(16,15): error TS2326: Types of property 'foo' are incompatible. - Type '"f"' is not assignable to type '"A" | "B" | "C"'. +tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(15,15): error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'. +tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(16,15): error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'. ==== tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx (2 errors) ==== @@ -20,10 +18,10 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStr ; ; - ~~~~~~~~~ -!!! error TS2326: Types of property 'foo' are incompatible. -!!! error TS2326: Type '"f"' is not assignable to type '"A" | "B" | "C"'. + ~~~ +!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'. +!!! related TS6500 tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx:10:32: The expected type comes from property 'foo' which is declared here on type '{ foo: "A" | "B" | "C"; }' ; - ~~~~~~~ -!!! error TS2326: Types of property 'foo' are incompatible. -!!! error TS2326: Type '"f"' is not assignable to type '"A" | "B" | "C"'. \ No newline at end of file + ~~~ +!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'. +!!! related TS6500 tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx:10:32: The expected type comes from property 'foo' which is declared here on type '{ foo: "A" | "B" | "C"; }' \ No newline at end of file diff --git a/tests/baselines/reference/deeplyNestedAssignabilityIssue.errors.txt b/tests/baselines/reference/deeplyNestedAssignabilityIssue.errors.txt new file mode 100644 index 0000000000000..cf243a1e5bd8a --- /dev/null +++ b/tests/baselines/reference/deeplyNestedAssignabilityIssue.errors.txt @@ -0,0 +1,61 @@ +tests/cases/compiler/deeplyNestedAssignabilityIssue.ts:22:17 - error TS2322: Type '{}' is not assignable to type 'A'. + Property 'a' is missing in type '{}'. + +22 thing: {} +   ~~~~~ + + tests/cases/compiler/deeplyNestedAssignabilityIssue.ts:9:17 + 9 thing: A; +    ~~~~~ + The expected type comes from property 'thing' which is declared here on type '{ thing: A; }' +tests/cases/compiler/deeplyNestedAssignabilityIssue.ts:25:17 - error TS2322: Type '{}' is not assignable to type 'A'. + Property 'a' is missing in type '{}'. + +25 another: {} +   ~~~~~~~ + + tests/cases/compiler/deeplyNestedAssignabilityIssue.ts:12:17 + 12 another: A; +    ~~~~~~~ + The expected type comes from property 'another' which is declared here on type '{ another: A; }' + + +==== tests/cases/compiler/deeplyNestedAssignabilityIssue.ts (2 errors) ==== + interface A { + a: number; + } + + interface Large { + something: { + another: { + more: { + thing: A; + } + yetstill: { + another: A; + } + } + } + } + + const x: Large = { + something: { + another: { + more: { + thing: {} + ~~~~~ +!!! error TS2322: Type '{}' is not assignable to type 'A'. +!!! error TS2322: Property 'a' is missing in type '{}'. +!!! related TS6500 tests/cases/compiler/deeplyNestedAssignabilityIssue.ts:9:17: The expected type comes from property 'thing' which is declared here on type '{ thing: A; }' + }, + yetstill: { + another: {} + ~~~~~~~ +!!! error TS2322: Type '{}' is not assignable to type 'A'. +!!! error TS2322: Property 'a' is missing in type '{}'. +!!! related TS6500 tests/cases/compiler/deeplyNestedAssignabilityIssue.ts:12:17: The expected type comes from property 'another' which is declared here on type '{ another: A; }' + } + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/deeplyNestedAssignabilityIssue.js b/tests/baselines/reference/deeplyNestedAssignabilityIssue.js new file mode 100644 index 0000000000000..8d7ed1ec2edd9 --- /dev/null +++ b/tests/baselines/reference/deeplyNestedAssignabilityIssue.js @@ -0,0 +1,45 @@ +//// [deeplyNestedAssignabilityIssue.ts] +interface A { + a: number; +} + +interface Large { + something: { + another: { + more: { + thing: A; + } + yetstill: { + another: A; + } + } + } +} + +const x: Large = { + something: { + another: { + more: { + thing: {} + }, + yetstill: { + another: {} + } + } + } +} + + +//// [deeplyNestedAssignabilityIssue.js] +var x = { + something: { + another: { + more: { + thing: {} + }, + yetstill: { + another: {} + } + } + } +}; diff --git a/tests/baselines/reference/deeplyNestedAssignabilityIssue.symbols b/tests/baselines/reference/deeplyNestedAssignabilityIssue.symbols new file mode 100644 index 0000000000000..b77c310cfc870 --- /dev/null +++ b/tests/baselines/reference/deeplyNestedAssignabilityIssue.symbols @@ -0,0 +1,62 @@ +=== tests/cases/compiler/deeplyNestedAssignabilityIssue.ts === +interface A { +>A : Symbol(A, Decl(deeplyNestedAssignabilityIssue.ts, 0, 0)) + + a: number; +>a : Symbol(A.a, Decl(deeplyNestedAssignabilityIssue.ts, 0, 13)) +} + +interface Large { +>Large : Symbol(Large, Decl(deeplyNestedAssignabilityIssue.ts, 2, 1)) + + something: { +>something : Symbol(Large.something, Decl(deeplyNestedAssignabilityIssue.ts, 4, 17)) + + another: { +>another : Symbol(another, Decl(deeplyNestedAssignabilityIssue.ts, 5, 16)) + + more: { +>more : Symbol(more, Decl(deeplyNestedAssignabilityIssue.ts, 6, 18)) + + thing: A; +>thing : Symbol(thing, Decl(deeplyNestedAssignabilityIssue.ts, 7, 19)) +>A : Symbol(A, Decl(deeplyNestedAssignabilityIssue.ts, 0, 0)) + } + yetstill: { +>yetstill : Symbol(yetstill, Decl(deeplyNestedAssignabilityIssue.ts, 9, 13)) + + another: A; +>another : Symbol(another, Decl(deeplyNestedAssignabilityIssue.ts, 10, 23)) +>A : Symbol(A, Decl(deeplyNestedAssignabilityIssue.ts, 0, 0)) + } + } + } +} + +const x: Large = { +>x : Symbol(x, Decl(deeplyNestedAssignabilityIssue.ts, 17, 5)) +>Large : Symbol(Large, Decl(deeplyNestedAssignabilityIssue.ts, 2, 1)) + + something: { +>something : Symbol(something, Decl(deeplyNestedAssignabilityIssue.ts, 17, 18)) + + another: { +>another : Symbol(another, Decl(deeplyNestedAssignabilityIssue.ts, 18, 16)) + + more: { +>more : Symbol(more, Decl(deeplyNestedAssignabilityIssue.ts, 19, 18)) + + thing: {} +>thing : Symbol(thing, Decl(deeplyNestedAssignabilityIssue.ts, 20, 19)) + + }, + yetstill: { +>yetstill : Symbol(yetstill, Decl(deeplyNestedAssignabilityIssue.ts, 22, 14)) + + another: {} +>another : Symbol(another, Decl(deeplyNestedAssignabilityIssue.ts, 23, 23)) + } + } + } +} + diff --git a/tests/baselines/reference/deeplyNestedAssignabilityIssue.types b/tests/baselines/reference/deeplyNestedAssignabilityIssue.types new file mode 100644 index 0000000000000..4c358bc47a454 --- /dev/null +++ b/tests/baselines/reference/deeplyNestedAssignabilityIssue.types @@ -0,0 +1,69 @@ +=== tests/cases/compiler/deeplyNestedAssignabilityIssue.ts === +interface A { +>A : A + + a: number; +>a : number +} + +interface Large { +>Large : Large + + something: { +>something : { another: { more: { thing: A; }; yetstill: { another: A; }; }; } + + another: { +>another : { more: { thing: A; }; yetstill: { another: A; }; } + + more: { +>more : { thing: A; } + + thing: A; +>thing : A +>A : A + } + yetstill: { +>yetstill : { another: A; } + + another: A; +>another : A +>A : A + } + } + } +} + +const x: Large = { +>x : Large +>Large : Large +>{ something: { another: { more: { thing: {} }, yetstill: { another: {} } } }} : { something: { another: { more: { thing: {}; }; yetstill: { another: {}; }; }; }; } + + something: { +>something : { another: { more: { thing: {}; }; yetstill: { another: {}; }; }; } +>{ another: { more: { thing: {} }, yetstill: { another: {} } } } : { another: { more: { thing: {}; }; yetstill: { another: {}; }; }; } + + another: { +>another : { more: { thing: {}; }; yetstill: { another: {}; }; } +>{ more: { thing: {} }, yetstill: { another: {} } } : { more: { thing: {}; }; yetstill: { another: {}; }; } + + more: { +>more : { thing: {}; } +>{ thing: {} } : { thing: {}; } + + thing: {} +>thing : {} +>{} : {} + + }, + yetstill: { +>yetstill : { another: {}; } +>{ another: {} } : { another: {}; } + + another: {} +>another : {} +>{} : {} + } + } + } +} + diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt index 848093e11616a..78f5720894bb2 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt @@ -3,8 +3,7 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2461: Type 'undefined' is not an array type. tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(4,5): error TS2461: Type 'undefined' is not an array type. -tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,5): error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'. - Type 'number' is not assignable to type 'boolean'. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,51): error TS2322: Type 'number' is not assignable to type 'boolean'. tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(22,5): error TS2322: Type 'number[]' is not assignable to type '[number, number]'. Property '0' is missing in type 'number[]'. tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(23,5): error TS2322: Type 'number[]' is not assignable to type '[string, string]'. @@ -32,9 +31,8 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss // S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, // where N is the numeric index of E in the array assignment pattern, or var [b0, b1, b2]: [number, boolean, string] = [1, 2, "string"]; // Error - ~~~~~~~~~~~~ -!!! error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'. -!!! error TS2322: Type 'number' is not assignable to type 'boolean'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'boolean'. interface J extends Array { 2: number; } diff --git a/tests/baselines/reference/destructuringVariableDeclaration2.errors.txt b/tests/baselines/reference/destructuringVariableDeclaration2.errors.txt index 0b856d8d1f705..104c95bc427c7 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringVariableDeclaration2.errors.txt @@ -1,28 +1,23 @@ -tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,5): error TS2322: Type '{ a1: boolean; a2: number; }' is not assignable to type '{ a1: number; a2: string; }'. - Types of property 'a1' are incompatible. - Type 'boolean' is not assignable to type 'number'. -tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,5): error TS2322: Type '[number, [[boolean]], true]' is not assignable to type '[number, [[string]], boolean]'. - Type '[[boolean]]' is not assignable to type '[[string]]'. - Type '[boolean]' is not assignable to type '[string]'. - Type 'boolean' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,46): error TS2322: Type 'true' is not assignable to type 'number'. +tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,56): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,61): error TS2322: Type 'false' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(19,10): error TS2322: Type 'string[]' is not assignable to type 'number[]'. Type 'string' is not assignable to type 'number'. -==== tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts (3 errors) ==== +==== tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts (4 errors) ==== // The type T associated with a destructuring variable declaration is determined as follows: // If the declaration includes a type annotation, T is that type. var {a1, a2}: { a1: number, a2: string } = { a1: true, a2: 1 } // Error - ~~~~~~~~ -!!! error TS2322: Type '{ a1: boolean; a2: number; }' is not assignable to type '{ a1: number; a2: string; }'. -!!! error TS2322: Types of property 'a1' are incompatible. -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. + ~~ +!!! error TS2322: Type 'true' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts:3:17: The expected type comes from property 'a1' which is declared here on type '{ a1: number; a2: string; }' + ~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts:3:29: The expected type comes from property 'a2' which is declared here on type '{ a1: number; a2: string; }' var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [[false]], true]; // Error - ~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '[number, [[boolean]], true]' is not assignable to type '[number, [[string]], boolean]'. -!!! error TS2322: Type '[[boolean]]' is not assignable to type '[[string]]'. -!!! error TS2322: Type '[boolean]' is not assignable to type '[string]'. -!!! error TS2322: Type 'boolean' is not assignable to type 'string'. + ~~~~~ +!!! error TS2322: Type 'false' is not assignable to type 'string'. // The type T associated with a destructuring variable declaration is determined as follows: // Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt index 5302f856c6f29..0da83390f8e5b 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt @@ -8,9 +8,7 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd Property 'id' is missing in type 'D<{}>'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(42,5): error TS2322: Type 'C' is not assignable to type 'D'. Property 'source' is missing in type 'C'. -tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(43,5): error TS2322: Type '{ id: string; }' is not assignable to type 'I'. - Types of property 'id' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(43,28): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(44,5): error TS2322: Type 'C' is not assignable to type '{ id: string; }'. Types of property 'id' are incompatible. Type 'number' is not assignable to type 'string'. @@ -93,10 +91,9 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd !!! error TS2322: Type 'C' is not assignable to type 'D'. !!! error TS2322: Property 'source' is missing in type 'C'. var anObjectLiteral: I = { id: 'a string' }; - ~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ id: string; }' is not assignable to type 'I'. -!!! error TS2322: Types of property 'id' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. + ~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts:2:5: The expected type comes from property 'id' which is declared here on type 'I' var anOtherObjectLiteral: { id: string } = new C(); ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'C' is not assignable to type '{ id: string; }'. diff --git a/tests/baselines/reference/fuzzy.errors.txt b/tests/baselines/reference/fuzzy.errors.txt index c3f05fd7f2f04..173683297f983 100644 --- a/tests/baselines/reference/fuzzy.errors.txt +++ b/tests/baselines/reference/fuzzy.errors.txt @@ -1,9 +1,7 @@ tests/cases/compiler/fuzzy.ts(13,18): error TS2420: Class 'C' incorrectly implements interface 'I'. Property 'alsoWorks' is missing in type 'C'. -tests/cases/compiler/fuzzy.ts(21,13): error TS2322: Type '{ anything: number; oneI: this; }' is not assignable to type 'R'. - Types of property 'oneI' are incompatible. - Type 'this' is not assignable to type 'I'. - Type 'C' is not assignable to type 'I'. +tests/cases/compiler/fuzzy.ts(21,34): error TS2322: Type 'this' is not assignable to type 'I'. + Type 'C' is not assignable to type 'I'. tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Type '{ oneI: this; }' cannot be converted to type 'R'. Property 'anything' is missing in type '{ oneI: this; }'. @@ -33,11 +31,10 @@ tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Type '{ oneI: this; }' canno doesntWork():R { return { anything:1, oneI:this }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ anything: number; oneI: this; }' is not assignable to type 'R'. -!!! error TS2322: Types of property 'oneI' are incompatible. -!!! error TS2322: Type 'this' is not assignable to type 'I'. -!!! error TS2322: Type 'C' is not assignable to type 'I'. + ~~~~ +!!! error TS2322: Type 'this' is not assignable to type 'I'. +!!! error TS2322: Type 'C' is not assignable to type 'I'. +!!! related TS6500 tests/cases/compiler/fuzzy.ts:10:9: The expected type comes from property 'oneI' which is declared here on type 'R' } worksToo():R { diff --git a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt index 63679ff03b74d..cd035498740d1 100644 --- a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt +++ b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt @@ -1,10 +1,8 @@ -tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(12,5): error TS2322: Type '{ x: A; }' is not assignable to type 'I'. - Types of property 'x' are incompatible. - Type 'A' is not assignable to type 'Comparable'. - Types of property 'compareTo' are incompatible. - Type '(other: number) => number' is not assignable to type '(other: string) => number'. - Types of parameters 'other' and 'other' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(12,23): error TS2322: Type 'A' is not assignable to type 'Comparable'. + Types of property 'compareTo' are incompatible. + Type '(other: number) => number' is not assignable to type '(other: string) => number'. + Types of parameters 'other' and 'other' are incompatible. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(13,5): error TS2322: Type '{ x: A; }' is not assignable to type 'I'. Types of property 'x' are incompatible. Type 'A' is not assignable to type 'Comparable'. @@ -29,14 +27,13 @@ tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(17,5): error TS23 class A implements Comparable { compareTo(other: T) { return 1; } } var z = { x: new A() }; var a1: I = { x: new A() }; - ~~ -!!! error TS2322: Type '{ x: A; }' is not assignable to type 'I'. -!!! error TS2322: Types of property 'x' are incompatible. -!!! error TS2322: Type 'A' is not assignable to type 'Comparable'. -!!! error TS2322: Types of property 'compareTo' are incompatible. -!!! error TS2322: Type '(other: number) => number' is not assignable to type '(other: string) => number'. -!!! error TS2322: Types of parameters 'other' and 'other' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'A' is not assignable to type 'Comparable'. +!!! error TS2322: Types of property 'compareTo' are incompatible. +!!! error TS2322: Type '(other: number) => number' is not assignable to type '(other: string) => number'. +!!! error TS2322: Types of parameters 'other' and 'other' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts:5:5: The expected type comes from property 'x' which is declared here on type 'I' var a2: I = function (): { x: A } { ~~ !!! error TS2322: Type '{ x: A; }' is not assignable to type 'I'. diff --git a/tests/baselines/reference/genericCallWithTupleType.errors.txt b/tests/baselines/reference/genericCallWithTupleType.errors.txt index 65920596c456b..1136022e2fe42 100644 --- a/tests/baselines/reference/genericCallWithTupleType.errors.txt +++ b/tests/baselines/reference/genericCallWithTupleType.errors.txt @@ -3,15 +3,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup Type '4' is not assignable to type '2'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(14,1): error TS2322: Type '{ a: string; }' is not assignable to type 'string | number'. Type '{ a: string; }' is not assignable to type 'number'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,1): error TS2322: Type '[number, string]' is not assignable to type '[string, number]'. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]'. - Type '{}' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,14): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,17): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,14): error TS2322: Type '{}' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,18): error TS2322: Type '{}' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(24,1): error TS2322: Type '[{}]' is not assignable to type '[{}, {}]'. Property '1' is missing in type '[{}]'. -==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (5 errors) ==== +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (7 errors) ==== interface I { tuple1: [T, U]; } @@ -41,13 +41,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup // error i1.tuple1 = [5, "foo"]; - ~~~~~~~~~ -!!! error TS2322: Type '[number, string]' is not assignable to type '[string, number]'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. i1.tuple1 = [{}, {}]; - ~~~~~~~~~ -!!! error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]'. -!!! error TS2322: Type '{}' is not assignable to type 'string'. + ~~ +!!! error TS2322: Type '{}' is not assignable to type 'string'. + ~~ +!!! error TS2322: Type '{}' is not assignable to type 'number'. i2.tuple1 = [{}]; ~~~~~~~~~ !!! error TS2322: Type '[{}]' is not assignable to type '[{}, {}]'. diff --git a/tests/baselines/reference/jsxChildrenGenericContextualTypes.errors.txt b/tests/baselines/reference/jsxChildrenGenericContextualTypes.errors.txt index 632264144dd36..9c9b85fd04d9f 100644 --- a/tests/baselines/reference/jsxChildrenGenericContextualTypes.errors.txt +++ b/tests/baselines/reference/jsxChildrenGenericContextualTypes.errors.txt @@ -1,6 +1,5 @@ -tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(20,31): error TS2326: Types of property 'children' are incompatible. - Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: IntrinsicAttributes & LitProps<"x">) => "x"'. - Type '"y"' is not assignable to type '"x"'. +tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(20,31): error TS2322: Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: IntrinsicAttributes & LitProps<"x">) => "x"'. + Type '"y"' is not assignable to type '"x"'. tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(21,19): error TS2322: Type '{ children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x" | "y">'. Type '{ children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'LitProps<"x" | "y">'. Types of property 'children' are incompatible. @@ -39,10 +38,10 @@ tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(22,21): error TS2322: // Should error const arg = "y"} /> - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'children' are incompatible. -!!! error TS2326: Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: IntrinsicAttributes & LitProps<"x">) => "x"'. -!!! error TS2326: Type '"y"' is not assignable to type '"x"'. + ~~~~~~~~ +!!! error TS2322: Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: IntrinsicAttributes & LitProps<"x">) => "x"'. +!!! error TS2322: Type '"y"' is not assignable to type '"x"'. +!!! related TS6500 tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx:13:34: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & LitProps<"x">' const argchild = {p => "y"} ~~~~~~~ !!! error TS2322: Type '{ children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x" | "y">'. diff --git a/tests/baselines/reference/mappedTypeErrors.errors.txt b/tests/baselines/reference/mappedTypeErrors.errors.txt index f78c32531a486..99d8f9c7ad13d 100644 --- a/tests/baselines/reference/mappedTypeErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeErrors.errors.txt @@ -37,15 +37,9 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(123,12): error TS2345: Type 'undefined' is not assignable to type 'string'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(124,14): error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(128,5): error TS2322: Type '{ a: string; }' is not assignable to type 'T2'. - Types of property 'a' are incompatible. - Type 'string' is not assignable to type 'number | undefined'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(129,5): error TS2322: Type '{ a: string; }' is not assignable to type 'Partial'. - Types of property 'a' are incompatible. - Type 'string' is not assignable to type 'number | undefined'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(130,5): error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'. - Types of property 'a' are incompatible. - Type 'string' is not assignable to type 'number | undefined'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(128,16): error TS2322: Type 'string' is not assignable to type 'number | undefined'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(129,25): error TS2322: Type 'string' is not assignable to type 'number | undefined'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(130,39): error TS2322: Type 'string' is not assignable to type 'number | undefined'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,16): error TS2322: Type 'T' is not assignable to type 'string | number | symbol'. Type 'T' is not assignable to type 'symbol'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536: Type 'P' cannot be used to index type 'T'. @@ -239,20 +233,17 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536: type T2 = { a?: number, [key: string]: any }; let x1: T2 = { a: 'no' }; // Error - ~~ -!!! error TS2322: Type '{ a: string; }' is not assignable to type 'T2'. -!!! error TS2322: Types of property 'a' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. +!!! related TS6500 tests/cases/conformance/types/mapped/mappedTypeErrors.ts:126:13: The expected type comes from property 'a' which is declared here on type 'T2' let x2: Partial = { a: 'no' }; // Error - ~~ -!!! error TS2322: Type '{ a: string; }' is not assignable to type 'Partial'. -!!! error TS2322: Types of property 'a' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. +!!! related TS6500 tests/cases/conformance/types/mapped/mappedTypeErrors.ts:126:13: The expected type comes from property 'a' which is declared here on type 'Partial' let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error - ~~ -!!! error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'. -!!! error TS2322: Types of property 'a' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. +!!! related TS6500 tests/cases/conformance/types/mapped/mappedTypeErrors.ts:126:13: The expected type comes from property 'a' which is declared here on type '{ [x: string]: any; a?: number | undefined; }' // Repro from #13044 diff --git a/tests/baselines/reference/nestedFreshLiteral.errors.txt b/tests/baselines/reference/nestedFreshLiteral.errors.txt index 5eea71dba81a9..fc7fc8976990f 100644 --- a/tests/baselines/reference/nestedFreshLiteral.errors.txt +++ b/tests/baselines/reference/nestedFreshLiteral.errors.txt @@ -1,9 +1,7 @@ -tests/cases/compiler/nestedFreshLiteral.ts(12,21): error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'. - Types of property 'nested' are incompatible. - Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'. - Types of property 'prop' are incompatible. - Type '{ colour: string; }' is not assignable to type 'CSSProps'. - Object literal may only specify known properties, but 'colour' does not exist in type 'CSSProps'. Did you mean to write 'color'? +tests/cases/compiler/nestedFreshLiteral.ts(12,21): error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'. + Types of property 'prop' are incompatible. + Type '{ colour: string; }' is not assignable to type 'CSSProps'. + Object literal may only specify known properties, but 'colour' does not exist in type 'CSSProps'. Did you mean to write 'color'? ==== tests/cases/compiler/nestedFreshLiteral.ts (1 errors) ==== @@ -20,10 +18,9 @@ tests/cases/compiler/nestedFreshLiteral.ts(12,21): error TS2322: Type '{ nested: let stylen: NestedCSSProps = { nested: { prop: { colour: 'red' } } ~~~~~~~~~~~~~ -!!! error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'. -!!! error TS2322: Types of property 'nested' are incompatible. -!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'. -!!! error TS2322: Types of property 'prop' are incompatible. -!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'CSSProps'. -!!! error TS2322: Object literal may only specify known properties, but 'colour' does not exist in type 'CSSProps'. Did you mean to write 'color'? +!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'. +!!! error TS2322: Types of property 'prop' are incompatible. +!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'CSSProps'. +!!! error TS2322: Object literal may only specify known properties, but 'colour' does not exist in type 'CSSProps'. Did you mean to write 'color'? +!!! related TS6500 tests/cases/compiler/nestedFreshLiteral.ts:5:3: The expected type comes from property 'nested' which is declared here on type 'NestedCSSProps' } \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveAsProperty.errors.txt b/tests/baselines/reference/nonPrimitiveAsProperty.errors.txt index 8d4042c92f052..5c3e27176bfe2 100644 --- a/tests/baselines/reference/nonPrimitiveAsProperty.errors.txt +++ b/tests/baselines/reference/nonPrimitiveAsProperty.errors.txt @@ -1,6 +1,4 @@ -tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts(7,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'WithNonPrimitive'. - Types of property 'foo' are incompatible. - Type 'string' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts(7,28): error TS2322: Type 'string' is not assignable to type 'object'. ==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts (1 errors) ==== @@ -11,8 +9,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts(7,5): error var a: WithNonPrimitive = { foo: {bar: "bar"} }; var b: WithNonPrimitive = {foo: "bar"}; // expect error - ~ -!!! error TS2322: Type '{ foo: string; }' is not assignable to type 'WithNonPrimitive'. -!!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'object'. + ~~~ +!!! error TS2322: Type 'string' is not assignable to type 'object'. +!!! related TS6500 tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts:2:5: The expected type comes from property 'foo' which is declared here on type 'WithNonPrimitive' \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt index 1c25a4a03822a..82a5659c5b0a5 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt @@ -5,8 +5,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(79,5): error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. - Object literal may only specify known properties, and 'a' does not exist in type '{ [x: number]: string; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(85,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(88,9): error TS2304: Cannot find name 'Myn'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -106,15 +105,15 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo // error var b: { [x: number]: string; } = { a: '', - ~~~~~ -!!! error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. -!!! error TS2322: Object literal may only specify known properties, and 'a' does not exist in type '{ [x: number]: string; }'. b: 1, c: () => { }, "d": '', "e": 1, 1.0: '', 2.0: 1, + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature. "3.0": '', "4.0": 1, f: null, diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt index b327c613f30a4..0807af21960a0 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt @@ -1,8 +1,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(16,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(25,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(34,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(44,5): error TS2322: Type '{ 1.0: A; 2.0: B; "2.5": B; 3.0: number; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. - Object literal may only specify known properties, and '"4.0"' does not exist in type '{ [x: number]: A; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(43,5): error TS2322: Type 'number' is not assignable to type 'A'. ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts (4 errors) ==== @@ -55,8 +54,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo 2.0: new B(), "2.5": new B(), 3.0: 1, + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'A'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts:39:10: The expected type comes from this index signature. "4.0": '' - ~~~~~~~~~ -!!! error TS2322: Type '{ 1.0: A; 2.0: B; "2.5": B; 3.0: number; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. -!!! error TS2322: Object literal may only specify known properties, and '"4.0"' does not exist in type '{ [x: number]: A; }'. } \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralExcessProperties.errors.txt b/tests/baselines/reference/objectLiteralExcessProperties.errors.txt index 0c5909dc4ed45..fa76abac0dec7 100644 --- a/tests/baselines/reference/objectLiteralExcessProperties.errors.txt +++ b/tests/baselines/reference/objectLiteralExcessProperties.errors.txt @@ -19,10 +19,8 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(23,29): error TS2322: Type Object literal may only specify known properties, and 'couleur' does not exist in type 'Cover | Cover[]'. tests/cases/compiler/objectLiteralExcessProperties.ts(25,27): error TS2322: Type '{ forewarned: string; }' is not assignable to type 'Book | Book[]'. Object literal may only specify known properties, and 'forewarned' does not exist in type 'Book | Book[]'. -tests/cases/compiler/objectLiteralExcessProperties.ts(33,27): error TS2322: Type '{ 0: { colour: string; }; }' is not assignable to type 'Indexed'. - Property '0' is incompatible with index signature. - Type '{ colour: string; }' is not assignable to type 'Cover'. - Object literal may only specify known properties, but 'colour' does not exist in type 'Cover'. Did you mean to write 'color'? +tests/cases/compiler/objectLiteralExcessProperties.ts(33,27): error TS2322: Type '{ colour: string; }' is not assignable to type 'Cover'. + Object literal may only specify known properties, but 'colour' does not exist in type 'Cover'. Did you mean to write 'color'? ==== tests/cases/compiler/objectLiteralExcessProperties.ts (10 errors) ==== @@ -90,8 +88,7 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(33,27): error TS2322: Type var b11: Indexed = { 0: { colour: "blue" } }; // nested object literal still errors ~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ 0: { colour: string; }; }' is not assignable to type 'Indexed'. -!!! error TS2322: Property '0' is incompatible with index signature. -!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'Cover'. -!!! error TS2322: Object literal may only specify known properties, but 'colour' does not exist in type 'Cover'. Did you mean to write 'color'? +!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'Cover'. +!!! error TS2322: Object literal may only specify known properties, but 'colour' does not exist in type 'Cover'. Did you mean to write 'color'? +!!! related TS6501 tests/cases/compiler/objectLiteralExcessProperties.ts:28:5: The expected type comes from this index signature. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt index 53abb5b7658d1..636f098158b83 100644 --- a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt @@ -1,10 +1,6 @@ -tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ x: B; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. - Property '0' is incompatible with index signature. - Type 'A' is not assignable to type 'B'. - Property 'y' is missing in type 'A'. -tests/cases/compiler/objectLiteralIndexerErrors.ts(14,1): error TS2322: Type '{ x: any; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. - Property '0' is incompatible with index signature. - Type 'A' is not assignable to type 'B'. +tests/cases/compiler/objectLiteralIndexerErrors.ts(13,54): error TS2322: Type 'A' is not assignable to type 'B'. + Property 'y' is missing in type 'A'. +tests/cases/compiler/objectLiteralIndexerErrors.ts(14,14): error TS2322: Type 'A' is not assignable to type 'B'. ==== tests/cases/compiler/objectLiteralIndexerErrors.ts (2 errors) ==== @@ -21,13 +17,11 @@ tests/cases/compiler/objectLiteralIndexerErrors.ts(14,1): error TS2322: Type '{ var c: any; var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A - ~~ -!!! error TS2322: Type '{ x: B; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. -!!! error TS2322: Property '0' is incompatible with index signature. -!!! error TS2322: Type 'A' is not assignable to type 'B'. -!!! error TS2322: Property 'y' is missing in type 'A'. + ~ +!!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: Property 'y' is missing in type 'A'. +!!! related TS6501 tests/cases/compiler/objectLiteralIndexerErrors.ts:13:26: The expected type comes from this index signature. o1 = { x: c, 0: a }; // string indexer is any, number indexer is A - ~~ -!!! error TS2322: Type '{ x: any; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. -!!! error TS2322: Property '0' is incompatible with index signature. -!!! error TS2322: Type 'A' is not assignable to type 'B'. \ No newline at end of file + ~ +!!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! related TS6501 tests/cases/compiler/objectLiteralIndexerErrors.ts:13:26: The expected type comes from this index signature. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralNormalization.errors.txt b/tests/baselines/reference/objectLiteralNormalization.errors.txt index 6bdc9b955e324..3cdda885277eb 100644 --- a/tests/baselines/reference/objectLiteralNormalization.errors.txt +++ b/tests/baselines/reference/objectLiteralNormalization.errors.txt @@ -1,6 +1,4 @@ -tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(7,1): error TS2322: Type '{ a: number; b: number; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'. - Type '{ a: number; b: number; }' is not assignable to type '{ a: number; b: string; c: boolean; }'. - Property 'c' is missing in type '{ a: number; b: number; }'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(7,14): error TS2322: Type 'number' is not assignable to type 'string | undefined'. tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(8,1): error TS2322: Type '{ b: string; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'. Type '{ b: string; }' is not assignable to type '{ a: number; b: string; c: boolean; }'. Property 'a' is missing in type '{ b: string; }'. @@ -25,10 +23,9 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts a1.c; // boolean | undefined a1 = { a: 1 }; a1 = { a: 0, b: 0 }; // Error - ~~ -!!! error TS2322: Type '{ a: number; b: number; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'. -!!! error TS2322: Type '{ a: number; b: number; }' is not assignable to type '{ a: number; b: string; c: boolean; }'. -!!! error TS2322: Property 'c' is missing in type '{ a: number; b: number; }'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string | undefined'. +!!! related TS6500 tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts:2:47: The expected type comes from property 'b' which is declared here on type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }' a1 = { b: "y" }; // Error ~~ !!! error TS2322: Type '{ b: string; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'. diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt index c0e6e10d8de3c..e36842e4f6982 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt @@ -1,14 +1,13 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(4,43): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,72): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ id: string; name: number; }'. - Types of property 'id' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,81): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,87): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(8,5): error TS2345: Argument of type '{ name: string; id: number; }' is not assignable to parameter of type '{ name: string; id: boolean; }'. Types of property 'id' are incompatible. Type 'number' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts (3 errors) ==== +==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts (4 errors) ==== var id: number = 10000; var name: string = "my name"; @@ -18,10 +17,12 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr !!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. var person1: { name, id }; // ok function foo(name: string, id: number): { id: string, name: number } { return { name, id }; } // error - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ id: string; name: number; }'. -!!! error TS2322: Types of property 'id' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts:6:55: The expected type comes from property 'name' which is declared here on type '{ id: string; name: number; }' + ~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts:6:43: The expected type comes from property 'id' which is declared here on type '{ id: string; name: number; }' function bar(obj: { name: string; id: boolean }) { } bar({ name, id }); // error ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt index 6b227fce71086..235276bc6e5b6 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt @@ -1,14 +1,13 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(4,43): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,72): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. - Types of property 'name' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,81): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,87): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(8,5): error TS2322: Type '{ name: number; id: string; }' is not assignable to type '{ name: string; id: number; }'. Types of property 'name' are incompatible. Type 'number' is not assignable to type 'string'. -==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts (3 errors) ==== +==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts (4 errors) ==== var id: number = 10000; var name: string = "my name"; @@ -17,10 +16,12 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. !!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. function bar(name: string, id: number): { name: number, id: string } { return { name, id }; } // error - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. -!!! error TS2322: Types of property 'name' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. + ~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts:5:43: The expected type comes from property 'name' which is declared here on type '{ name: number; id: string; }' + ~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts:5:57: The expected type comes from property 'id' which is declared here on type '{ name: number; id: string; }' function foo(name: string, id: number): { name: string, id: number } { return { name, id }; } // error var person1: { name, id }; // ok var person2: { name: string, id: number } = bar("hello", 5); diff --git a/tests/baselines/reference/objectLiteralWithNumericPropertyName.errors.txt b/tests/baselines/reference/objectLiteralWithNumericPropertyName.errors.txt index 3f499b0a580ac..cdae8ae86bf04 100644 --- a/tests/baselines/reference/objectLiteralWithNumericPropertyName.errors.txt +++ b/tests/baselines/reference/objectLiteralWithNumericPropertyName.errors.txt @@ -1,6 +1,4 @@ -tests/cases/compiler/objectLiteralWithNumericPropertyName.ts(4,5): error TS2322: Type '{ 0: number; }' is not assignable to type 'A'. - Types of property '0' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/compiler/objectLiteralWithNumericPropertyName.ts(5,5): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/objectLiteralWithNumericPropertyName.ts (1 errors) ==== @@ -8,10 +6,9 @@ tests/cases/compiler/objectLiteralWithNumericPropertyName.ts(4,5): error TS2322: 0: string; } var x: A = { - ~ -!!! error TS2322: Type '{ 0: number; }' is not assignable to type 'A'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. 0: 3 + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/compiler/objectLiteralWithNumericPropertyName.ts:2:5: The expected type comes from property '0' which is declared here on type 'A' }; \ No newline at end of file diff --git a/tests/baselines/reference/objectSpreadStrictNull.errors.txt b/tests/baselines/reference/objectSpreadStrictNull.errors.txt index 791b5419eb1bc..9ebc4a5faaa45 100644 --- a/tests/baselines/reference/objectSpreadStrictNull.errors.txt +++ b/tests/baselines/reference/objectSpreadStrictNull.errors.txt @@ -10,9 +10,7 @@ tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(18,9): error TS23 Types of property 'sn' are incompatible. Type 'string | number | undefined' is not assignable to type 'string | number | boolean'. Type 'undefined' is not assignable to type 'string | number | boolean'. -tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(28,7): error TS2322: Type '{ title: undefined; yearReleased: number; }' is not assignable to type 'Movie'. - Types of property 'title' are incompatible. - Type 'undefined' is not assignable to type 'string'. +tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(28,26): error TS2322: Type 'undefined' is not assignable to type 'string'. tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(42,5): error TS2322: Type '{ foo: number | undefined; bar: string | undefined; }' is not assignable to type 'Fields'. Types of property 'foo' are incompatible. Type 'number | undefined' is not assignable to type 'number'. @@ -63,10 +61,9 @@ tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(42,5): error TS23 const m = { title: "The Matrix", yearReleased: 1999 }; // should error here because title: undefined is not assignable to string const x: Movie = { ...m, title: undefined }; - ~ -!!! error TS2322: Type '{ title: undefined; yearReleased: number; }' is not assignable to type 'Movie'. -!!! error TS2322: Types of property 'title' are incompatible. -!!! error TS2322: Type 'undefined' is not assignable to type 'string'. + ~~~~~ +!!! error TS2322: Type 'undefined' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/types/spread/objectSpreadStrictNull.ts:22:5: The expected type comes from property 'title' which is declared here on type 'Movie' interface Fields { foo: number; diff --git a/tests/baselines/reference/returnInConstructor1.errors.txt b/tests/baselines/reference/returnInConstructor1.errors.txt index d4fb6a0b50e90..4bb776dc4a5f8 100644 --- a/tests/baselines/reference/returnInConstructor1.errors.txt +++ b/tests/baselines/reference/returnInConstructor1.errors.txt @@ -2,10 +2,8 @@ tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2322: Type '1' is no tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2322: Type '"test"' is not assignable to type 'D'. tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. -tests/cases/compiler/returnInConstructor1.ts(39,9): error TS2322: Type '{ foo: number; }' is not assignable to type 'F'. - Types of property 'foo' are incompatible. - Type 'number' is not assignable to type 'string'. tests/cases/compiler/returnInConstructor1.ts(39,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. +tests/cases/compiler/returnInConstructor1.ts(39,18): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2322: Type 'G' is not assignable to type 'H'. Types of property 'foo' are incompatible. Type '() => void' is not assignable to type 'string'. @@ -61,11 +59,10 @@ tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of constructor() { return { foo: 1 }; //error ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ foo: number; }' is not assignable to type 'F'. -!!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. - ~~~~~~~~~~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/compiler/returnInConstructor1.ts:37:12: The expected type comes from property 'foo' which is declared here on type 'F' } } diff --git a/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring.errors.txt b/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring.errors.txt index 1225f9ab2ce60..67ecf2085616d 100644 --- a/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring.errors.txt +++ b/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring.errors.txt @@ -6,19 +6,18 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(70,5): error tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(75,8): error TS2322: Type '5' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(75,8): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(80,5): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(80,13): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. - Types of property 'x' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(80,20): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,8): error TS2322: Type '5' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,8): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,19): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. Types of property 'x' are incompatible. Type 'number' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,26): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,12): error TS2304: Cannot find name 's'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): error TS1312: '=' can only be used in an object literal property inside a destructuring assignment. -==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts (14 errors) ==== +==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts (15 errors) ==== (function() { var s0; for ({ s0 = 5 } of [{ s0: 1 }]) { @@ -115,10 +114,9 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): err ({ y2 = 5, y3 = { x: 1 } } = {}) ~~ !!! error TS2322: Type '5' is not assignable to type 'string'. - ~~ -!!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. -!!! error TS2322: Types of property 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts:79:24: The expected type comes from property 'x' which is declared here on type '{ x: string; }' }); (function() { @@ -132,6 +130,9 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): err !!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. !!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts:84:24: The expected type comes from property 'x' which is declared here on type '{ x: string; }' }); (function() { diff --git a/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring_ES6.errors.txt b/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring_ES6.errors.txt index acff36b6d1f3f..c5937c9d6c47e 100644 --- a/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring_ES6.errors.txt +++ b/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring_ES6.errors.txt @@ -6,19 +6,18 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(70,5): e tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(75,8): error TS2322: Type '5' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(75,8): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(80,5): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(80,13): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. - Types of property 'x' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(80,20): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,8): error TS2322: Type '5' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,8): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,19): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. Types of property 'x' are incompatible. Type 'number' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,26): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,12): error TS2304: Cannot find name 's'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14): error TS1312: '=' can only be used in an object literal property inside a destructuring assignment. -==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts (14 errors) ==== +==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts (15 errors) ==== (function() { var s0; for ({ s0 = 5 } of [{ s0: 1 }]) { @@ -115,10 +114,9 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14): ({ y2 = 5, y3 = { x: 1 } } = {}) ~~ !!! error TS2322: Type '5' is not assignable to type 'string'. - ~~ -!!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. -!!! error TS2322: Types of property 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts:79:24: The expected type comes from property 'x' which is declared here on type '{ x: string; }' }); (function() { @@ -132,6 +130,9 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14): !!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. !!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts:84:24: The expected type comes from property 'x' which is declared here on type '{ x: string; }' }); (function() { diff --git a/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.errors.txt b/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.errors.txt new file mode 100644 index 0000000000000..b2f976e7ab947 --- /dev/null +++ b/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts(16,17): error TS2322: Type 'number' is not assignable to type 'string'. + + +==== tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts (1 errors) ==== + interface Foo { + a: { + b: { + c: { + d: string + } + } + } + } + + let q: Foo["a"] | undefined; + const x: Foo = (void 0, { + a: q = { + b: ({ + c: { + d: 42 + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts:5:17: The expected type comes from property 'd' which is declared here on type '{ d: string; }' + } + }) + } + }); + \ No newline at end of file diff --git a/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.js b/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.js new file mode 100644 index 0000000000000..eea1e1b79ea3a --- /dev/null +++ b/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.js @@ -0,0 +1,34 @@ +//// [slightlyIndirectedDeepObjectLiteralElaborations.ts] +interface Foo { + a: { + b: { + c: { + d: string + } + } + } +} + +let q: Foo["a"] | undefined; +const x: Foo = (void 0, { + a: q = { + b: ({ + c: { + d: 42 + } + }) + } +}); + + +//// [slightlyIndirectedDeepObjectLiteralElaborations.js] +var q; +var x = (void 0, { + a: q = { + b: ({ + c: { + d: 42 + } + }) + } +}); diff --git a/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.symbols b/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.symbols new file mode 100644 index 0000000000000..49c853a20aaf4 --- /dev/null +++ b/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.symbols @@ -0,0 +1,45 @@ +=== tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts === +interface Foo { +>Foo : Symbol(Foo, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 0, 0)) + + a: { +>a : Symbol(Foo.a, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 0, 15)) + + b: { +>b : Symbol(b, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 1, 8)) + + c: { +>c : Symbol(c, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 2, 12)) + + d: string +>d : Symbol(d, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 3, 16)) + } + } + } +} + +let q: Foo["a"] | undefined; +>q : Symbol(q, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 10, 3)) +>Foo : Symbol(Foo, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 0, 0)) + +const x: Foo = (void 0, { +>x : Symbol(x, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 11, 5)) +>Foo : Symbol(Foo, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 0, 0)) + + a: q = { +>a : Symbol(a, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 11, 25)) +>q : Symbol(q, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 10, 3)) + + b: ({ +>b : Symbol(b, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 12, 12)) + + c: { +>c : Symbol(c, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 13, 13)) + + d: 42 +>d : Symbol(d, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 14, 16)) + } + }) + } +}); + diff --git a/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.types b/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.types new file mode 100644 index 0000000000000..34bf86d8d9ab6 --- /dev/null +++ b/tests/baselines/reference/slightlyIndirectedDeepObjectLiteralElaborations.types @@ -0,0 +1,56 @@ +=== tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts === +interface Foo { +>Foo : Foo + + a: { +>a : { b: { c: { d: string; }; }; } + + b: { +>b : { c: { d: string; }; } + + c: { +>c : { d: string; } + + d: string +>d : string + } + } + } +} + +let q: Foo["a"] | undefined; +>q : { b: { c: { d: string; }; }; } +>Foo : Foo + +const x: Foo = (void 0, { +>x : Foo +>Foo : Foo +>(void 0, { a: q = { b: ({ c: { d: 42 } }) }}) : { a: { b: { c: { d: number; }; }; }; } +>void 0, { a: q = { b: ({ c: { d: 42 } }) }} : { a: { b: { c: { d: number; }; }; }; } +>void 0 : undefined +>0 : 0 +>{ a: q = { b: ({ c: { d: 42 } }) }} : { a: { b: { c: { d: number; }; }; }; } + + a: q = { +>a : { b: { c: { d: number; }; }; } +>q = { b: ({ c: { d: 42 } }) } : { b: { c: { d: number; }; }; } +>q : { b: { c: { d: string; }; }; } +>{ b: ({ c: { d: 42 } }) } : { b: { c: { d: number; }; }; } + + b: ({ +>b : { c: { d: number; }; } +>({ c: { d: 42 } }) : { c: { d: number; }; } +>{ c: { d: 42 } } : { c: { d: number; }; } + + c: { +>c : { d: number; } +>{ d: 42 } : { d: number; } + + d: 42 +>d : number +>42 : 42 + } + }) + } +}); + diff --git a/tests/baselines/reference/spreadUnion3.errors.txt b/tests/baselines/reference/spreadUnion3.errors.txt index b1fa3316d34e0..88aa12c708fb8 100644 --- a/tests/baselines/reference/spreadUnion3.errors.txt +++ b/tests/baselines/reference/spreadUnion3.errors.txt @@ -1,7 +1,4 @@ -tests/cases/conformance/types/spread/spreadUnion3.ts(2,5): error TS2322: Type '{ y: number; } | { y: string; }' is not assignable to type '{ y: string; }'. - Type '{ y: number; }' is not assignable to type '{ y: string; }'. - Types of property 'y' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/spread/spreadUnion3.ts(2,14): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/spread/spreadUnion3.ts(9,23): error TS2339: Property 'a' does not exist on type '{}'. tests/cases/conformance/types/spread/spreadUnion3.ts(17,11): error TS2698: Spread types may only be created from object types. tests/cases/conformance/types/spread/spreadUnion3.ts(18,11): error TS2698: Spread types may only be created from object types. @@ -10,11 +7,9 @@ tests/cases/conformance/types/spread/spreadUnion3.ts(18,11): error TS2698: Sprea ==== tests/cases/conformance/types/spread/spreadUnion3.ts (4 errors) ==== function f(x: { y: string } | undefined): { y: string } { return { y: 123, ...x } // y: string | number - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ y: number; } | { y: string; }' is not assignable to type '{ y: string; }'. -!!! error TS2322: Type '{ y: number; }' is not assignable to type '{ y: string; }'. -!!! error TS2322: Types of property 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/types/spread/spreadUnion3.ts:1:45: The expected type comes from property 'y' which is declared here on type '{ y: string; }' } f(undefined) diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt index 2a847e98b7495..00fc13f186eec 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt @@ -22,14 +22,18 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(71,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(74,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. - Property 'b' is incompatible with index signature. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(80,5): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(81,5): error TS2322: Type '() => void' is not assignable to type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(83,5): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(85,5): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(87,5): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(88,5): error TS2322: Type 'MyString' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(94,5): error TS2322: Type '() => string' is not assignable to type 'string'. -==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts (27 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts (33 errors) ==== // String indexer types constrain the types of named properties in their containing type interface MyString extends String { @@ -156,20 +160,34 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: string; } = { - ~ -!!! error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. -!!! error TS2322: Property 'b' is incompatible with index signature. -!!! error TS2322: Type 'number' is not assignable to type 'string'. a: '', b: 1, + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature. c: () => { }, + ~ +!!! error TS2322: Type '() => void' is not assignable to type 'string'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature. "d": '', "e": 1, + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature. 1.0: '', 2.0: 1, + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature. "3.0": '', "4.0": 1, + ~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature. f: null, + ~ +!!! error TS2322: Type 'MyString' is not assignable to type 'string'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature. get X() { ~ @@ -180,6 +198,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. foo() { + ~~~ +!!! error TS2322: Type '() => string' is not assignable to type 'string'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature. return ''; } } \ No newline at end of file diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt index 891da8c8ce9db..3a33fe7405631 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt @@ -4,13 +4,13 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(24,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(31,5): error TS2411: Property 'c' of type 'number' is not assignable to string index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(32,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. - Property 'a' is incompatible with index signature. - Type 'typeof A' is not assignable to type 'A'. - Property 'foo' is missing in type 'typeof A'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(37,5): error TS2322: Type 'typeof A' is not assignable to type 'A'. + Property 'foo' is missing in type 'typeof A'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(38,5): error TS2322: Type 'typeof B' is not assignable to type 'A'. + Property 'foo' is missing in type 'typeof B'. -==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts (7 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts (8 errors) ==== // String indexer providing a constraint of a user defined type class A { @@ -59,11 +59,14 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: A } = { - ~ -!!! error TS2322: Type '{ a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. -!!! error TS2322: Property 'a' is incompatible with index signature. -!!! error TS2322: Type 'typeof A' is not assignable to type 'A'. -!!! error TS2322: Property 'foo' is missing in type 'typeof A'. a: A, + ~ +!!! error TS2322: Type 'typeof A' is not assignable to type 'A'. +!!! error TS2322: Property 'foo' is missing in type 'typeof A'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts:36:10: The expected type comes from this index signature. b: B + ~ +!!! error TS2322: Type 'typeof B' is not assignable to type 'A'. +!!! error TS2322: Property 'foo' is missing in type 'typeof B'. +!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts:36:10: The expected type comes from this index signature. } \ No newline at end of file diff --git a/tests/baselines/reference/tsxAttributeErrors.errors.txt b/tests/baselines/reference/tsxAttributeErrors.errors.txt index 081f7b4fd6b98..b51149e701877 100644 --- a/tests/baselines/reference/tsxAttributeErrors.errors.txt +++ b/tests/baselines/reference/tsxAttributeErrors.errors.txt @@ -1,7 +1,5 @@ -tests/cases/conformance/jsx/tsxAttributeErrors.tsx(14,6): error TS2326: Types of property 'text' are incompatible. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/tsxAttributeErrors.tsx(17,6): error TS2326: Types of property 'width' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsx/tsxAttributeErrors.tsx(14,6): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/tsxAttributeErrors.tsx(17,6): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/jsx/tsxAttributeErrors.tsx(21,2): error TS2322: Type '{ text: number; }' is not assignable to type '{ text?: string; width?: number; }'. Types of property 'text' are incompatible. Type 'number' is not assignable to type 'string'. @@ -22,15 +20,15 @@ tests/cases/conformance/jsx/tsxAttributeErrors.tsx(21,2): error TS2322: Type '{ // Error, number is not assignable to string
; - ~~~~~~~~~ -!!! error TS2326: Types of property 'text' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/tsxAttributeErrors.tsx:5:4: The expected type comes from property 'text' which is declared here on type '{ text?: string; width?: number; }' // Error, string is not assignable to number
; - ~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'width' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number'. + ~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/jsx/tsxAttributeErrors.tsx:6:4: The expected type comes from property 'width' which is declared here on type '{ text?: string; width?: number; }' // Error, number is not assignable to string var attribs = { text: 100 }; diff --git a/tests/baselines/reference/tsxAttributeResolution1.errors.txt b/tests/baselines/reference/tsxAttributeResolution1.errors.txt index ab881bfa6f902..2a9cf3bfe0e13 100644 --- a/tests/baselines/reference/tsxAttributeResolution1.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution1.errors.txt @@ -1,14 +1,11 @@ -tests/cases/conformance/jsx/file.tsx(23,8): error TS2326: Types of property 'x' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(23,8): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/jsx/file.tsx(24,2): error TS2559: Type '{ y: number; }' has no properties in common with type 'Attribs1'. tests/cases/conformance/jsx/file.tsx(25,2): error TS2559: Type '{ y: string; }' has no properties in common with type 'Attribs1'. -tests/cases/conformance/jsx/file.tsx(26,8): error TS2326: Types of property 'x' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(26,8): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/jsx/file.tsx(27,2): error TS2559: Type '{ var: string; }' has no properties in common with type 'Attribs1'. tests/cases/conformance/jsx/file.tsx(29,2): error TS2322: Type '{}' is not assignable to type '{ reqd: string; }'. Property 'reqd' is missing in type '{}'. -tests/cases/conformance/jsx/file.tsx(30,8): error TS2326: Types of property 'reqd' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(30,8): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsx/file.tsx (7 errors) ==== @@ -35,9 +32,9 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2326: Types of property 'req // Errors ; // Error, '0' is not number - ~~~~~~~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:10:2: The expected type comes from property 'x' which is declared here on type 'Attribs1' ; // Error, no property "y" ~~~~~ !!! error TS2559: Type '{ y: number; }' has no properties in common with type 'Attribs1'. @@ -45,9 +42,9 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2326: Types of property 'req ~~~~~ !!! error TS2559: Type '{ y: string; }' has no properties in common with type 'Attribs1'. ; // Error, "32" is not number - ~~~~~~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:10:2: The expected type comes from property 'x' which is declared here on type 'Attribs1' ; // Error, no 'var' property ~~~~~ !!! error TS2559: Type '{ var: string; }' has no properties in common with type 'Attribs1'. @@ -57,9 +54,9 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2326: Types of property 'req !!! error TS2322: Type '{}' is not assignable to type '{ reqd: string; }'. !!! error TS2322: Property 'reqd' is missing in type '{}'. ; // Error, reqd is not string - ~~~~~~~~~ -!!! error TS2326: Types of property 'reqd' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:12: The expected type comes from property 'reqd' which is declared here on type '{ reqd: string; }' // Should be OK ; diff --git a/tests/baselines/reference/tsxAttributeResolution10.errors.txt b/tests/baselines/reference/tsxAttributeResolution10.errors.txt index 2da8c1466b078..ce30843d88751 100644 --- a/tests/baselines/reference/tsxAttributeResolution10.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution10.errors.txt @@ -1,5 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(11,14): error TS2326: Types of property 'bar' are incompatible. - Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/jsx/file.tsx(11,14): error TS2322: Type 'string' is not assignable to type 'boolean'. ==== tests/cases/conformance/jsx/react.d.ts (0 errors) ==== @@ -24,9 +23,9 @@ tests/cases/conformance/jsx/file.tsx(11,14): error TS2326: Types of property 'ba // Should be an error ; - ~~~~~~~~~~~ -!!! error TS2326: Types of property 'bar' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'boolean'. + ~~~ +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. +!!! related TS6501 tests/cases/conformance/jsx/file.tsx:6:4: The expected type comes from this index signature. // Should be OK ; diff --git a/tests/baselines/reference/tsxAttributeResolution14.errors.txt b/tests/baselines/reference/tsxAttributeResolution14.errors.txt index eefddf7d2a5c5..71b5e329f4868 100644 --- a/tests/baselines/reference/tsxAttributeResolution14.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution14.errors.txt @@ -1,7 +1,5 @@ -tests/cases/conformance/jsx/file.tsx(13,28): error TS2326: Types of property 'primaryText' are incompatible. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(15,28): error TS2326: Types of property 'justRandomProp1' are incompatible. - Type 'boolean' is not assignable to type 'string | number'. +tests/cases/conformance/jsx/file.tsx(13,28): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'true' is not assignable to type 'string | number'. ==== tests/cases/conformance/jsx/react.d.ts (0 errors) ==== @@ -27,14 +25,14 @@ tests/cases/conformance/jsx/file.tsx(15,28): error TS2326: Types of property 'ju return (
// error - ~~~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'primaryText' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:2:3: The expected type comes from property 'primaryText' which is declared here on type 'IProps' // ok // error - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'justRandomProp1' are incompatible. -!!! error TS2326: Type 'boolean' is not assignable to type 'string | number'. + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'true' is not assignable to type 'string | number'. +!!! related TS6501 tests/cases/conformance/jsx/file.tsx:3:3: The expected type comes from this index signature.
) } \ No newline at end of file diff --git a/tests/baselines/reference/tsxAttributeResolution3.errors.txt b/tests/baselines/reference/tsxAttributeResolution3.errors.txt index 94205714803b2..be963c16e1c59 100644 --- a/tests/baselines/reference/tsxAttributeResolution3.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution3.errors.txt @@ -3,8 +3,7 @@ tests/cases/conformance/jsx/file.tsx(19,2): error TS2322: Type '{ x: number; }' Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(23,2): error TS2322: Type '{ y: number; }' is not assignable to type 'Attribs1'. Property 'x' is missing in type '{ y: number; }'. -tests/cases/conformance/jsx/file.tsx(31,8): error TS2326: Types of property 'x' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(31,8): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsx/file.tsx (3 errors) ==== @@ -46,9 +45,9 @@ tests/cases/conformance/jsx/file.tsx(31,8): error TS2326: Types of property 'x' // Error var obj5 = { x: 32, y: 32 }; - ~~~~~~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:8:2: The expected type comes from property 'x' which is declared here on type 'Attribs1' // Ok var obj6 = { x: 'ok', y: 32, extra: 100 }; diff --git a/tests/baselines/reference/tsxAttributeResolution6.errors.txt b/tests/baselines/reference/tsxAttributeResolution6.errors.txt index e9ad3c3e8deb4..6b2657bdb36ae 100644 --- a/tests/baselines/reference/tsxAttributeResolution6.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution6.errors.txt @@ -1,7 +1,5 @@ -tests/cases/conformance/jsx/file.tsx(10,8): error TS2326: Types of property 's' are incompatible. - Type 'true' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(11,8): error TS2326: Types of property 'n' are incompatible. - Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/jsx/file.tsx(10,8): error TS2322: Type 'true' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(11,8): error TS2322: Type 'string' is not assignable to type 'boolean'. tests/cases/conformance/jsx/file.tsx(12,2): error TS2322: Type '{}' is not assignable to type '{ n: boolean; }'. Property 'n' is missing in type '{}'. @@ -18,12 +16,12 @@ tests/cases/conformance/jsx/file.tsx(12,2): error TS2322: Type '{}' is not assig // Error ; ~ -!!! error TS2326: Types of property 's' are incompatible. -!!! error TS2326: Type 'true' is not assignable to type 'string'. +!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:25: The expected type comes from property 's' which is declared here on type '{ n?: boolean; s?: string; }' ; - ~~~~~~~~ -!!! error TS2326: Types of property 'n' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'boolean'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:12: The expected type comes from property 'n' which is declared here on type '{ n?: boolean; s?: string; }' ; ~~~~~ !!! error TS2322: Type '{}' is not assignable to type '{ n: boolean; }'. diff --git a/tests/baselines/reference/tsxAttributeResolution7.errors.txt b/tests/baselines/reference/tsxAttributeResolution7.errors.txt index 074bd49f3f096..f36d8eaa0ad8f 100644 --- a/tests/baselines/reference/tsxAttributeResolution7.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution7.errors.txt @@ -1,5 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(9,8): error TS2326: Types of property 'data-foo' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(9,8): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -12,9 +11,9 @@ tests/cases/conformance/jsx/file.tsx(9,8): error TS2326: Types of property 'data // Error ; - ~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'data-foo' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:12: The expected type comes from property 'data-foo' which is declared here on type '{ "data-foo"?: string; }' // OK ; diff --git a/tests/baselines/reference/tsxAttributeResolution9.errors.txt b/tests/baselines/reference/tsxAttributeResolution9.errors.txt index 9193531609c0f..95e05a3f5eb64 100644 --- a/tests/baselines/reference/tsxAttributeResolution9.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution9.errors.txt @@ -1,5 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(9,14): error TS2326: Types of property 'foo' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(9,14): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsx/react.d.ts (0 errors) ==== @@ -26,7 +25,7 @@ tests/cases/conformance/jsx/file.tsx(9,14): error TS2326: Types of property 'foo ; // ok ; // should be an error - ~~~~~~~ -!!! error TS2326: Types of property 'foo' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:12: The expected type comes from property 'foo' which is declared here on type '{ foo: string; }' \ No newline at end of file diff --git a/tests/baselines/reference/tsxDeepAttributeAssignabilityError.errors.txt b/tests/baselines/reference/tsxDeepAttributeAssignabilityError.errors.txt new file mode 100644 index 0000000000000..8005afbdd55cd --- /dev/null +++ b/tests/baselines/reference/tsxDeepAttributeAssignabilityError.errors.txt @@ -0,0 +1,30 @@ +tests/cases/compiler/file1.tsx(5,5): error TS2322: Type 'number' is not assignable to type 'string'. + + +==== tests/cases/compiler/my-component.tsx (0 errors) ==== + import * as React from 'react' + + interface MyProps { + x: string; + y: MyInnerProps; + } + + interface MyInnerProps { + value: string; + } + + export function MyComponent(_props: MyProps) { + return my component; + } + +==== tests/cases/compiler/file1.tsx (1 errors) ==== + import * as React from 'react' + import { MyComponent } from './my-component' + + export const result = ; + \ No newline at end of file diff --git a/tests/baselines/reference/tsxDeepAttributeAssignabilityError.js b/tests/baselines/reference/tsxDeepAttributeAssignabilityError.js new file mode 100644 index 0000000000000..c452336da462d --- /dev/null +++ b/tests/baselines/reference/tsxDeepAttributeAssignabilityError.js @@ -0,0 +1,43 @@ +//// [tests/cases/compiler/tsxDeepAttributeAssignabilityError.tsx] //// + +//// [my-component.tsx] +import * as React from 'react' + +interface MyProps { + x: string; + y: MyInnerProps; +} + +interface MyInnerProps { + value: string; +} + +export function MyComponent(_props: MyProps) { + return my component; +} + +//// [file1.tsx] +import * as React from 'react' +import { MyComponent } from './my-component' + +export const result = ; + + +//// [my-component.js] +"use strict"; +exports.__esModule = true; +var React = require("react"); +function MyComponent(_props) { + return React.createElement("span", null, "my component"); +} +exports.MyComponent = MyComponent; +//// [file1.js] +"use strict"; +exports.__esModule = true; +var React = require("react"); +var my_component_1 = require("./my-component"); +exports.result = React.createElement(my_component_1.MyComponent, { x: "yes", y: { + value: 42 + } }); diff --git a/tests/baselines/reference/tsxDeepAttributeAssignabilityError.symbols b/tests/baselines/reference/tsxDeepAttributeAssignabilityError.symbols new file mode 100644 index 0000000000000..2ae8d453bd4d6 --- /dev/null +++ b/tests/baselines/reference/tsxDeepAttributeAssignabilityError.symbols @@ -0,0 +1,50 @@ +=== tests/cases/compiler/my-component.tsx === +import * as React from 'react' +>React : Symbol(React, Decl(my-component.tsx, 0, 6)) + +interface MyProps { +>MyProps : Symbol(MyProps, Decl(my-component.tsx, 0, 30)) + + x: string; +>x : Symbol(MyProps.x, Decl(my-component.tsx, 2, 19)) + + y: MyInnerProps; +>y : Symbol(MyProps.y, Decl(my-component.tsx, 3, 14)) +>MyInnerProps : Symbol(MyInnerProps, Decl(my-component.tsx, 5, 1)) +} + +interface MyInnerProps { +>MyInnerProps : Symbol(MyInnerProps, Decl(my-component.tsx, 5, 1)) + + value: string; +>value : Symbol(MyInnerProps.value, Decl(my-component.tsx, 7, 24)) +} + +export function MyComponent(_props: MyProps) { +>MyComponent : Symbol(MyComponent, Decl(my-component.tsx, 9, 1)) +>_props : Symbol(_props, Decl(my-component.tsx, 11, 28)) +>MyProps : Symbol(MyProps, Decl(my-component.tsx, 0, 30)) + + return my component; +>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51)) +>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51)) +} + +=== tests/cases/compiler/file1.tsx === +import * as React from 'react' +>React : Symbol(React, Decl(file1.tsx, 0, 6)) + +import { MyComponent } from './my-component' +>MyComponent : Symbol(MyComponent, Decl(file1.tsx, 1, 8)) + +export const result = result : Symbol(result, Decl(file1.tsx, 3, 12)) +>MyComponent : Symbol(MyComponent, Decl(file1.tsx, 1, 8)) +>x : Symbol(x, Decl(file1.tsx, 3, 34)) +>y : Symbol(y, Decl(file1.tsx, 3, 42)) + + value: 42 +>value : Symbol(value, Decl(file1.tsx, 3, 47)) + +}} />; + diff --git a/tests/baselines/reference/tsxDeepAttributeAssignabilityError.types b/tests/baselines/reference/tsxDeepAttributeAssignabilityError.types new file mode 100644 index 0000000000000..16c81ed8d878b --- /dev/null +++ b/tests/baselines/reference/tsxDeepAttributeAssignabilityError.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/my-component.tsx === +import * as React from 'react' +>React : typeof React + +interface MyProps { +>MyProps : MyProps + + x: string; +>x : string + + y: MyInnerProps; +>y : MyInnerProps +>MyInnerProps : MyInnerProps +} + +interface MyInnerProps { +>MyInnerProps : MyInnerProps + + value: string; +>value : string +} + +export function MyComponent(_props: MyProps) { +>MyComponent : (_props: MyProps) => JSX.Element +>_props : MyProps +>MyProps : MyProps + + return my component; +>my component : JSX.Element +>span : any +>span : any +} + +=== tests/cases/compiler/file1.tsx === +import * as React from 'react' +>React : typeof React + +import { MyComponent } from './my-component' +>MyComponent : (_props: MyProps) => JSX.Element + +export const result = result : JSX.Element +> : JSX.Element +>MyComponent : (_props: MyProps) => JSX.Element +>x : string +>y : { value: number; } +>{ value: 42} : { value: number; } + + value: 42 +>value : number +>42 : 42 + +}} />; + diff --git a/tests/baselines/reference/tsxDefaultAttributesResolution3.errors.txt b/tests/baselines/reference/tsxDefaultAttributesResolution3.errors.txt index 565da6c8432ca..ebeaa5384861d 100644 --- a/tests/baselines/reference/tsxDefaultAttributesResolution3.errors.txt +++ b/tests/baselines/reference/tsxDefaultAttributesResolution3.errors.txt @@ -1,5 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(13,19): error TS2326: Types of property 'x' are incompatible. - Type 'true' is not assignable to type 'false'. +tests/cases/conformance/jsx/file.tsx(13,19): error TS2322: Type 'true' is not assignable to type 'false'. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -17,5 +16,5 @@ tests/cases/conformance/jsx/file.tsx(13,19): error TS2326: Types of property 'x' // Error let p = ; ~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'true' is not assignable to type 'false'. \ No newline at end of file +!!! error TS2322: Type 'true' is not assignable to type 'false'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & Prop & { children?: ReactNode; }' \ No newline at end of file diff --git a/tests/baselines/reference/tsxElementResolution12.errors.txt b/tests/baselines/reference/tsxElementResolution12.errors.txt index 317e86026cc69..03347b8987115 100644 --- a/tests/baselines/reference/tsxElementResolution12.errors.txt +++ b/tests/baselines/reference/tsxElementResolution12.errors.txt @@ -2,8 +2,7 @@ tests/cases/conformance/jsx/file.tsx(23,1): error TS2607: JSX element class does tests/cases/conformance/jsx/file.tsx(23,7): error TS2339: Property 'x' does not exist on type '{}'. tests/cases/conformance/jsx/file.tsx(25,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property. tests/cases/conformance/jsx/file.tsx(26,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property. -tests/cases/conformance/jsx/file.tsx(33,7): error TS2326: Types of property 'x' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(33,7): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/jsx/file.tsx (5 errors) ==== @@ -48,7 +47,7 @@ tests/cases/conformance/jsx/file.tsx(33,7): error TS2326: Types of property 'x' var Obj4: Obj4type; ; // OK ; // Error - ~~~~~~~~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:29:37: The expected type comes from property 'x' which is declared here on type '{ x: number; }' \ No newline at end of file diff --git a/tests/baselines/reference/tsxLibraryManagedAttributes.errors.txt b/tests/baselines/reference/tsxLibraryManagedAttributes.errors.txt index d221273116460..c7ed5d0151947 100644 --- a/tests/baselines/reference/tsxLibraryManagedAttributes.errors.txt +++ b/tests/baselines/reference/tsxLibraryManagedAttributes.errors.txt @@ -2,30 +2,21 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(55,12): error TS2322 Type '{ foo: number; }' is not assignable to type '{ bar: string | number | ReactComponent<{}, {}> | null | undefined; baz: string; }'. Property 'bar' is missing in type '{ foo: number; }'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(57,41): error TS2339: Property 'bat' does not exist on type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: number; }>'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(59,42): error TS2326: Types of property 'baz' are incompatible. - Type 'null' is not assignable to type 'string'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(69,26): error TS2326: Types of property 'foo' are incompatible. - Type 'string' is not assignable to type 'number | null | undefined'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(71,35): error TS2326: Types of property 'bar' are incompatible. - Type 'null' is not assignable to type 'ReactNode'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(59,42): error TS2322: Type 'null' is not assignable to type 'string'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(69,26): error TS2322: Type 'string' is not assignable to type 'number | null | undefined'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(71,35): error TS2322: Type 'null' is not assignable to type 'ReactNode'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(80,38): error TS2339: Property 'bar' does not exist on type 'Defaultize<{}, { foo: number; }>'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(81,29): error TS2326: Types of property 'foo' are incompatible. - Type 'string' is not assignable to type 'number | undefined'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(81,29): error TS2322: Type 'string' is not assignable to type 'number | undefined'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(98,12): error TS2322: Type '{ foo: string; }' is not assignable to type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: string; }>'. Type '{ foo: string; }' is not assignable to type '{ bar: string | number | ReactComponent<{}, {}> | null | undefined; baz: number; }'. Property 'bar' is missing in type '{ foo: string; }'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(100,56): error TS2339: Property 'bat' does not exist on type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: string; }>'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(102,57): error TS2326: Types of property 'baz' are incompatible. - Type 'null' is not assignable to type 'number'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(111,46): error TS2326: Types of property 'foo' are incompatible. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(112,46): error TS2326: Types of property 'foo' are incompatible. - Type 'null' is not assignable to type 'string'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(113,57): error TS2326: Types of property 'bar' are incompatible. - Type 'null' is not assignable to type 'ReactNode'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(102,57): error TS2322: Type 'null' is not assignable to type 'number'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(111,46): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(112,46): error TS2322: Type 'null' is not assignable to type 'string'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(113,57): error TS2322: Type 'null' is not assignable to type 'ReactNode'. tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(122,58): error TS2339: Property 'bar' does not exist on type 'Defaultize'. -tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS2326: Types of property 'foo' are incompatible. - Type 'number' is not assignable to type 'string | undefined'. +tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS2322: Type 'number' is not assignable to type 'string | undefined'. ==== tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx (15 errors) ==== @@ -94,9 +85,8 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232 !!! error TS2339: Property 'bat' does not exist on type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: number; }>'. const e = ; // bar is nullable/undefinable since it's not marked `isRequired` const f = ; // Error, baz is _not_ nullable/undefinable since it's marked `isRequired` - ~~~~~~~~~~ -!!! error TS2326: Types of property 'baz' are incompatible. -!!! error TS2326: Type 'null' is not assignable to type 'string'. + ~~~ +!!! error TS2322: Type 'null' is not assignable to type 'string'. class JustPropTypes extends ReactComponent { static propTypes = { @@ -107,14 +97,14 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232 const g = ; const h = ; // error, wrong type - ~~~~~~~~ -!!! error TS2326: Types of property 'foo' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number | null | undefined'. + ~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number | null | undefined'. +!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:63:9: The expected type comes from property 'foo' which is declared here on type 'InferredPropTypes<{ foo: PropTypeChecker; bar: PropTypeChecker; }>' const i = ; const j = ; // error, bar is required - ~~~~~~~~~~ -!!! error TS2326: Types of property 'bar' are incompatible. -!!! error TS2326: Type 'null' is not assignable to type 'ReactNode'. + ~~~ +!!! error TS2322: Type 'null' is not assignable to type 'ReactNode'. +!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:64:9: The expected type comes from property 'bar' which is declared here on type 'InferredPropTypes<{ foo: PropTypeChecker; bar: PropTypeChecker; }>' class JustDefaultProps extends ReactComponent { static defaultProps = { @@ -127,9 +117,9 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232 ~~~~~~~~ !!! error TS2339: Property 'bar' does not exist on type 'Defaultize<{}, { foo: number; }>'. const m = ; // error, wrong type - ~~~~~~~~ -!!! error TS2326: Types of property 'foo' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number | undefined'. + ~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. +!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:75:9: The expected type comes from property 'foo' which is declared here on type 'Defaultize<{}, { foo: number; }>' interface FooProps { foo: string; @@ -157,9 +147,8 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232 !!! error TS2339: Property 'bat' does not exist on type 'Defaultize; bar: PropTypeChecker; baz: PropTypeChecker; }>, { foo: string; }>'. const r = ; // bar is nullable/undefinable since it's not marked `isRequired` const s = ; // Error, baz is _not_ nullable/undefinable since it's marked `isRequired` - ~~~~~~~~~~ -!!! error TS2326: Types of property 'baz' are incompatible. -!!! error TS2326: Type 'null' is not assignable to type 'number'. + ~~~ +!!! error TS2322: Type 'null' is not assignable to type 'number'. class JustPropTypesWithSpecifiedGeneric extends ReactComponent { static propTypes = { @@ -169,17 +158,17 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232 } const t = ; const u = ; // error, wrong type - ~~~~~~~~ -!!! error TS2326: Types of property 'foo' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:84:5: The expected type comes from property 'foo' which is declared here on type 'FooProps & InferredPropTypes<{ foo: PropTypeChecker; bar: PropTypeChecker; }>' const v = ; // generic overrides propTypes required-ness, null isn't valid - ~~~~~~~~~~ -!!! error TS2326: Types of property 'foo' are incompatible. -!!! error TS2326: Type 'null' is not assignable to type 'string'. + ~~~ +!!! error TS2322: Type 'null' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:84:5: The expected type comes from property 'foo' which is declared here on type 'FooProps & InferredPropTypes<{ foo: PropTypeChecker; bar: PropTypeChecker; }>' const w = ; // error, bar is required - ~~~~~~~~~~ -!!! error TS2326: Types of property 'bar' are incompatible. -!!! error TS2326: Type 'null' is not assignable to type 'ReactNode'. + ~~~ +!!! error TS2322: Type 'null' is not assignable to type 'ReactNode'. +!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:107:9: The expected type comes from property 'bar' which is declared here on type 'FooProps & InferredPropTypes<{ foo: PropTypeChecker; bar: PropTypeChecker; }>' class JustDefaultPropsWithSpecifiedGeneric extends ReactComponent { static defaultProps = { @@ -192,8 +181,8 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232 ~~~~~~~~ !!! error TS2339: Property 'bar' does not exist on type 'Defaultize'. const z = ; // error, wrong type - ~~~~~~~~ -!!! error TS2326: Types of property 'foo' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string | undefined'. + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string | undefined'. +!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:117:9: The expected type comes from property 'foo' which is declared here on type 'Defaultize' const aa = ; \ No newline at end of file diff --git a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt index 669c315b71a38..bda5bb597e0f8 100644 --- a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt +++ b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/jsx/file.tsx(13,11): error TS2322: Type '{}' is not assignable to type 'Prop'. Property 'a' is missing in type '{}'. -tests/cases/conformance/jsx/file.tsx(19,18): error TS2326: Types of property 'a' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(19,18): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== @@ -27,6 +26,6 @@ tests/cases/conformance/jsx/file.tsx(19,18): error TS2326: Types of property 'a' // Error let x2 = - ~~~~~~ -!!! error TS2326: Types of property 'a' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number'. \ No newline at end of file + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'a' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Prop & { children?: ReactNode; }' \ No newline at end of file diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution10.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution10.errors.txt index 111a2e4768611..3167f8ae4eb90 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution10.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution10.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/jsx/file.tsx(19,23): error TS2326: Types of property 'x' are incompatible. - Type '3' is not assignable to type '2'. -tests/cases/conformance/jsx/file.tsx(20,25): error TS2326: Types of property 'x' are incompatible. - Type 'string' is not assignable to type '2'. -tests/cases/conformance/jsx/file.tsx(21,25): error TS2326: Types of property 'x' are incompatible. - Type '3' is not assignable to type '2'. -tests/cases/conformance/jsx/file.tsx(22,15): error TS2326: Types of property 'x' are incompatible. - Type 'true' is not assignable to type '2'. +tests/cases/conformance/jsx/file.tsx(19,23): error TS2322: Type '3' is not assignable to type '2'. +tests/cases/conformance/jsx/file.tsx(20,25): error TS2322: Type 'string' is not assignable to type '2'. +tests/cases/conformance/jsx/file.tsx(21,25): error TS2322: Type '3' is not assignable to type '2'. +tests/cases/conformance/jsx/file.tsx(22,15): error TS2322: Type 'true' is not assignable to type '2'. ==== tests/cases/conformance/jsx/file.tsx (4 errors) ==== @@ -28,19 +24,19 @@ tests/cases/conformance/jsx/file.tsx(22,15): error TS2326: Types of property 'x' // Error let y = ; - ~~~~~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type '3' is not assignable to type '2'. + ~ +!!! error TS2322: Type '3' is not assignable to type '2'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & OptionProp & { children?: ReactNode; }' let y1 = ; - ~~~~~~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type '2'. + ~ +!!! error TS2322: Type 'string' is not assignable to type '2'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & OptionProp & { children?: ReactNode; }' let y2 = ; - ~~~~~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type '3' is not assignable to type '2'. + ~ +!!! error TS2322: Type '3' is not assignable to type '2'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & OptionProp & { children?: ReactNode; }' let y3 = ; ~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'true' is not assignable to type '2'. +!!! error TS2322: Type 'true' is not assignable to type '2'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & OptionProp & { children?: ReactNode; }' \ No newline at end of file diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution12.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution12.errors.txt index 68a7a8a356d03..36b86e8aaf27c 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution12.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution12.errors.txt @@ -1,7 +1,5 @@ -tests/cases/conformance/jsx/file.tsx(27,33): error TS2326: Types of property 'y' are incompatible. - Type 'true' is not assignable to type 'false'. -tests/cases/conformance/jsx/file.tsx(28,50): error TS2326: Types of property 'x' are incompatible. - Type '3' is not assignable to type '2'. +tests/cases/conformance/jsx/file.tsx(27,33): error TS2322: Type 'true' is not assignable to type 'false'. +tests/cases/conformance/jsx/file.tsx(28,50): error TS2322: Type '3' is not assignable to type '2'. tests/cases/conformance/jsx/file.tsx(30,11): error TS2322: Type '{ y: true; x: 2; overwrite: string; }' is not assignable to type 'Prop'. Types of property 'y' are incompatible. Type 'true' is not assignable to type 'false'. @@ -36,12 +34,12 @@ tests/cases/conformance/jsx/file.tsx(30,11): error TS2322: Type '{ y: true; x: 2 // Error let x = ~ -!!! error TS2326: Types of property 'y' are incompatible. -!!! error TS2326: Type 'true' is not assignable to type 'false'. +!!! error TS2322: Type 'true' is not assignable to type 'false'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:14:5: The expected type comes from property 'y' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & Prop & { children?: ReactNode; }' let x1 = - ~~~~~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type '3' is not assignable to type '2'. + ~ +!!! error TS2322: Type '3' is not assignable to type '2'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:13:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & Prop & { children?: ReactNode; }' let x2 = let x3 = ~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt index d472e032a1e03..62a3db1de1638 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt @@ -2,10 +2,8 @@ tests/cases/conformance/jsx/file.tsx(17,10): error TS2322: Type '{}' is not assi Property 'x' is missing in type '{}'. tests/cases/conformance/jsx/file.tsx(18,10): error TS2322: Type '{}' is not assignable to type 'PoisonedProp'. Property 'x' is missing in type '{}'. -tests/cases/conformance/jsx/file.tsx(19,19): error TS2326: Types of property 'x' are incompatible. - Type 'true' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(19,21): error TS2326: Types of property 'y' are incompatible. - Type 'true' is not assignable to type '"2"'. +tests/cases/conformance/jsx/file.tsx(19,19): error TS2322: Type 'true' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(19,21): error TS2322: Type 'true' is not assignable to type '"2"'. tests/cases/conformance/jsx/file.tsx(20,10): error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'. Types of property 'x' are incompatible. Type 'number' is not assignable to type 'string'. @@ -41,11 +39,11 @@ tests/cases/conformance/jsx/file.tsx(21,11): error TS2322: Type '{ X: string; x: !!! error TS2322: Property 'x' is missing in type '{}'. let z = ; ~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'true' is not assignable to type 'string'. +!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & PoisonedProp & { children?: ReactNode; }' ~ -!!! error TS2326: Types of property 'y' are incompatible. -!!! error TS2326: Type 'true' is not assignable to type '"2"'. +!!! error TS2322: Type 'true' is not assignable to type '"2"'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'y' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & PoisonedProp & { children?: ReactNode; }' let w = ; ~~~~~~~~ !!! error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'. diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt index a9019c17e0db6..9d461f46cc314 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt @@ -2,24 +2,18 @@ tests/cases/conformance/jsx/file.tsx(12,13): error TS2322: Type '{ extraProp: tr Property 'yy' is missing in type '{ extraProp: true; }'. tests/cases/conformance/jsx/file.tsx(13,13): error TS2322: Type '{ yy: number; }' is not assignable to type '{ yy: number; yy1: string; }'. Property 'yy1' is missing in type '{ yy: number; }'. -tests/cases/conformance/jsx/file.tsx(14,31): error TS2326: Types of property 'yy1' are incompatible. - Type 'true' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(14,31): error TS2322: Type 'true' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(16,31): error TS2339: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. tests/cases/conformance/jsx/file.tsx(17,13): error TS2322: Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'. Types of property 'yy' are incompatible. Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/jsx/file.tsx(25,13): error TS2322: Type '{ extra-data: true; }' is not assignable to type '{ yy: string; direction?: number; }'. Property 'yy' is missing in type '{ extra-data: true; }'. -tests/cases/conformance/jsx/file.tsx(26,40): error TS2326: Types of property 'direction' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/jsx/file.tsx(33,32): error TS2326: Types of property 'y3' are incompatible. - Type 'string' is not assignable to type 'boolean'. -tests/cases/conformance/jsx/file.tsx(34,29): error TS2326: Types of property 'y1' are incompatible. - Type 'string' is not assignable to type 'boolean'. -tests/cases/conformance/jsx/file.tsx(35,29): error TS2326: Types of property 'y1' are incompatible. - Type 'string' is not assignable to type 'boolean'. -tests/cases/conformance/jsx/file.tsx(36,29): error TS2326: Types of property 'y1' are incompatible. - Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/jsx/file.tsx(26,40): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(33,32): error TS2322: Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/jsx/file.tsx(34,29): error TS2322: Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/jsx/file.tsx(35,29): error TS2322: Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type 'string' is not assignable to type 'boolean'. ==== tests/cases/conformance/jsx/file.tsx (11 errors) ==== @@ -44,8 +38,8 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2326: Types of property 'y1 !!! error TS2322: Property 'yy1' is missing in type '{ yy: number; }'. const c2 = ; // type incompatible; ~~~ -!!! error TS2326: Types of property 'yy1' are incompatible. -!!! error TS2326: Type 'true' is not assignable to type 'string'. +!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:43: The expected type comes from property 'yy1' which is declared here on type 'IntrinsicAttributes & { yy: number; yy1: string; }' const c3 = ; // This is OK becuase all attribute are spread const c4 = ; // extra property; ~~~~~~~~~~ @@ -67,9 +61,9 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2326: Types of property 'y1 !!! error TS2322: Type '{ extra-data: true; }' is not assignable to type '{ yy: string; direction?: number; }'. !!! error TS2322: Property 'yy' is missing in type '{ extra-data: true; }'. const d2 = - ~~~~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'direction' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number'. + ~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:22:50: The expected type comes from property 'direction' which is declared here on type 'IntrinsicAttributes & { yy: string; direction?: number; }' declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element; declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element; @@ -77,19 +71,19 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2326: Types of property 'y1 // Error const e1 = - ~~~~~~~~~~ -!!! error TS2326: Types of property 'y3' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'boolean'. + ~~ +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:64: The expected type comes from property 'y3' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' const e2 = - ~~~~~~~~~~ -!!! error TS2326: Types of property 'y1' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'boolean'. + ~~ +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' const e3 = - ~~~~~~~~~~ -!!! error TS2326: Types of property 'y1' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'boolean'. + ~~ +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' const e4 = Hi - ~~~~~~~~~~ -!!! error TS2326: Types of property 'y1' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'boolean'. + ~~ +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' \ No newline at end of file diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt index b0b05adfa6a8f..d862ad93c8466 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt @@ -8,12 +8,9 @@ tests/cases/conformance/jsx/file.tsx(51,13): error TS2322: Type '{ onClick: (k: Property '"data-format"' is missing in type '{ onClick: (k: MouseEvent) => void; to: string; }'. tests/cases/conformance/jsx/file.tsx(53,13): error TS2322: Type '{ to: string; onClick(e: any): void; }' is not assignable to type 'HyphenProps'. Property '"data-format"' is missing in type '{ to: string; onClick(e: any): void; }'. -tests/cases/conformance/jsx/file.tsx(54,51): error TS2326: Types of property 'children' are incompatible. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(55,68): error TS2326: Types of property 'className' are incompatible. - Type 'true' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(56,24): error TS2326: Types of property 'data-format' are incompatible. - Type 'true' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(54,51): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(55,68): error TS2322: Type 'true' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(56,24): error TS2322: Type 'true' is not assignable to type 'string'. ==== tests/cases/conformance/jsx/file.tsx (8 errors) ==== @@ -86,14 +83,14 @@ tests/cases/conformance/jsx/file.tsx(56,24): error TS2326: Types of property 'da !!! error TS2322: Type '{ to: string; onClick(e: any): void; }' is not assignable to type 'HyphenProps'. !!! error TS2322: Property '"data-format"' is missing in type '{ to: string; onClick(e: any): void; }'. const b6 = ; // incorrect type for optional attribute - ~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'children' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & HyphenProps' const b7 = ; // incorrect type for optional attribute ~~~~~~~~~ -!!! error TS2326: Types of property 'className' are incompatible. -!!! error TS2326: Type 'true' is not assignable to type 'string'. +!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'className' which is declared here on type 'IntrinsicAttributes & HyphenProps' const b8 = ; // incorrect type for specified hyphanated name ~~~~~~~~~~~ -!!! error TS2326: Types of property 'data-format' are incompatible. -!!! error TS2326: Type 'true' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:17:5: The expected type comes from property 'data-format' which is declared here on type 'IntrinsicAttributes & HyphenProps' \ No newline at end of file diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentWithDefaultTypeParameter2.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentWithDefaultTypeParameter2.errors.txt index cfec023b3228e..8ce6ec6d8ddd0 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentWithDefaultTypeParameter2.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentWithDefaultTypeParameter2.errors.txt @@ -1,5 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(13,24): error TS2326: Types of property 'values' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(13,24): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -16,6 +15,6 @@ tests/cases/conformance/jsx/file.tsx(13,24): error TS2326: Types of property 'va // Error let i1 = ; - ~~~~~~~~~~ -!!! error TS2326: Types of property 'values' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. \ No newline at end of file + ~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'values' which is declared here on type 'IntrinsicAttributes & MyComponentProp' \ No newline at end of file diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt index 2a5f87adb97e6..fa5e8e113cba7 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/jsx/file.tsx(19,10): error TS2322: Type '{ naaame: string; }' is not assignable to type '{ name: string; }'. Property 'name' is missing in type '{ naaame: string; }'. -tests/cases/conformance/jsx/file.tsx(27,15): error TS2326: Types of property 'name' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(27,15): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(29,10): error TS2559: Type '{ naaaaaaame: string; }' has no properties in common with type 'IntrinsicAttributes & { name?: string; }'. tests/cases/conformance/jsx/file.tsx(34,10): error TS2322: Type '{ extra-prop-name: string; }' is not assignable to type '{ "prop-name": string; }'. Property '"prop-name"' is missing in type '{ extra-prop-name: string; }'. @@ -42,9 +41,8 @@ tests/cases/conformance/jsx/file.tsx(45,11): error TS2559: Type '{ prop1: boolea let d = ; // Error let e = ; - ~~~~~~~~~ -!!! error TS2326: Types of property 'name' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. // Error let f = ; ~~~~ diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt index 710a443029f66..742957b66ad4b 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt @@ -1,14 +1,10 @@ -tests/cases/conformance/jsx/file.tsx(8,43): error TS2326: Types of property 'ignore-prop' are incompatible. - Type '(T & { ignore-prop: number; })["ignore-prop"]' is not assignable to type 'string'. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(8,43): error TS2322: Type '10' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(13,15): error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes & { prop: {}; "ignore-prop": string; }'. Type 'T' is not assignable to type '{ prop: {}; "ignore-prop": string; }'. -tests/cases/conformance/jsx/file.tsx(20,19): error TS2326: Types of property 'func' are incompatible. - Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'. -tests/cases/conformance/jsx/file.tsx(31,52): error TS2326: Types of property 'selectHandler' are incompatible. - Type '(val: string) => void' is not assignable to type '(selectedVal: number) => void'. - Types of parameters 'val' and 'selectedVal' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(20,19): error TS2322: Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'. +tests/cases/conformance/jsx/file.tsx(31,52): error TS2322: Type '(val: string) => void' is not assignable to type '(selectedVal: number) => void'. + Types of parameters 'val' and 'selectedVal' are incompatible. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsx/file.tsx (4 errors) ==== @@ -20,10 +16,9 @@ tests/cases/conformance/jsx/file.tsx(31,52): error TS2326: Types of property 'se // Error function Bar(arg: T) { let a1 = ; - ~~~~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'ignore-prop' are incompatible. -!!! error TS2326: Type '(T & { ignore-prop: number; })["ignore-prop"]' is not assignable to type 'string'. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~~~~~~~~~ +!!! error TS2322: Type '10' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:53: The expected type comes from property 'ignore-prop' which is declared here on type 'IntrinsicAttributes & { prop: number; "ignore-prop": string; }' } // Error @@ -39,9 +34,9 @@ tests/cases/conformance/jsx/file.tsx(31,52): error TS2326: Types of property 'se // Error function createLink(func: (a: number, b: string)=>void) { let o = - ~~~~~~~~~~~ -!!! error TS2326: Types of property 'func' are incompatible. -!!! error TS2326: Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'. + ~~~~ +!!! error TS2322: Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:16:30: The expected type comes from property 'func' which is declared here on type 'IntrinsicAttributes & { func: (arg: number) => void; }' } interface InferParamProp { @@ -53,9 +48,9 @@ tests/cases/conformance/jsx/file.tsx(31,52): error TS2326: Types of property 'se // Error let i = { }} />; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2326: Types of property 'selectHandler' are incompatible. -!!! error TS2326: Type '(val: string) => void' is not assignable to type '(selectedVal: number) => void'. -!!! error TS2326: Types of parameters 'val' and 'selectedVal' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~~~~~~~~~~~ +!!! error TS2322: Type '(val: string) => void' is not assignable to type '(selectedVal: number) => void'. +!!! error TS2322: Types of parameters 'val' and 'selectedVal' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:25:5: The expected type comes from property 'selectHandler' which is declared here on type 'IntrinsicAttributes & InferParamProp' \ No newline at end of file diff --git a/tests/baselines/reference/tsxTypeArgumentPartialDefinitionStillErrors.errors.txt b/tests/baselines/reference/tsxTypeArgumentPartialDefinitionStillErrors.errors.txt index c01bd40dbfb5d..255d0eb32bc7d 100644 --- a/tests/baselines/reference/tsxTypeArgumentPartialDefinitionStillErrors.errors.txt +++ b/tests/baselines/reference/tsxTypeArgumentPartialDefinitionStillErrors.errors.txt @@ -1,5 +1,4 @@ -tests/cases/compiler/file.tsx(11,14): error TS2326: Types of property 'prop' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/compiler/file.tsx(11,14): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/file.tsx (1 errors) ==== @@ -14,7 +13,7 @@ tests/cases/compiler/file.tsx(11,14): error TS2326: Types of property 'prop' are } prop={1}>; // should error - ~~~~~~~~ -!!! error TS2326: Types of property 'prop' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 /.ts/lib.es5.d.ts:1382:39: The expected type comes from property 'prop' which is declared here on type 'Record' \ No newline at end of file diff --git a/tests/baselines/reference/tsxTypeArgumentResolution.errors.txt b/tests/baselines/reference/tsxTypeArgumentResolution.errors.txt index 950d9549ba8be..fea0689425c3d 100644 --- a/tests/baselines/reference/tsxTypeArgumentResolution.errors.txt +++ b/tests/baselines/reference/tsxTypeArgumentResolution.errors.txt @@ -1,7 +1,5 @@ -tests/cases/conformance/jsx/file.tsx(16,26): error TS2326: Types of property 'b' are incompatible. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(18,26): error TS2326: Types of property 'b' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(16,26): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(18,26): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(20,13): error TS2558: Expected 1 type arguments, but got 2. tests/cases/conformance/jsx/file.tsx(22,13): error TS2558: Expected 1 type arguments, but got 2. tests/cases/conformance/jsx/file.tsx(24,12): error TS1099: Type argument list cannot be empty. @@ -9,19 +7,15 @@ tests/cases/conformance/jsx/file.tsx(26,12): error TS1099: Type argument list ca tests/cases/conformance/jsx/file.tsx(39,14): error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'. Types of property 'a' are incompatible. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(39,20): error TS2326: Types of property 'a' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(39,20): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(41,14): error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'. -tests/cases/conformance/jsx/file.tsx(41,20): error TS2326: Types of property 'a' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(41,20): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(47,14): error TS2558: Expected 1-2 type arguments, but got 3. tests/cases/conformance/jsx/file.tsx(47,53): error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes> & { a: string; } & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(49,14): error TS2558: Expected 1-2 type arguments, but got 3. tests/cases/conformance/jsx/file.tsx(49,53): error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes> & { a: string; } & { children?: ReactNode; }'. -tests/cases/conformance/jsx/file.tsx(51,47): error TS2326: Types of property 'b' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(51,47): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(53,47): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/jsx/file.tsx (16 errors) ==== @@ -41,14 +35,14 @@ tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b' x = a={10} b="hi">; // OK x = a={10} b={20} />; // error - ~~~~~~ -!!! error TS2326: Types of property 'b' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Prop & { children?: ReactNode; }' x = a={10} b={20}>; // error - ~~~~~~ -!!! error TS2326: Types of property 'b' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Prop & { children?: ReactNode; }' x = a={10} b="hi" />; // error ~~~~~~~~~~ @@ -82,16 +76,16 @@ tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b' !!! error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'. !!! error TS2344: Types of property 'a' are incompatible. !!! error TS2344: Type 'number' is not assignable to type 'string'. - ~~~~~~ -!!! error TS2326: Types of property 'a' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:32:35: The expected type comes from property 'a' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & { a: string; } & { children?: ReactNode; }' x = a={10} b="hi">; // error ~~~~ !!! error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'. - ~~~~~~ -!!! error TS2326: Types of property 'a' are incompatible. -!!! error TS2326: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:32:35: The expected type comes from property 'a' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & { a: string; } & { children?: ReactNode; }' x = a="hi" b="hi" />; // OK @@ -110,12 +104,12 @@ tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b' !!! error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes> & { a: string; } & { children?: ReactNode; }'. x = a="hi" b="hi" />; // error - ~~~~~~ -!!! error TS2326: Types of property 'b' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:51:28: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & { a: string; } & { b: number; } & { children?: ReactNode; }' x = a="hi" b="hi">; // error - ~~~~~~ -!!! error TS2326: Types of property 'b' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:53:28: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & { a: string; } & { b: number; } & { children?: ReactNode; }' \ No newline at end of file diff --git a/tests/baselines/reference/tsxUnionElementType2.errors.txt b/tests/baselines/reference/tsxUnionElementType2.errors.txt index c113df8650255..be9fbecb391cf 100644 --- a/tests/baselines/reference/tsxUnionElementType2.errors.txt +++ b/tests/baselines/reference/tsxUnionElementType2.errors.txt @@ -1,5 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(12,10): error TS2326: Types of property 'x' are incompatible. - Type 'string' is not assignable to type 'number | boolean'. +tests/cases/conformance/jsx/file.tsx(12,10): error TS2322: Type 'string' is not assignable to type 'number | boolean'. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -15,6 +14,6 @@ tests/cases/conformance/jsx/file.tsx(12,10): error TS2326: Types of property 'x' var SFCComp = SFC1 || SFC2; - ~~~~~~~~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'number | boolean'. \ No newline at end of file + ~ +!!! error TS2322: Type 'string' is not assignable to type 'number | boolean'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:23: The expected type comes from property 'x' which is declared here on type '(IntrinsicAttributes & { x: number; }) | (IntrinsicAttributes & { x: boolean; })' \ No newline at end of file diff --git a/tests/baselines/reference/tsxUnionElementType4.errors.txt b/tests/baselines/reference/tsxUnionElementType4.errors.txt index 6bd8092d74983..dcde6f1e9dbad 100644 --- a/tests/baselines/reference/tsxUnionElementType4.errors.txt +++ b/tests/baselines/reference/tsxUnionElementType4.errors.txt @@ -1,5 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(32,17): error TS2326: Types of property 'x' are incompatible. - Type 'true' is not assignable to type 'ReactText'. +tests/cases/conformance/jsx/file.tsx(32,17): error TS2322: Type 'true' is not assignable to type 'ReactText'. tests/cases/conformance/jsx/file.tsx(33,10): error TS2559: Type '{ x: number; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(34,10): error TS2559: Type '{ prop: true; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. @@ -38,8 +37,8 @@ tests/cases/conformance/jsx/file.tsx(34,10): error TS2559: Type '{ prop: true; } // Error let a = ; ~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'true' is not assignable to type 'ReactText'. +!!! error TS2322: Type 'true' is not assignable to type 'ReactText'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:36: The expected type comes from property 'x' which is declared here on type '(IntrinsicAttributes & IntrinsicClassAttributes & { x: number; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes & { x: string; } & { children?: ReactNode; })' let b = ~~~~~~~~~~ !!! error TS2559: Type '{ x: number; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. diff --git a/tests/baselines/reference/tsxUnionElementType6.errors.txt b/tests/baselines/reference/tsxUnionElementType6.errors.txt index 1dc5a05f8b529..0c2c41abb8d1e 100644 --- a/tests/baselines/reference/tsxUnionElementType6.errors.txt +++ b/tests/baselines/reference/tsxUnionElementType6.errors.txt @@ -1,6 +1,5 @@ tests/cases/conformance/jsx/file.tsx(18,10): error TS2559: Type '{ x: true; }' has no properties in common with type 'IntrinsicAttributes'. -tests/cases/conformance/jsx/file.tsx(19,27): error TS2326: Types of property 'x' are incompatible. - Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/jsx/file.tsx(19,27): error TS2322: Type 'string' is not assignable to type 'boolean'. tests/cases/conformance/jsx/file.tsx(20,10): error TS2322: Type '{}' is not assignable to type '{ x: boolean; }'. Property 'x' is missing in type '{}'. tests/cases/conformance/jsx/file.tsx(21,10): error TS2322: Type '{ data-prop: true; }' is not assignable to type '{ x: boolean; }'. @@ -29,9 +28,9 @@ tests/cases/conformance/jsx/file.tsx(21,10): error TS2322: Type '{ data-prop: tr ~~~~~~~~~~~~ !!! error TS2559: Type '{ x: true; }' has no properties in common with type 'IntrinsicAttributes'. let b = ; - ~~~~~~ -!!! error TS2326: Types of property 'x' are incompatible. -!!! error TS2326: Type 'string' is not assignable to type 'boolean'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:11:23: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & { x: boolean; }' let c = ; ~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{}' is not assignable to type '{ x: boolean; }'. diff --git a/tests/baselines/reference/tupleTypes.errors.txt b/tests/baselines/reference/tupleTypes.errors.txt index e2b73b7613acd..87e17e14d3cfd 100644 --- a/tests/baselines/reference/tupleTypes.errors.txt +++ b/tests/baselines/reference/tupleTypes.errors.txt @@ -2,8 +2,8 @@ tests/cases/compiler/tupleTypes.ts(14,1): error TS2322: Type '[]' is not assigna Property '0' is missing in type '[]'. tests/cases/compiler/tupleTypes.ts(15,1): error TS2322: Type '[number]' is not assignable to type '[number, string]'. Property '1' is missing in type '[number]'. -tests/cases/compiler/tupleTypes.ts(17,1): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. - Type 'string' is not assignable to type 'number'. +tests/cases/compiler/tupleTypes.ts(17,6): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/tupleTypes.ts(17,15): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/tupleTypes.ts(18,1): error TS2322: Type '[number, string, number]' is not assignable to type '[number, string]'. Types of property 'length' are incompatible. Type '3' is not assignable to type '2'. @@ -24,7 +24,7 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n Type '{}' is not assignable to type 'string'. -==== tests/cases/compiler/tupleTypes.ts (9 errors) ==== +==== tests/cases/compiler/tupleTypes.ts (10 errors) ==== var v1: []; // Error var v2: [number]; var v3: [number, string]; @@ -48,9 +48,10 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n !!! error TS2322: Property '1' is missing in type '[number]'. t = [1, "hello"]; // Ok t = ["hello", 1]; // Error - ~ -!!! error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. + ~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = [1, "hello", 2]; // Error ~ !!! error TS2322: Type '[number, string, number]' is not assignable to type '[number, string]'. diff --git a/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.errors.txt b/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.errors.txt index eca289e819344..a7426f815bee3 100644 --- a/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.errors.txt +++ b/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.errors.txt @@ -1,6 +1,4 @@ -tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts(10,5): error TS2322: Type '{ [SYM]: "str"; }' is not assignable to type 'I'. - Types of property '[SYM]' are incompatible. - Type '"str"' is not assignable to type '"sym"'. +tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts(10,13): error TS2418: Type of computed property's value is '"str"', which is not assignable to type '"sym"'. ==== tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts (1 errors) ==== @@ -14,8 +12,7 @@ tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts(10,5): let a: I = {[SYM]: 'sym'}; // Expect ok let b: I = {[SYM]: 'str'}; // Expect error - ~ -!!! error TS2322: Type '{ [SYM]: "str"; }' is not assignable to type 'I'. -!!! error TS2322: Types of property '[SYM]' are incompatible. -!!! error TS2322: Type '"str"' is not assignable to type '"sym"'. + ~~~~~ +!!! error TS2418: Type of computed property's value is '"str"', which is not assignable to type '"sym"'. +!!! related TS6500 tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts:5:3: The expected type comes from property 'unique symbol' which is declared here on type 'I' \ No newline at end of file diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index a16dfafb5fe3e..aac9627adeb24 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -7,9 +7,7 @@ tests/cases/compiler/widenedTypes.ts(10,1): error TS2322: Type '""' is not assig tests/cases/compiler/widenedTypes.ts(17,1): error TS2322: Type '""' is not assignable to type 'number'. tests/cases/compiler/widenedTypes.ts(22,5): error TS2322: Type 'number[]' is not assignable to type 'string[]'. Type 'number' is not assignable to type 'string'. -tests/cases/compiler/widenedTypes.ts(23,5): error TS2322: Type '{ x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'. - Property 'x' is incompatible with index signature. - Type 'number' is not assignable to type 'string'. +tests/cases/compiler/widenedTypes.ts(23,39): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/widenedTypes.ts (9 errors) ==== @@ -53,7 +51,6 @@ tests/cases/compiler/widenedTypes.ts(23,5): error TS2322: Type '{ x: number; y: !!! error TS2322: Type 'number[]' is not assignable to type 'string[]'. !!! error TS2322: Type 'number' is not assignable to type 'string'. var obj: { [x: string]: string; } = { x: 3, y: null }; // assignable because null is widened, and therefore BCT is any - ~~~ -!!! error TS2322: Type '{ x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'. -!!! error TS2322: Property 'x' is incompatible with index signature. -!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6501 tests/cases/compiler/widenedTypes.ts:23:12: The expected type comes from this index signature. \ No newline at end of file diff --git a/tests/cases/compiler/deeplyNestedAssignabilityIssue.ts b/tests/cases/compiler/deeplyNestedAssignabilityIssue.ts new file mode 100644 index 0000000000000..7392c41545f3b --- /dev/null +++ b/tests/cases/compiler/deeplyNestedAssignabilityIssue.ts @@ -0,0 +1,30 @@ +// @pretty: true +interface A { + a: number; +} + +interface Large { + something: { + another: { + more: { + thing: A; + } + yetstill: { + another: A; + } + } + } +} + +const x: Large = { + something: { + another: { + more: { + thing: {} + }, + yetstill: { + another: {} + } + } + } +} diff --git a/tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts b/tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts new file mode 100644 index 0000000000000..41100f4a19a8a --- /dev/null +++ b/tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts @@ -0,0 +1,20 @@ +interface Foo { + a: { + b: { + c: { + d: string + } + } + } +} + +let q: Foo["a"] | undefined; +const x: Foo = (void 0, { + a: q = { + b: ({ + c: { + d: 42 + } + }) + } +}); diff --git a/tests/cases/compiler/tsxDeepAttributeAssignabilityError.tsx b/tests/cases/compiler/tsxDeepAttributeAssignabilityError.tsx new file mode 100644 index 0000000000000..c52b4b66167b0 --- /dev/null +++ b/tests/cases/compiler/tsxDeepAttributeAssignabilityError.tsx @@ -0,0 +1,29 @@ +// @jsx: react +// @noLib: true +// @skipLibCheck: true +// @libFiles: react.d.ts,lib.d.ts + +// @Filename: my-component.tsx +import * as React from 'react' + +interface MyProps { + x: string; + y: MyInnerProps; +} + +interface MyInnerProps { + value: string; +} + +export function MyComponent(_props: MyProps) { + return my component; +} + +// @Filename: file1.tsx + +import * as React from 'react' +import { MyComponent } from './my-component' + +export const result = ;