From 03143729b10517bf1b4ff3147422cacd5aa42db8 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 15 Jul 2024 11:11:40 -0700 Subject: [PATCH] Make type comparison error elaboration consistent (#58859) --- src/compiler/checker.ts | 38 +++--- src/compiler/types.ts | 5 +- .../baselines/reference/arrayFrom.errors.txt | 3 + ...typeIsAssignableToReadonlyArray.errors.txt | 5 +- ...ignmentCompatWithNumericIndexer.errors.txt | 9 +- ...gnmentCompatWithNumericIndexer2.errors.txt | 9 +- ...ignmentCompatWithObjectMembers4.errors.txt | 70 ++++++---- ...tWithObjectMembersAccessibility.errors.txt | 12 ++ ...signmentCompatWithStringIndexer.errors.txt | 18 +-- ...ignmentCompatWithStringIndexer2.errors.txt | 18 +-- ...ember-off-of-function-interface.errors.txt | 3 + ...ember-off-of-function-interface.errors.txt | 3 + .../reference/bigintWithLib.errors.txt | 12 ++ .../reference/castingTuple.errors.txt | 2 + .../reference/chainedAssignment1.errors.txt | 4 +- .../reference/chainedAssignment3.errors.txt | 5 +- .../checkJsxChildrenCanBeTupleType.errors.txt | 2 + ...nalNoInfiniteInstantiationDepth.errors.txt | 6 + .../classPropertyErrorOnNameOnly.errors.txt | 2 + ...yofReliesOnKeyofNeverUpperBound.errors.txt | 46 ++++--- .../reference/conditionalTypes1.errors.txt | 32 +++-- .../reference/covariantCallbacks.errors.txt | 15 +- .../reference/elaboratedErrors.errors.txt | 10 +- ...AnnotationAndInvalidInitializer.errors.txt | 5 +- ...functionConstraintSatisfaction2.errors.txt | 4 + tests/baselines/reference/fuzzy.errors.txt | 5 +- ...AssignmentCompatWithInterfaces1.errors.txt | 36 +++-- ...edMethodWithOverloadedArguments.errors.txt | 8 ++ ...wnNotAssignableToConcreteObject.errors.txt | 5 +- .../reference/inferTypePredicates.errors.txt | 8 ++ .../reference/inheritance1.errors.txt | 5 +- ...sxFactoryDeclarationsLocalTypes.errors.txt | 23 ++-- .../interfaceAssignmentCompat.errors.txt | 10 +- .../intersectionAndUnionTypes.errors.txt | 3 + ...nvariantGenericErrorElaboration.errors.txt | 10 +- .../iteratorSpreadInArray6.errors.txt | 8 +- .../jsxComponentTypeErrors.errors.txt | 10 ++ .../keyofAndIndexedAccess.errors.txt | 4 + .../keyofAndIndexedAccessErrors.errors.txt | 42 ++++++ .../lastPropertyInLiteralWins.errors.txt | 4 + .../reference/mappedTypeWithAny.errors.txt | 4 +- .../noUncheckedIndexedAccess.errors.txt | 40 ++++++ .../objectLiteralIndexerErrors.errors.txt | 5 +- .../objectSpreadStrictNull.errors.txt | 2 + ...ingAndNumberIndexSignatureToAny.errors.txt | 14 +- ...nWithConstraintCheckingDeferred.errors.txt | 26 ++-- .../reference/promisePermutations.errors.txt | 12 ++ .../reference/promisePermutations2.errors.txt | 12 ++ .../reference/promisePermutations3.errors.txt | 12 ++ .../promisesWithConstraints.errors.txt | 5 +- ...actDefaultPropsInferenceSuccess.errors.txt | 10 ++ ...ferredInferenceAllowsAssignment.errors.txt | 6 + .../relationComplexityError.errors.txt | 4 +- .../baselines/reference/setMethods.errors.txt | 12 ++ .../strictFunctionTypesErrors.errors.txt | 42 ++++-- ...tringMappingOverPatternLiterals.errors.txt | 10 ++ .../subclassThisTypeAssignable01.errors.txt | 2 + .../subtypingWithNumericIndexer2.errors.txt | 3 + .../subtypingWithNumericIndexer3.errors.txt | 3 + .../subtypingWithObjectMembers3.errors.txt | 25 ++-- .../subtypingWithStringIndexer2.errors.txt | 3 + .../subtypingWithStringIndexer3.errors.txt | 3 + ...eStringsWithOverloadResolution1.errors.txt | 21 +++ ...ingsWithOverloadResolution1_ES6.errors.txt | 21 +++ .../thisTypeInFunctionsNegative.errors.txt | 30 ++-- .../tsxNotUsingApparentTypeOfSFC.errors.txt | 3 + .../tsxTypeArgumentResolution.errors.txt | 4 + .../baselines/reference/tupleTypes.errors.txt | 2 + .../typeAssignabilityErrorMessage.errors.txt | 73 ++++++++++ .../typeAssignabilityErrorMessage.symbols | 105 ++++++++++++++ .../typeAssignabilityErrorMessage.types | 124 +++++++++++++++++ .../typeComparisonCaching.errors.txt | 8 +- .../typeGuardFunctionErrors.errors.txt | 8 ++ ...peGuardFunctionOfFormThisErrors.errors.txt | 10 +- .../baselines/reference/typeMatch2.errors.txt | 3 + .../typeParamExtendsOtherTypeParam.errors.txt | 3 + .../typeParameterAssignmentCompat1.errors.txt | 15 ++ .../types.asyncGenerators.es2018.2.errors.txt | 128 +++++++++++++++--- .../unionTypeCallSignatures6.errors.txt | 4 + ...unionTypeErrorMessageTypeRefs01.errors.txt | 15 +- ...eWithRecursiveSubtypeReduction2.errors.txt | 7 + .../unionTypesAssignability.errors.txt | 20 +-- .../reference/varianceAnnotations.errors.txt | 5 +- .../compiler/typeAssignabilityErrorMessage.ts | 46 +++++++ 84 files changed, 1183 insertions(+), 246 deletions(-) create mode 100644 tests/baselines/reference/typeAssignabilityErrorMessage.errors.txt create mode 100644 tests/baselines/reference/typeAssignabilityErrorMessage.symbols create mode 100644 tests/baselines/reference/typeAssignabilityErrorMessage.types create mode 100644 tests/cases/compiler/typeAssignabilityErrorMessage.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 64e7ca0a816..17eaf34b0a3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21464,7 +21464,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } const id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol); const entry = enumRelation.get(id); - if (entry !== undefined && !(!(entry & RelationComparisonResult.Reported) && entry & RelationComparisonResult.Failed && errorReporter)) { + if (entry !== undefined && !(entry & RelationComparisonResult.Failed && errorReporter)) { return !!(entry & RelationComparisonResult.Succeeded); } const targetEnumType = getTypeOfSymbol(targetSymbol); @@ -21474,11 +21474,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (!targetProperty || !(targetProperty.flags & SymbolFlags.EnumMember)) { if (errorReporter) { errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(sourceProperty), typeToString(getDeclaredTypeOfSymbol(targetSymbol), /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType)); - enumRelation.set(id, RelationComparisonResult.Failed | RelationComparisonResult.Reported); - } - else { - enumRelation.set(id, RelationComparisonResult.Failed); } + enumRelation.set(id, RelationComparisonResult.Failed); return false; } const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, SyntaxKind.EnumMember)!).value; @@ -21489,15 +21486,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // If we have 2 enums with *known* values that differ, they are incompatible. if (sourceValue !== undefined && targetValue !== undefined) { - if (!errorReporter) { - enumRelation.set(id, RelationComparisonResult.Failed); - } - else { + if (errorReporter) { const escapedSource = sourceIsString ? `"${escapeString(sourceValue)}"` : sourceValue; const escapedTarget = targetIsString ? `"${escapeString(targetValue)}"` : targetValue; errorReporter(Diagnostics.Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given, symbolName(targetSymbol), symbolName(targetProperty), escapedTarget, escapedSource); - enumRelation.set(id, RelationComparisonResult.Failed | RelationComparisonResult.Reported); } + enumRelation.set(id, RelationComparisonResult.Failed); return false; } @@ -21508,16 +21502,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Either way, we can assume that it's numeric. // If the other is a string, we have a mismatch in types. if (sourceIsString || targetIsString) { - if (!errorReporter) { - enumRelation.set(id, RelationComparisonResult.Failed); - } - else { + if (errorReporter) { const knownStringValue = sourceValue ?? targetValue; Debug.assert(typeof knownStringValue === "string"); const escapedValue = `"${escapeString(knownStringValue)}"`; errorReporter(Diagnostics.One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value, symbolName(targetSymbol), symbolName(targetProperty), escapedValue); - enumRelation.set(id, RelationComparisonResult.Failed | RelationComparisonResult.Reported); } + enumRelation.set(id, RelationComparisonResult.Failed); return false; } } @@ -21716,7 +21707,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (overflow) { // Record this relation as having failed such that we don't attempt the overflowing operation again. const id = getRelationKey(source, target, /*intersectionState*/ IntersectionState.None, relation, /*ignoreConstraints*/ false); - relation.set(id, RelationComparisonResult.Reported | RelationComparisonResult.Failed); + relation.set(id, RelationComparisonResult.Failed | (relationCount <= 0 ? RelationComparisonResult.ComplexityOverflow : RelationComparisonResult.StackDepthOverflow)); tracing?.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth }); const message = relationCount <= 0 ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : @@ -22617,9 +22608,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const id = getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ false); const entry = relation.get(id); if (entry !== undefined) { - if (reportErrors && entry & RelationComparisonResult.Failed && !(entry & RelationComparisonResult.Reported)) { - // 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. + if (reportErrors && entry & RelationComparisonResult.Failed && !(entry & RelationComparisonResult.Overflow)) { + // We are elaborating errors and the cached result is a failure not due to a comparison overflow, + // so we will do the comparison again to generate an error message. } else { if (outofbandVarianceMarkerHandler) { @@ -22632,6 +22623,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { instantiateType(source, reportUnreliableMapper); } } + if (reportErrors && entry & RelationComparisonResult.Overflow) { + const message = entry & RelationComparisonResult.ComplexityOverflow ? + Diagnostics.Excessive_complexity_comparing_types_0_and_1 : + Diagnostics.Excessive_stack_depth_comparing_types_0_and_1; + reportError(message, typeToString(source), typeToString(target)); + overrideNextErrorInfo++; + } return entry & RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False; } } @@ -22735,7 +22733,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { else { // A false result goes straight into global cache (when something is false under // assumptions it will also be false without assumptions) - relation.set(id, (reportErrors ? RelationComparisonResult.Reported : 0) | RelationComparisonResult.Failed | propagatingVarianceFlags); + relation.set(id, RelationComparisonResult.Failed | propagatingVarianceFlags); relationCount--; resetMaybeStack(/*markAllAsSucceeded*/ false); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6d8a864c30f..de1d15c4385 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -913,11 +913,14 @@ export const enum RelationComparisonResult { None = 0, Succeeded = 1 << 0, // Should be truthy Failed = 1 << 1, - Reported = 1 << 2, ReportsUnmeasurable = 1 << 3, ReportsUnreliable = 1 << 4, ReportsMask = ReportsUnmeasurable | ReportsUnreliable, + + ComplexityOverflow = 1 << 5, + StackDepthOverflow = 1 << 6, + Overflow = ComplexityOverflow | StackDepthOverflow, } /** @internal */ diff --git a/tests/baselines/reference/arrayFrom.errors.txt b/tests/baselines/reference/arrayFrom.errors.txt index 62f3045196e..db80bc19f5b 100644 --- a/tests/baselines/reference/arrayFrom.errors.txt +++ b/tests/baselines/reference/arrayFrom.errors.txt @@ -1,6 +1,7 @@ arrayFrom.ts(20,7): error TS2322: Type 'A[]' is not assignable to type 'B[]'. Property 'b' is missing in type 'A' but required in type 'B'. arrayFrom.ts(23,7): error TS2322: Type 'A[]' is not assignable to type 'B[]'. + Property 'b' is missing in type 'A' but required in type 'B'. ==== arrayFrom.ts (2 errors) ==== @@ -33,6 +34,8 @@ arrayFrom.ts(23,7): error TS2322: Type 'A[]' is not assignable to type 'B[]'. const result6: B[] = Array.from(inputALike); // expect error ~~~~~~~ !!! error TS2322: Type 'A[]' is not assignable to type 'B[]'. +!!! error TS2322: Property 'b' is missing in type 'A' but required in type 'B'. +!!! related TS2728 arrayFrom.ts:9:3: 'b' is declared here. const result7: B[] = Array.from(inputALike, ({ a }): B => ({ b: a })); const result8: A[] = Array.from(inputARand); const result9: B[] = Array.from(inputARand, ({ a }): B => ({ b: a })); diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt index 1b2f7b62be0..0c485b9253c 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt @@ -3,7 +3,7 @@ arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error TS2322: Type 'A[]' is arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C' is not assignable to type 'readonly B[]'. The types returned by 'concat(...)' are incompatible between these types. Type 'A[]' is not assignable to type 'B[]'. - Type 'A' is not assignable to type 'B'. + Property 'b' is missing in type 'A' but required in type 'B'. ==== arrayOfSubtypeIsAssignableToReadonlyArray.ts (2 errors) ==== @@ -33,5 +33,6 @@ arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C' is !!! error TS2322: Type 'C' is not assignable to type 'readonly B[]'. !!! error TS2322: The types returned by 'concat(...)' are incompatible between these types. !!! error TS2322: Type 'A[]' is not assignable to type 'B[]'. -!!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: Property 'b' is missing in type 'A' but required in type 'B'. +!!! related TS2728 arrayOfSubtypeIsAssignableToReadonlyArray.ts:2:21: 'b' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt index 60335630beb..f990fc308dc 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt @@ -11,7 +11,7 @@ assignmentCompatWithNumericIndexer.ts(32,9): error TS2322: Type '{ [x: number]: assignmentCompatWithNumericIndexer.ts(33,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. 'number' index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithNumericIndexer.ts(36,9): error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A'. 'number' index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. @@ -19,7 +19,7 @@ assignmentCompatWithNumericIndexer.ts(36,9): error TS2322: Type '{ [x: number]: assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. 'number' index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. - Type 'Base' is not assignable to type 'Derived2'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar ==== assignmentCompatWithNumericIndexer.ts (6 errors) ==== @@ -74,7 +74,8 @@ assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not as !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. !!! error TS2322: 'number' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived'. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithNumericIndexer.ts:4:34: 'bar' is declared here. var b2: { [x: number]: Derived2; } a = b2; // error @@ -88,7 +89,7 @@ assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not as !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. !!! error TS2322: 'number' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2'. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar var b3: { [x: number]: T; } a = b3; // ok diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt index 019fcf237be..0afe61148c6 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt @@ -11,7 +11,7 @@ assignmentCompatWithNumericIndexer2.ts(32,9): error TS2322: Type '{ [x: number]: assignmentCompatWithNumericIndexer2.ts(33,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. 'number' index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithNumericIndexer2.ts(36,9): error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A'. 'number' index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. @@ -19,7 +19,7 @@ assignmentCompatWithNumericIndexer2.ts(36,9): error TS2322: Type '{ [x: number]: assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. 'number' index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. - Type 'Base' is not assignable to type 'Derived2'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar ==== assignmentCompatWithNumericIndexer2.ts (6 errors) ==== @@ -74,7 +74,8 @@ assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A' is not a !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. !!! error TS2322: 'number' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived'. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithNumericIndexer2.ts:4:34: 'bar' is declared here. var b2: { [x: number]: Derived2; } a = b2; // error @@ -88,7 +89,7 @@ assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A' is not a !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. !!! error TS2322: 'number' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2'. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar var b3: { [x: number]: T; } a = b3; // ok diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt index 861a8174328..72885e82376 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt @@ -6,49 +6,49 @@ assignmentCompatWithObjectMembers4.ts(25,5): error TS2322: Type 'S' is not assig Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. assignmentCompatWithObjectMembers4.ts(29,5): error TS2322: Type 'T2' is not assignable to type 'S2'. Types of property 'foo' are incompatible. - Type 'Derived2' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. assignmentCompatWithObjectMembers4.ts(30,5): error TS2322: Type 'S2' is not assignable to type 'T2'. Types of property 'foo' are incompatible. - Type 'Derived' is not assignable to type 'Derived2'. + Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. assignmentCompatWithObjectMembers4.ts(31,5): error TS2322: Type 'T' is not assignable to type 'S2'. Types of property 'foo' are incompatible. - Type 'Derived2' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. assignmentCompatWithObjectMembers4.ts(32,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type 'S2'. Types of property 'foo' are incompatible. - Type 'Derived2' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. assignmentCompatWithObjectMembers4.ts(35,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'. Types of property 'foo' are incompatible. - Type 'Derived2' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. assignmentCompatWithObjectMembers4.ts(36,5): error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }'. Types of property 'foo' are incompatible. - Type 'Derived' is not assignable to type 'Derived2'. + Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. assignmentCompatWithObjectMembers4.ts(41,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'. Types of property 'foo' are incompatible. - Type 'Derived2' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. assignmentCompatWithObjectMembers4.ts(42,5): error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }'. Types of property 'foo' are incompatible. - Type 'Derived' is not assignable to type 'Derived2'. + Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. assignmentCompatWithObjectMembers4.ts(43,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'. Types of property 'foo' are incompatible. - Type 'Derived2' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. assignmentCompatWithObjectMembers4.ts(44,5): error TS2322: Type 'T2' is not assignable to type '{ foo: Derived; }'. Types of property 'foo' are incompatible. - Type 'Derived2' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. assignmentCompatWithObjectMembers4.ts(45,5): error TS2322: Type 'T' is not assignable to type '{ foo: Derived; }'. Types of property 'foo' are incompatible. - Type 'Derived2' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. assignmentCompatWithObjectMembers4.ts(70,5): error TS2322: Type 'S' is not assignable to type 'T'. Types of property 'foo' are incompatible. Property 'baz' is missing in type 'Base' but required in type 'Derived2'. assignmentCompatWithObjectMembers4.ts(75,5): error TS2322: Type 'S2' is not assignable to type 'T2'. Types of property 'foo' are incompatible. - Type 'Base' is not assignable to type 'Derived2'. + Property 'baz' is missing in type 'Base' but required in type 'Derived2'. assignmentCompatWithObjectMembers4.ts(81,5): error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }'. Types of property 'foo' are incompatible. - Type 'Base' is not assignable to type 'Derived2'. + Property 'baz' is missing in type 'Base' but required in type 'Derived2'. assignmentCompatWithObjectMembers4.ts(87,5): error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }'. Types of property 'foo' are incompatible. - Type 'Base' is not assignable to type 'Derived2'. + Property 'baz' is missing in type 'Base' but required in type 'Derived2'. ==== assignmentCompatWithObjectMembers4.ts (17 errors) ==== @@ -94,34 +94,40 @@ assignmentCompatWithObjectMembers4.ts(87,5): error TS2322: Type '{ foo: Base; }' ~~ !!! error TS2322: Type 'T2' is not assignable to type 'S2'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:5:34: 'bar' is declared here. t2 = s2; // error ~~ !!! error TS2322: Type 'S2' is not assignable to type 'T2'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2'. +!!! error TS2322: Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:6:35: 'baz' is declared here. s2 = t; // error ~~ !!! error TS2322: Type 'T' is not assignable to type 'S2'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:5:34: 'bar' is declared here. s2 = b; // error ~~ !!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type 'S2'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:5:34: 'bar' is declared here. s2 = a2; // ok a = b; // error ~ !!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:5:34: 'bar' is declared here. b = a; // error ~ !!! error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2'. +!!! error TS2322: Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:6:35: 'baz' is declared here. a = s; // ok a = s2; // ok a = a2; // ok @@ -130,27 +136,32 @@ assignmentCompatWithObjectMembers4.ts(87,5): error TS2322: Type '{ foo: Base; }' ~~ !!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:5:34: 'bar' is declared here. b2 = a2; // error ~~ !!! error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2'. +!!! error TS2322: Property 'baz' is missing in type 'Derived' but required in type 'Derived2'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:6:35: 'baz' is declared here. a2 = b; // error ~~ !!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:5:34: 'bar' is declared here. a2 = t2; // error ~~ !!! error TS2322: Type 'T2' is not assignable to type '{ foo: Derived; }'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:5:34: 'bar' is declared here. a2 = t; // error ~~ !!! error TS2322: Type 'T' is not assignable to type '{ foo: Derived; }'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Derived2' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:5:34: 'bar' is declared here. } module WithBase { @@ -189,7 +200,8 @@ assignmentCompatWithObjectMembers4.ts(87,5): error TS2322: Type '{ foo: Base; }' ~~ !!! error TS2322: Type 'S2' is not assignable to type 'T2'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. +!!! error TS2322: Property 'baz' is missing in type 'Base' but required in type 'Derived2'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:51:35: 'baz' is declared here. s2 = t; // ok s2 = b; // ok s2 = a2; // ok @@ -199,7 +211,8 @@ assignmentCompatWithObjectMembers4.ts(87,5): error TS2322: Type '{ foo: Base; }' ~ !!! error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. +!!! error TS2322: Property 'baz' is missing in type 'Base' but required in type 'Derived2'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:51:35: 'baz' is declared here. a = s; // ok a = s2; // ok a = a2; // ok @@ -209,7 +222,8 @@ assignmentCompatWithObjectMembers4.ts(87,5): error TS2322: Type '{ foo: Base; }' ~~ !!! error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. +!!! error TS2322: Property 'baz' is missing in type 'Base' but required in type 'Derived2'. +!!! related TS2728 assignmentCompatWithObjectMembers4.ts:51:35: 'baz' is declared here. a2 = b; // ok a2 = t2; // ok a2 = t; // ok diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt index 654349412cc..1a1a1012004 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt @@ -17,6 +17,7 @@ assignmentCompatWithObjectMembersAccessibility.ts(51,5): error TS2322: Type 'D' assignmentCompatWithObjectMembersAccessibility.ts(81,5): error TS2322: Type 'Base' is not assignable to type '{ foo: string; }'. Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. assignmentCompatWithObjectMembersAccessibility.ts(82,5): error TS2322: Type 'I' is not assignable to type '{ foo: string; }'. + Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. assignmentCompatWithObjectMembersAccessibility.ts(84,5): error TS2322: Type 'E' is not assignable to type '{ foo: string; }'. Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. assignmentCompatWithObjectMembersAccessibility.ts(86,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'Base'. @@ -26,11 +27,15 @@ assignmentCompatWithObjectMembersAccessibility.ts(88,5): error TS2322: Type 'D' assignmentCompatWithObjectMembersAccessibility.ts(89,5): error TS2322: Type 'E' is not assignable to type 'Base'. Types have separate declarations of a private property 'foo'. assignmentCompatWithObjectMembersAccessibility.ts(92,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'I'. + Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. assignmentCompatWithObjectMembersAccessibility.ts(94,5): error TS2322: Type 'D' is not assignable to type 'I'. + Property 'foo' is private in type 'Base' but not in type 'D'. assignmentCompatWithObjectMembersAccessibility.ts(95,5): error TS2322: Type 'E' is not assignable to type 'I'. + Types have separate declarations of a private property 'foo'. assignmentCompatWithObjectMembersAccessibility.ts(99,5): error TS2322: Type 'Base' is not assignable to type 'D'. Property 'foo' is private in type 'Base' but not in type 'D'. assignmentCompatWithObjectMembersAccessibility.ts(100,5): error TS2322: Type 'I' is not assignable to type 'D'. + Property 'foo' is private in type 'Base' but not in type 'D'. assignmentCompatWithObjectMembersAccessibility.ts(101,5): error TS2322: Type 'E' is not assignable to type 'D'. Property 'foo' is private in type 'E' but not in type 'D'. assignmentCompatWithObjectMembersAccessibility.ts(103,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'E'. @@ -38,6 +43,7 @@ assignmentCompatWithObjectMembersAccessibility.ts(103,5): error TS2322: Type '{ assignmentCompatWithObjectMembersAccessibility.ts(104,5): error TS2322: Type 'Base' is not assignable to type 'E'. Types have separate declarations of a private property 'foo'. assignmentCompatWithObjectMembersAccessibility.ts(105,5): error TS2322: Type 'I' is not assignable to type 'E'. + Types have separate declarations of a private property 'foo'. assignmentCompatWithObjectMembersAccessibility.ts(106,5): error TS2322: Type 'D' is not assignable to type 'E'. Property 'foo' is private in type 'E' but not in type 'D'. @@ -154,6 +160,7 @@ assignmentCompatWithObjectMembersAccessibility.ts(106,5): error TS2322: Type 'D' a = i; // error ~ !!! error TS2322: Type 'I' is not assignable to type '{ foo: string; }'. +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. a = d; a = e; // error ~ @@ -178,13 +185,16 @@ assignmentCompatWithObjectMembersAccessibility.ts(106,5): error TS2322: Type 'D' i = a; // error ~ !!! error TS2322: Type '{ foo: string; }' is not assignable to type 'I'. +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. i = b; i = d; // error ~ !!! error TS2322: Type 'D' is not assignable to type 'I'. +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type 'D'. i = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type 'I'. +!!! error TS2322: Types have separate declarations of a private property 'foo'. i = i; d = a; @@ -195,6 +205,7 @@ assignmentCompatWithObjectMembersAccessibility.ts(106,5): error TS2322: Type 'D' d = i; // error ~ !!! error TS2322: Type 'I' is not assignable to type 'D'. +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type 'D'. d = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type 'D'. @@ -211,6 +222,7 @@ assignmentCompatWithObjectMembersAccessibility.ts(106,5): error TS2322: Type 'D' e = i; // errror ~ !!! error TS2322: Type 'I' is not assignable to type 'E'. +!!! error TS2322: Types have separate declarations of a private property 'foo'. e = d; // errror ~ !!! error TS2322: Type 'D' is not assignable to type 'E'. diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt index cb6e1cf7a01..ea6734d5a86 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt @@ -6,10 +6,10 @@ assignmentCompatWithStringIndexer.ts(19,1): error TS2322: Type 'A' is not assign Type 'Base' is missing the following properties from type 'Derived2': baz, bar assignmentCompatWithStringIndexer.ts(33,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. 'string' index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithStringIndexer.ts(41,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived2'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar assignmentCompatWithStringIndexer.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. 'string' index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. @@ -17,7 +17,7 @@ assignmentCompatWithStringIndexer.ts(46,9): error TS2322: Type '{ [x: string]: D assignmentCompatWithStringIndexer.ts(47,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. 'string' index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithStringIndexer.ts(50,9): error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A'. 'string' index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. @@ -25,7 +25,7 @@ assignmentCompatWithStringIndexer.ts(50,9): error TS2322: Type '{ [x: string]: D assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. - Type 'Base' is not assignable to type 'Derived2'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar ==== assignmentCompatWithStringIndexer.ts (8 errors) ==== @@ -74,7 +74,8 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not ass ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. !!! error TS2322: 'string' index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithStringIndexer.ts:4:34: 'bar' is declared here. class B2 extends A { [x: string]: Derived2; // ok @@ -86,7 +87,7 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not ass ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: 'string' index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar function foo() { var b3: { [x: string]: Derived; }; @@ -102,7 +103,8 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not ass !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. !!! error TS2322: 'string' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived'. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithStringIndexer.ts:4:34: 'bar' is declared here. var b4: { [x: string]: Derived2; }; a3 = b4; // error @@ -116,6 +118,6 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not ass !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: 'string' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2'. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt index 5f76ae541c9..c330a9fa38b 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt @@ -6,10 +6,10 @@ assignmentCompatWithStringIndexer2.ts(19,1): error TS2322: Type 'A' is not assig Type 'Base' is missing the following properties from type 'Derived2': baz, bar assignmentCompatWithStringIndexer2.ts(33,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. 'string' index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithStringIndexer2.ts(41,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. - Type 'Base' is not assignable to type 'Derived2'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar assignmentCompatWithStringIndexer2.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. 'string' index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. @@ -17,7 +17,7 @@ assignmentCompatWithStringIndexer2.ts(46,9): error TS2322: Type '{ [x: string]: assignmentCompatWithStringIndexer2.ts(47,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. 'string' index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithStringIndexer2.ts(50,9): error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A'. 'string' index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. @@ -25,7 +25,7 @@ assignmentCompatWithStringIndexer2.ts(50,9): error TS2322: Type '{ [x: string]: assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. - Type 'Base' is not assignable to type 'Derived2'. + Type 'Base' is missing the following properties from type 'Derived2': baz, bar ==== assignmentCompatWithStringIndexer2.ts (8 errors) ==== @@ -74,7 +74,8 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not as ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. !!! error TS2322: 'string' index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithStringIndexer2.ts:4:34: 'bar' is declared here. interface B2 extends A { [x: string]: Derived2; // ok @@ -86,7 +87,7 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not as ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: 'string' index signatures are incompatible. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar function foo() { var b3: { [x: string]: Derived; }; @@ -102,7 +103,8 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not as !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. !!! error TS2322: 'string' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived'. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2322: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 assignmentCompatWithStringIndexer2.ts:4:34: 'bar' is declared here. var b4: { [x: string]: Derived2; }; a3 = b4; // error @@ -116,6 +118,6 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not as !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: 'string' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2'. -!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'. +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt b/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt index 3816de11cc0..c632f41dba0 100644 --- a/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt +++ b/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt @@ -4,6 +4,7 @@ assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1) assignmentCompatability_checking-apply-member-off-of-function-interface.ts(13,1): error TS2741: Property 'apply' is missing in type '{}' but required in type 'Applicable'. assignmentCompatability_checking-apply-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'. assignmentCompatability_checking-apply-member-off-of-function-interface.ts(23,4): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Applicable'. + Property 'apply' is missing in type 'string[]' but required in type 'Applicable'. assignmentCompatability_checking-apply-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Applicable'. assignmentCompatability_checking-apply-member-off-of-function-interface.ts(25,4): error TS2345: Argument of type '{}' is not assignable to parameter of type 'Applicable'. Property 'apply' is missing in type '{}' but required in type 'Applicable'. @@ -47,6 +48,8 @@ assignmentCompatability_checking-apply-member-off-of-function-interface.ts(25,4) fn(['']); ~~~~ !!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Applicable'. +!!! error TS2345: Property 'apply' is missing in type 'string[]' but required in type 'Applicable'. +!!! related TS2728 assignmentCompatability_checking-apply-member-off-of-function-interface.ts:4:5: 'apply' is declared here. fn(4); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Applicable'. diff --git a/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt b/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt index 5937ea7e1b3..c294e804251 100644 --- a/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt +++ b/tests/baselines/reference/assignmentCompatability_checking-call-member-off-of-function-interface.errors.txt @@ -4,6 +4,7 @@ assignmentCompatability_checking-call-member-off-of-function-interface.ts(12,1): assignmentCompatability_checking-call-member-off-of-function-interface.ts(13,1): error TS2741: Property 'call' is missing in type '{}' but required in type 'Callable'. assignmentCompatability_checking-call-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Callable'. assignmentCompatability_checking-call-member-off-of-function-interface.ts(23,4): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Callable'. + Property 'call' is missing in type 'string[]' but required in type 'Callable'. assignmentCompatability_checking-call-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Callable'. assignmentCompatability_checking-call-member-off-of-function-interface.ts(25,4): error TS2345: Argument of type '{}' is not assignable to parameter of type 'Callable'. Property 'call' is missing in type '{}' but required in type 'Callable'. @@ -47,6 +48,8 @@ assignmentCompatability_checking-call-member-off-of-function-interface.ts(25,4): fn(['']); ~~~~ !!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Callable'. +!!! error TS2345: Property 'call' is missing in type 'string[]' but required in type 'Callable'. +!!! related TS2728 assignmentCompatability_checking-call-member-off-of-function-interface.ts:4:5: 'call' is declared here. fn(4); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Callable'. diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index aa402ec0cba..74057e3a243 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -18,8 +18,14 @@ bigintWithLib.ts(31,35): error TS2769: No overload matches this call. Argument of type 'number[]' is not assignable to parameter of type 'number'. Overload 2 of 3, '(array: Iterable): BigUint64Array', gave the following error. Argument of type 'number[]' is not assignable to parameter of type 'Iterable'. + The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'number' is not assignable to type 'bigint'. Overload 3 of 3, '(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array', gave the following error. Argument of type 'number[]' is not assignable to parameter of type 'ArrayBufferLike'. + Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag] bigintWithLib.ts(36,13): error TS2540: Cannot assign to 'length' because it is a read-only property. bigintWithLib.ts(43,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'. bigintWithLib.ts(46,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'. @@ -81,8 +87,14 @@ bigintWithLib.ts(46,26): error TS2345: Argument of type 'number' is not assignab !!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 3, '(array: Iterable): BigUint64Array', gave the following error. !!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'Iterable'. +!!! error TS2769: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types. +!!! error TS2769: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2769: Type 'number' is not assignable to type 'bigint'. !!! error TS2769: Overload 3 of 3, '(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array', gave the following error. !!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBufferLike'. +!!! error TS2769: Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag] bigUintArray = new BigUint64Array(new ArrayBuffer(80)); bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8); bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3); diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt index 16cbceb4748..0a2b933f57d 100644 --- a/tests/baselines/reference/castingTuple.errors.txt +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -3,6 +3,7 @@ castingTuple.ts(13,23): error TS2352: Conversion of type '[number, string]' to t castingTuple.ts(14,15): error TS2352: Conversion of type '[number, string, boolean]' to type '[number, string]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Source has 3 element(s) but target allows only 2. castingTuple.ts(15,14): error TS2352: Conversion of type '[number, string]' to type '[number, string, boolean]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + Source has 2 element(s) but target requires 3. castingTuple.ts(18,21): error TS2352: Conversion of type '[C, D]' to type '[C, D, A]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Source has 2 element(s) but target requires 3. castingTuple.ts(20,33): error TS2493: Tuple type '[C, D, A]' of length '3' has no element at index '5'. @@ -40,6 +41,7 @@ castingTuple.ts(33,1): error TS2304: Cannot find name 't4'. var longer = numStrTuple as [number, string, boolean] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Conversion of type '[number, string]' to type '[number, string, boolean]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. +!!! error TS2352: Source has 2 element(s) but target requires 3. var classCDTuple: [C, D] = [new C(), new D()]; var interfaceIITuple = <[I, I]>classCDTuple; var classCDATuple = <[C, D, A]>classCDTuple; diff --git a/tests/baselines/reference/chainedAssignment1.errors.txt b/tests/baselines/reference/chainedAssignment1.errors.txt index fad32e7ea26..7892dd2bd4b 100644 --- a/tests/baselines/reference/chainedAssignment1.errors.txt +++ b/tests/baselines/reference/chainedAssignment1.errors.txt @@ -1,6 +1,6 @@ chainedAssignment1.ts(21,1): error TS2741: Property 'a' is missing in type 'Z' but required in type 'X'. chainedAssignment1.ts(21,6): error TS2739: Type 'Z' is missing the following properties from type 'Y': a, b -chainedAssignment1.ts(22,1): error TS2322: Type 'Z' is not assignable to type 'Y'. +chainedAssignment1.ts(22,1): error TS2739: Type 'Z' is missing the following properties from type 'Y': a, b ==== chainedAssignment1.ts (3 errors) ==== @@ -32,4 +32,4 @@ chainedAssignment1.ts(22,1): error TS2322: Type 'Z' is not assignable to type 'Y !!! error TS2739: Type 'Z' is missing the following properties from type 'Y': a, b c2 = c3; // Error TS111: Cannot convert Z to Y ~~ -!!! error TS2322: Type 'Z' is not assignable to type 'Y'. \ No newline at end of file +!!! error TS2739: Type 'Z' is missing the following properties from type 'Y': a, b \ No newline at end of file diff --git a/tests/baselines/reference/chainedAssignment3.errors.txt b/tests/baselines/reference/chainedAssignment3.errors.txt index b33f6d87a2c..81f05df13d7 100644 --- a/tests/baselines/reference/chainedAssignment3.errors.txt +++ b/tests/baselines/reference/chainedAssignment3.errors.txt @@ -1,5 +1,5 @@ chainedAssignment3.ts(18,1): error TS2741: Property 'value' is missing in type 'A' but required in type 'B'. -chainedAssignment3.ts(19,5): error TS2322: Type 'A' is not assignable to type 'B'. +chainedAssignment3.ts(19,5): error TS2741: Property 'value' is missing in type 'A' but required in type 'B'. ==== chainedAssignment3.ts (2 errors) ==== @@ -26,7 +26,8 @@ chainedAssignment3.ts(19,5): error TS2322: Type 'A' is not assignable to type 'B !!! related TS2728 chainedAssignment3.ts:6:5: 'value' is declared here. a = b = new A(); ~ -!!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2741: Property 'value' is missing in type 'A' but required in type 'B'. +!!! related TS2728 chainedAssignment3.ts:6:5: 'value' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt index 5736290f8a1..cc60334c1e3 100644 --- a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt @@ -8,6 +8,7 @@ checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2769: No overload matches thi Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. Types of property 'children' are incompatible. Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. + Source has 3 element(s) but target allows only 2. ==== checkJsxChildrenCanBeTupleType.tsx (1 errors) ==== @@ -39,6 +40,7 @@ checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2769: No overload matches thi !!! error TS2769: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. !!! error TS2769: Types of property 'children' are incompatible. !!! error TS2769: Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. +!!! error TS2769: Source has 3 element(s) but target allows only 2.
diff --git a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt index 8a32b0c5807..7c65a0c335a 100644 --- a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt +++ b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt @@ -7,6 +7,9 @@ circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof TInjectedProps & string] | TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. ==== circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts (1 errors) ==== @@ -83,4 +86,7 @@ circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth !!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. !!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. !!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof TInjectedProps & string] | TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt index dd476a60fe7..a56ad9e9caf 100644 --- a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt +++ b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt @@ -3,6 +3,7 @@ classPropertyErrorOnNameOnly.ts(7,3): error TS2322: Type '(val: Values) => "1" | Type 'undefined' is not assignable to type 'string'. classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. Type 'string | undefined' is not assignable to type 'string'. + Type 'undefined' is not assignable to type 'string'. ==== classPropertyErrorOnNameOnly.ts (2 errors) ==== @@ -37,6 +38,7 @@ classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type '(val: Values) => "1" ~~~~~~~~~~~~ !!! error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. !!! error TS2322: Type 'string | undefined' is not assignable to type 'string'. +!!! error TS2322: Type 'undefined' is not assignable to type 'string'. switch (val) { case 1: return "1"; diff --git a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt index 7d80efe6b38..0ee31ce889f 100644 --- a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt +++ b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt @@ -5,18 +5,23 @@ complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.ts(33,5): error TS2322 Type 'string' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. Type 'string' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. Type 'string' is not assignable to type 'ChannelOfType["type"]'. - Type 'T' is not assignable to type 'ChannelOfType["type"]'. - Type 'string' is not assignable to type 'ChannelOfType["type"]'. - Type 'string' is not assignable to type 'ChannelOfType["type"]'. - Type '"text"' is not assignable to type 'T & "text"'. - Type 'T' is not assignable to type 'T & "text"'. - Type '"text" | "email"' is not assignable to type 'T & "text"'. + Type '"text"' is not assignable to type 'T & "text"'. + Type '"text"' is not assignable to type 'T'. + '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. + Type 'T' is not assignable to type 'ChannelOfType["type"]'. + Type 'string' is not assignable to type 'ChannelOfType["type"]'. + Type 'string' is not assignable to type 'ChannelOfType["type"]'. Type '"text"' is not assignable to type 'T & "text"'. Type '"text"' is not assignable to type 'T'. '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. - Type 'T' is not assignable to type '"text"'. - Type '"text" | "email"' is not assignable to type '"text"'. - Type '"email"' is not assignable to type '"text"'. + Type 'T' is not assignable to type 'T & "text"'. + Type '"text" | "email"' is not assignable to type 'T & "text"'. + Type '"text"' is not assignable to type 'T & "text"'. + Type '"text"' is not assignable to type 'T'. + '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. + Type 'T' is not assignable to type '"text"'. + Type '"text" | "email"' is not assignable to type '"text"'. + Type '"email"' is not assignable to type '"text"'. ==== complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.ts (1 errors) ==== @@ -61,18 +66,23 @@ complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.ts(33,5): error TS2322 !!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. !!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. !!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"]'. -!!! error TS2322: Type 'T' is not assignable to type 'ChannelOfType["type"]'. -!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"]'. -!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"]'. -!!! error TS2322: Type '"text"' is not assignable to type 'T & "text"'. -!!! error TS2322: Type 'T' is not assignable to type 'T & "text"'. -!!! error TS2322: Type '"text" | "email"' is not assignable to type 'T & "text"'. +!!! error TS2322: Type '"text"' is not assignable to type 'T & "text"'. +!!! error TS2322: Type '"text"' is not assignable to type 'T'. +!!! error TS2322: '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. +!!! error TS2322: Type 'T' is not assignable to type 'ChannelOfType["type"]'. +!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"]'. +!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"]'. !!! error TS2322: Type '"text"' is not assignable to type 'T & "text"'. !!! error TS2322: Type '"text"' is not assignable to type 'T'. !!! error TS2322: '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. -!!! error TS2322: Type 'T' is not assignable to type '"text"'. -!!! error TS2322: Type '"text" | "email"' is not assignable to type '"text"'. -!!! error TS2322: Type '"email"' is not assignable to type '"text"'. +!!! error TS2322: Type 'T' is not assignable to type 'T & "text"'. +!!! error TS2322: Type '"text" | "email"' is not assignable to type 'T & "text"'. +!!! error TS2322: Type '"text"' is not assignable to type 'T & "text"'. +!!! error TS2322: Type '"text"' is not assignable to type 'T'. +!!! error TS2322: '"text"' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. +!!! error TS2322: Type 'T' is not assignable to type '"text"'. +!!! error TS2322: Type '"text" | "email"' is not assignable to type '"text"'. +!!! error TS2322: Type '"email"' is not assignable to type '"text"'. } const newTextChannel = makeNewChannel('text'); diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index ea66f14d927..aa2ae24033b 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -37,20 +37,28 @@ conditionalTypes1.ts(108,5): error TS2322: Type 'FunctionProperties' is not a Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. Type 'keyof T' is not assignable to type 'never'. + Type 'string | number | symbol' is not assignable to type 'never'. + Type 'string' is not assignable to type 'never'. conditionalTypes1.ts(114,5): error TS2322: Type 'keyof T' is not assignable to type 'FunctionPropertyNames'. Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. conditionalTypes1.ts(115,5): error TS2322: Type 'NonFunctionPropertyNames' is not assignable to type 'FunctionPropertyNames'. Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. - Type 'keyof T' is not assignable to type 'never'. - Type 'string | number | symbol' is not assignable to type 'never'. - Type 'string' is not assignable to type 'never'. + Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. + Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. + Type 'keyof T' is not assignable to type 'never'. + Type 'string | number | symbol' is not assignable to type 'never'. + Type 'string' is not assignable to type 'never'. conditionalTypes1.ts(116,5): error TS2322: Type 'keyof T' is not assignable to type 'NonFunctionPropertyNames'. Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. conditionalTypes1.ts(117,5): error TS2322: Type 'FunctionPropertyNames' is not assignable to type 'NonFunctionPropertyNames'. Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. - Type 'keyof T' is not assignable to type 'never'. + Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. + Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. + Type 'keyof T' is not assignable to type 'never'. + Type 'string | number | symbol' is not assignable to type 'never'. + Type 'string' is not assignable to type 'never'. conditionalTypes1.ts(134,10): error TS2540: Cannot assign to 'id' because it is a read-only property. conditionalTypes1.ts(135,5): error TS2542: Index signature in type 'DeepReadonlyArray' only permits reading. conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is a read-only property. @@ -229,6 +237,8 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95' is not assignable to t !!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. !!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. !!! error TS2322: Type 'keyof T' is not assignable to type 'never'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'. +!!! error TS2322: Type 'string' is not assignable to type 'never'. } function f8(x: keyof T, y: FunctionPropertyNames, z: NonFunctionPropertyNames) { @@ -243,9 +253,11 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95' is not assignable to t ~ !!! error TS2322: Type 'NonFunctionPropertyNames' is not assignable to type 'FunctionPropertyNames'. !!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. -!!! error TS2322: Type 'keyof T' is not assignable to type 'never'. -!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'. -!!! error TS2322: Type 'string' is not assignable to type 'never'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. +!!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'never'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'. +!!! error TS2322: Type 'string' is not assignable to type 'never'. z = x; // Error ~ !!! error TS2322: Type 'keyof T' is not assignable to type 'NonFunctionPropertyNames'. @@ -255,7 +267,11 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95' is not assignable to t ~ !!! error TS2322: Type 'FunctionPropertyNames' is not assignable to type 'NonFunctionPropertyNames'. !!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. -!!! error TS2322: Type 'keyof T' is not assignable to type 'never'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. +!!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'never'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'. +!!! error TS2322: Type 'string' is not assignable to type 'never'. } type DeepReadonly = diff --git a/tests/baselines/reference/covariantCallbacks.errors.txt b/tests/baselines/reference/covariantCallbacks.errors.txt index 7a9e34234fc..0df9028e132 100644 --- a/tests/baselines/reference/covariantCallbacks.errors.txt +++ b/tests/baselines/reference/covariantCallbacks.errors.txt @@ -1,13 +1,13 @@ covariantCallbacks.ts(12,5): error TS2322: Type 'P' is not assignable to type 'P'. Property 'b' is missing in type 'A' but required in type 'B'. covariantCallbacks.ts(17,5): error TS2322: Type 'Promise' is not assignable to type 'Promise'. - Type 'A' is not assignable to type 'B'. + Property 'b' is missing in type 'A' but required in type 'B'. covariantCallbacks.ts(30,5): error TS2322: Type 'AList1' is not assignable to type 'BList1'. Types of property 'forEach' are incompatible. Type '(cb: (item: A) => void) => void' is not assignable to type '(cb: (item: B) => void) => void'. Types of parameters 'cb' and 'cb' are incompatible. Types of parameters 'item' and 'item' are incompatible. - Type 'A' is not assignable to type 'B'. + Property 'b' is missing in type 'A' but required in type 'B'. covariantCallbacks.ts(43,5): error TS2322: Type 'AList2' is not assignable to type 'BList2'. Types of property 'forEach' are incompatible. Types of parameters 'cb' and 'cb' are incompatible. @@ -22,7 +22,7 @@ covariantCallbacks.ts(69,5): error TS2322: Type 'AList4' is not assignable to ty Type '(cb: (item: A) => A) => void' is not assignable to type '(cb: (item: B) => B) => void'. Types of parameters 'cb' and 'cb' are incompatible. Types of parameters 'item' and 'item' are incompatible. - Type 'A' is not assignable to type 'B'. + Property 'b' is missing in type 'A' but required in type 'B'. covariantCallbacks.ts(98,1): error TS2322: Type 'SetLike1<(x: string) => void>' is not assignable to type 'SetLike1<(x: unknown) => void>'. Type '(x: string) => void' is not assignable to type '(x: unknown) => void'. Types of parameters 'x' and 'x' are incompatible. @@ -58,7 +58,8 @@ covariantCallbacks.ts(106,1): error TS2322: Type 'SetLike2<(x: string) => void>' b = a; // Error ~ !!! error TS2322: Type 'Promise' is not assignable to type 'Promise'. -!!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: Property 'b' is missing in type 'A' but required in type 'B'. +!!! related TS2728 covariantCallbacks.ts:8:25: 'b' is declared here. } interface AList1 { @@ -78,7 +79,8 @@ covariantCallbacks.ts(106,1): error TS2322: Type 'SetLike2<(x: string) => void>' !!! error TS2322: Type '(cb: (item: A) => void) => void' is not assignable to type '(cb: (item: B) => void) => void'. !!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: Property 'b' is missing in type 'A' but required in type 'B'. +!!! related TS2728 covariantCallbacks.ts:8:25: 'b' is declared here. } interface AList2 { @@ -135,7 +137,8 @@ covariantCallbacks.ts(106,1): error TS2322: Type 'SetLike2<(x: string) => void>' !!! error TS2322: Type '(cb: (item: A) => A) => void' is not assignable to type '(cb: (item: B) => B) => void'. !!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: Property 'b' is missing in type 'A' but required in type 'B'. +!!! related TS2728 covariantCallbacks.ts:8:25: 'b' is declared here. } // Repro from #51620 diff --git a/tests/baselines/reference/elaboratedErrors.errors.txt b/tests/baselines/reference/elaboratedErrors.errors.txt index 4533af3bbeb..509bfa220d6 100644 --- a/tests/baselines/reference/elaboratedErrors.errors.txt +++ b/tests/baselines/reference/elaboratedErrors.errors.txt @@ -1,9 +1,9 @@ elaboratedErrors.ts(11,3): error TS2416: Property 'read' in type 'WorkerFS' is not assignable to the same property in base type 'FileSystem'. Type 'string' is not assignable to type 'number'. elaboratedErrors.ts(20,1): error TS2741: Property 'x' is missing in type 'Beta' but required in type 'Alpha'. -elaboratedErrors.ts(21,1): error TS2322: Type 'Beta' is not assignable to type 'Alpha'. +elaboratedErrors.ts(21,1): error TS2741: Property 'x' is missing in type 'Beta' but required in type 'Alpha'. elaboratedErrors.ts(24,1): error TS2741: Property 'y' is missing in type 'Alpha' but required in type 'Beta'. -elaboratedErrors.ts(25,1): error TS2322: Type 'Alpha' is not assignable to type 'Beta'. +elaboratedErrors.ts(25,1): error TS2741: Property 'y' is missing in type 'Alpha' but required in type 'Beta'. ==== elaboratedErrors.ts (5 errors) ==== @@ -35,7 +35,8 @@ elaboratedErrors.ts(25,1): error TS2322: Type 'Alpha' is not assignable to type !!! related TS2728 elaboratedErrors.ts:14:19: 'x' is declared here. x = y; ~ -!!! error TS2322: Type 'Beta' is not assignable to type 'Alpha'. +!!! error TS2741: Property 'x' is missing in type 'Beta' but required in type 'Alpha'. +!!! related TS2728 elaboratedErrors.ts:14:19: 'x' is declared here. // Only one of these errors should be large y = x; @@ -44,5 +45,6 @@ elaboratedErrors.ts(25,1): error TS2322: Type 'Alpha' is not assignable to type !!! related TS2728 elaboratedErrors.ts:15:18: 'y' is declared here. y = x; ~ -!!! error TS2322: Type 'Alpha' is not assignable to type 'Beta'. +!!! error TS2741: Property 'y' is missing in type 'Alpha' but required in type 'Beta'. +!!! related TS2728 elaboratedErrors.ts:15:18: 'y' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt index 4b04c7ac161..c5e9a1bf5f4 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt @@ -19,7 +19,7 @@ everyTypeWithAnnotationAndInvalidInitializer.ts(48,32): error TS2322: Type 'stri everyTypeWithAnnotationAndInvalidInitializer.ts(50,5): error TS2322: Type 'typeof N' is not assignable to type 'typeof M'. The types returned by 'new A()' are incompatible between these types. Property 'name' is missing in type 'N.A' but required in type 'M.A'. -everyTypeWithAnnotationAndInvalidInitializer.ts(51,5): error TS2322: Type 'N.A' is not assignable to type 'M.A'. +everyTypeWithAnnotationAndInvalidInitializer.ts(51,5): error TS2741: Property 'name' is missing in type 'N.A' but required in type 'M.A'. everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'. Type 'boolean' is not assignable to type 'string'. @@ -116,7 +116,8 @@ everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: n !!! related TS2728 everyTypeWithAnnotationAndInvalidInitializer.ts:20:9: 'name' is declared here. var aClassInModule: M.A = new N.A(); ~~~~~~~~~~~~~~ -!!! error TS2322: Type 'N.A' is not assignable to type 'M.A'. +!!! error TS2741: Property 'name' is missing in type 'N.A' but required in type 'M.A'. +!!! related TS2728 everyTypeWithAnnotationAndInvalidInitializer.ts:20:9: 'name' is declared here. var aFunctionInModule: typeof M.F2 = F2; ~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'. diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt index 2bb7f3f550c..d9249711d1d 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt +++ b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt @@ -23,6 +23,8 @@ functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is Type 'void' is not assignable to type 'string'. functionConstraintSatisfaction2.ts(38,10): error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'. Type 'T' is not assignable to type '(x: string) => string'. + Type '() => void' is not assignable to type '(x: string) => string'. + Type 'void' is not assignable to type 'string'. ==== functionConstraintSatisfaction2.ts (13 errors) ==== @@ -102,5 +104,7 @@ functionConstraintSatisfaction2.ts(38,10): error TS2345: Argument of type 'U' is ~ !!! error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'. !!! error TS2345: Type 'T' is not assignable to type '(x: string) => string'. +!!! error TS2345: Type '() => void' is not assignable to type '(x: string) => string'. +!!! error TS2345: Type 'void' is not assignable to type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/fuzzy.errors.txt b/tests/baselines/reference/fuzzy.errors.txt index ff1eb4b8888..36e42284cd6 100644 --- a/tests/baselines/reference/fuzzy.errors.txt +++ b/tests/baselines/reference/fuzzy.errors.txt @@ -1,7 +1,7 @@ fuzzy.ts(13,18): error TS2420: Class 'C' incorrectly implements interface 'I'. Property 'alsoWorks' is missing in type 'C' but required in type 'I'. fuzzy.ts(21,34): error TS2322: Type 'this' is not assignable to type 'I'. - Type 'C' is not assignable to type 'I'. + Property 'alsoWorks' is missing in type 'C' but required in type 'I'. fuzzy.ts(25,20): error TS2352: Conversion of type '{ oneI: this; }' to type 'R' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Property 'anything' is missing in type '{ oneI: this; }' but required in type 'R'. @@ -34,7 +34,8 @@ fuzzy.ts(25,20): error TS2352: Conversion of type '{ oneI: this; }' to type 'R' return { anything:1, oneI:this }; ~~~~ !!! error TS2322: Type 'this' is not assignable to type 'I'. -!!! error TS2322: Type 'C' is not assignable to type 'I'. +!!! error TS2322: Property 'alsoWorks' is missing in type 'C' but required in type 'I'. +!!! related TS2728 fuzzy.ts:4:9: 'alsoWorks' is declared here. !!! related TS6500 fuzzy.ts:10:9: The expected type comes from property 'oneI' which is declared here on type 'R' } diff --git a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt index 81470452eb8..4a64dd5471f 100644 --- a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt +++ b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt @@ -4,14 +4,20 @@ genericAssignmentCompatWithInterfaces1.ts(12,23): error TS2322: Type 'A' Types of parameters 'other' and 'other' are incompatible. Type 'string' is not assignable to type 'number'. 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'. + The types of 'x.compareTo' are incompatible between these types. + 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'. genericAssignmentCompatWithInterfaces1.ts(16,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'. + The types of 'x.compareTo' are incompatible between these types. + 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'. genericAssignmentCompatWithInterfaces1.ts(17,5): error TS2322: Type 'K' is not assignable to type 'I'. - Types of property 'x' are incompatible. - Type 'A' is not assignable to type 'Comparable'. + The types of 'x.compareTo' are incompatible between these types. + 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'. ==== genericAssignmentCompatWithInterfaces1.ts (4 errors) ==== @@ -37,19 +43,25 @@ genericAssignmentCompatWithInterfaces1.ts(17,5): error TS2322: Type 'K' var a2: I = function (): { x: 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: The types of 'x.compareTo' are incompatible between these types. +!!! 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'. var z = { x: new A() }; return z; } (); var a3: I = z; ~~ !!! 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: The types of 'x.compareTo' are incompatible between these types. +!!! 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'. var a4: I = >z; ~~ !!! error TS2322: Type 'K' 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: The types of 'x.compareTo' are incompatible between these types. +!!! 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'. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt b/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt index 42fe31432f2..653b071b3b4 100644 --- a/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt +++ b/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt @@ -9,6 +9,7 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(52,38): error TS2769: No Overload 2 of 2, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'string'. genericCallToOverloadedMethodWithOverloadedArguments.ts(68,38): error TS2769: No overload matches this call. Overload 1 of 3, '(cb: (x: number) => Promise): Promise', gave the following error. Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. @@ -17,9 +18,11 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(68,38): error TS2769: No Overload 2 of 3, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'string'. Overload 3 of 3, '(cb: (x: number) => Promise, error?: (error: any) => string, progress?: (preservation: any) => void): Promise', gave the following error. Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'string'. genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No overload matches this call. Overload 1 of 2, '(cb: (x: number) => Promise): Promise', gave the following error. Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. @@ -28,6 +31,7 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No Overload 2 of 2, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'boolean'. ==== genericCallToOverloadedMethodWithOverloadedArguments.ts (4 errors) ==== @@ -96,6 +100,7 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No !!! error TS2769: Overload 2 of 2, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. !!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. !!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. } ////////////////////////////////////// @@ -121,9 +126,11 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No !!! error TS2769: Overload 2 of 3, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. !!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. !!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. !!! error TS2769: Overload 3 of 3, '(cb: (x: number) => Promise, error?: (error: any) => string, progress?: (preservation: any) => void): Promise', gave the following error. !!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. !!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. } ////////////////////////////////////// @@ -149,5 +156,6 @@ genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2769: No !!! error TS2769: Overload 2 of 2, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. !!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. !!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2769: Type 'number' is not assignable to type 'boolean'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.errors.txt b/tests/baselines/reference/genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.errors.txt index ad660643bd7..0336f8a8912 100644 --- a/tests/baselines/reference/genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.errors.txt +++ b/tests/baselines/reference/genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.errors.txt @@ -4,7 +4,7 @@ genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.ts(13,5): er Type 'ReturnType | ReturnType | ReturnType' is not assignable to type 'A'. Type 'ReturnType' is not assignable to type 'A'. Type 'ReturnType[string]>' is not assignable to type 'A'. - Type 'unknown' is not assignable to type 'A'. + Property 'x' is missing in type '{}' but required in type 'A'. ==== genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.ts (1 errors) ==== @@ -28,7 +28,8 @@ genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.ts(13,5): er !!! error TS2322: Type 'ReturnType | ReturnType | ReturnType' is not assignable to type 'A'. !!! error TS2322: Type 'ReturnType' is not assignable to type 'A'. !!! error TS2322: Type 'ReturnType[string]>' is not assignable to type 'A'. -!!! error TS2322: Type 'unknown' is not assignable to type 'A'. +!!! error TS2322: Property 'x' is missing in type '{}' but required in type 'A'. +!!! related TS2728 genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.ts:1:15: 'x' is declared here. } // Original CFA report of the above issue diff --git a/tests/baselines/reference/inferTypePredicates.errors.txt b/tests/baselines/reference/inferTypePredicates.errors.txt index e61c1cb72be..6a955c7cb06 100644 --- a/tests/baselines/reference/inferTypePredicates.errors.txt +++ b/tests/baselines/reference/inferTypePredicates.errors.txt @@ -2,7 +2,11 @@ inferTypePredicates.ts(4,7): error TS2322: Type '(number | null)[]' is not assig Type 'number | null' is not assignable to type 'number'. Type 'null' is not assignable to type 'number'. inferTypePredicates.ts(7,7): error TS2322: Type '(number | null)[]' is not assignable to type 'number[]'. + Type 'number | null' is not assignable to type 'number'. + Type 'null' is not assignable to type 'number'. inferTypePredicates.ts(14,7): error TS2322: Type '(number | null)[]' is not assignable to type 'number[]'. + Type 'number | null' is not assignable to type 'number'. + Type 'null' is not assignable to type 'number'. inferTypePredicates.ts(52,17): error TS18048: 'arr' is possibly 'undefined'. inferTypePredicates.ts(54,28): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. @@ -31,6 +35,8 @@ inferTypePredicates.ts(205,7): error TS2741: Property 'z' is missing in type 'C1 const evenSquaresInline: number[] = // should error ~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '(number | null)[]' is not assignable to type 'number[]'. +!!! error TS2322: Type 'number | null' is not assignable to type 'number'. +!!! error TS2322: Type 'null' is not assignable to type 'number'. [1, 2, 3, 4] .map(x => x % 2 === 0 ? x * x : null) .filter(x => !!x); // tests truthiness, not non-nullishness @@ -40,6 +46,8 @@ inferTypePredicates.ts(205,7): error TS2741: Property 'z' is missing in type 'C1 const evenSquares: number[] = // should error ~~~~~~~~~~~ !!! error TS2322: Type '(number | null)[]' is not assignable to type 'number[]'. +!!! error TS2322: Type 'number | null' is not assignable to type 'number'. +!!! error TS2322: Type 'null' is not assignable to type 'number'. [1, 2, 3, 4] .map(x => x % 2 === 0 ? x * x : null) .filter(isTruthy); diff --git a/tests/baselines/reference/inheritance1.errors.txt b/tests/baselines/reference/inheritance1.errors.txt index f056f7bdf73..b96db00d8ff 100644 --- a/tests/baselines/reference/inheritance1.errors.txt +++ b/tests/baselines/reference/inheritance1.errors.txt @@ -5,7 +5,7 @@ inheritance1.ts(18,7): error TS2420: Class 'Locations' incorrectly implements in inheritance1.ts(31,1): error TS2741: Property 'select' is missing in type 'Control' but required in type 'Button'. inheritance1.ts(37,1): error TS2741: Property 'select' is missing in type 'Control' but required in type 'TextBox'. inheritance1.ts(40,1): error TS2741: Property 'select' is missing in type 'Control' but required in type 'SelectableControl'. -inheritance1.ts(46,1): error TS2322: Type 'Image1' is not assignable to type 'SelectableControl'. +inheritance1.ts(46,1): error TS2741: Property 'select' is missing in type 'Control' but required in type 'SelectableControl'. inheritance1.ts(52,1): error TS2741: Property 'state' is missing in type 'Locations' but required in type 'SelectableControl'. inheritance1.ts(53,1): error TS2741: Property 'state' is missing in type 'Locations' but required in type 'Control'. inheritance1.ts(55,1): error TS2741: Property 'select' is missing in type 'Control' but required in type 'Locations'. @@ -79,7 +79,8 @@ inheritance1.ts(61,1): error TS2741: Property 'select' is missing in type 'Contr var i1: Image1; sc = i1; ~~ -!!! error TS2322: Type 'Image1' is not assignable to type 'SelectableControl'. +!!! error TS2741: Property 'select' is missing in type 'Control' but required in type 'SelectableControl'. +!!! related TS2728 inheritance1.ts:5:5: 'select' is declared here. c = i1; i1 = sc; i1 = c; diff --git a/tests/baselines/reference/inlineJsxFactoryDeclarationsLocalTypes.errors.txt b/tests/baselines/reference/inlineJsxFactoryDeclarationsLocalTypes.errors.txt index 0e250ca66b9..f68e2066410 100644 --- a/tests/baselines/reference/inlineJsxFactoryDeclarationsLocalTypes.errors.txt +++ b/tests/baselines/reference/inlineJsxFactoryDeclarationsLocalTypes.errors.txt @@ -4,15 +4,16 @@ index.tsx(5,1): error TS2741: Property '__predomBrand' is missing in type 'impor index.tsx(21,22): error TS2786: 'MySFC' cannot be used as a JSX component. Its return type 'import("renderer2").predom.JSX.Element' is not a valid JSX element. Property '__domBrand' is missing in type 'import("renderer2").predom.JSX.Element' but required in type 'import("renderer").dom.JSX.Element'. -index.tsx(21,40): error TS2322: Type 'import("renderer").dom.JSX.Element' is not assignable to type 'import("renderer2").predom.JSX.Element'. +index.tsx(21,40): error TS2741: Property '__predomBrand' is missing in type 'import("renderer").dom.JSX.Element' but required in type 'import("renderer2").predom.JSX.Element'. index.tsx(21,41): error TS2786: 'MyClass' cannot be used as a JSX component. Its instance type 'MyClass' is not a valid JSX element. Property '__domBrand' is missing in type 'MyClass' but required in type 'ElementClass'. -index.tsx(21,63): error TS2322: Type 'import("renderer").dom.JSX.Element' is not assignable to type 'import("renderer2").predom.JSX.Element'. +index.tsx(21,63): error TS2741: Property '__predomBrand' is missing in type 'import("renderer").dom.JSX.Element' but required in type 'import("renderer2").predom.JSX.Element'. index.tsx(21,64): error TS2786: 'MyClass' cannot be used as a JSX component. Its instance type 'MyClass' is not a valid JSX element. -index.tsx(24,42): error TS2322: Type 'import("renderer2").predom.JSX.Element' is not assignable to type 'import("renderer").dom.JSX.Element'. -index.tsx(24,48): error TS2322: Type 'import("renderer2").predom.JSX.Element' is not assignable to type 'import("renderer").dom.JSX.Element'. + Property '__domBrand' is missing in type 'MyClass' but required in type 'ElementClass'. +index.tsx(24,42): error TS2741: Property '__domBrand' is missing in type 'import("renderer2").predom.JSX.Element' but required in type 'import("renderer").dom.JSX.Element'. +index.tsx(24,48): error TS2741: Property '__domBrand' is missing in type 'import("renderer2").predom.JSX.Element' but required in type 'import("renderer").dom.JSX.Element'. ==== renderer.d.ts (0 errors) ==== @@ -110,22 +111,28 @@ index.tsx(24,48): error TS2322: Type 'import("renderer2").predom.JSX.Element' is !!! error TS2786: Property '__domBrand' is missing in type 'import("renderer2").predom.JSX.Element' but required in type 'import("renderer").dom.JSX.Element'. !!! related TS2728 renderer.d.ts:7:13: '__domBrand' is declared here. ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'import("renderer").dom.JSX.Element' is not assignable to type 'import("renderer2").predom.JSX.Element'. +!!! error TS2741: Property '__predomBrand' is missing in type 'import("renderer").dom.JSX.Element' but required in type 'import("renderer2").predom.JSX.Element'. +!!! related TS2728 renderer2.d.ts:7:13: '__predomBrand' is declared here. ~~~~~~~ !!! error TS2786: 'MyClass' cannot be used as a JSX component. !!! error TS2786: Its instance type 'MyClass' is not a valid JSX element. !!! error TS2786: Property '__domBrand' is missing in type 'MyClass' but required in type 'ElementClass'. !!! related TS2728 renderer.d.ts:7:13: '__domBrand' is declared here. ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'import("renderer").dom.JSX.Element' is not assignable to type 'import("renderer2").predom.JSX.Element'. +!!! error TS2741: Property '__predomBrand' is missing in type 'import("renderer").dom.JSX.Element' but required in type 'import("renderer2").predom.JSX.Element'. +!!! related TS2728 renderer2.d.ts:7:13: '__predomBrand' is declared here. ~~~~~~~ !!! error TS2786: 'MyClass' cannot be used as a JSX component. !!! error TS2786: Its instance type 'MyClass' is not a valid JSX element. +!!! error TS2786: Property '__domBrand' is missing in type 'MyClass' but required in type 'ElementClass'. +!!! related TS2728 renderer.d.ts:7:13: '__domBrand' is declared here. // Should fail, nondom isn't allowed as children of dom const _brokenTree2 = {tree}{tree} ~~~~~~ -!!! error TS2322: Type 'import("renderer2").predom.JSX.Element' is not assignable to type 'import("renderer").dom.JSX.Element'. +!!! error TS2741: Property '__domBrand' is missing in type 'import("renderer2").predom.JSX.Element' but required in type 'import("renderer").dom.JSX.Element'. +!!! related TS2728 renderer.d.ts:7:13: '__domBrand' is declared here. ~~~~~~ -!!! error TS2322: Type 'import("renderer2").predom.JSX.Element' is not assignable to type 'import("renderer").dom.JSX.Element'. +!!! error TS2741: Property '__domBrand' is missing in type 'import("renderer2").predom.JSX.Element' but required in type 'import("renderer").dom.JSX.Element'. +!!! related TS2728 renderer.d.ts:7:13: '__domBrand' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt index 3b19a8a44c9..1b16cb3a0d4 100644 --- a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt +++ b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt @@ -2,9 +2,9 @@ interfaceAssignmentCompat.ts(32,18): error TS2345: Argument of type '(a: IFrench Types of parameters 'a' and 'a' are incompatible. Property 'coleur' is missing in type 'IEye' but required in type 'IFrenchEye'. interfaceAssignmentCompat.ts(37,29): error TS2339: Property '_map' does not exist on type 'typeof Color'. -interfaceAssignmentCompat.ts(42,13): error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'. +interfaceAssignmentCompat.ts(42,13): error TS2741: Property 'coleur' is missing in type 'IEye' but required in type 'IFrenchEye'. interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEye[]' is not assignable to type 'IFrenchEye[]'. - Type 'IEye' is not assignable to type 'IFrenchEye'. + Property 'coleur' is missing in type 'IEye' but required in type 'IFrenchEye'. ==== interfaceAssignmentCompat.ts (4 errors) ==== @@ -58,12 +58,14 @@ interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEye[]' is not assignabl for (var j=z.length=1;j>=0;j--) { eeks[j]=z[j]; // nope: element assignment ~~~~~~~ -!!! error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'. +!!! error TS2741: Property 'coleur' is missing in type 'IEye' but required in type 'IFrenchEye'. +!!! related TS2728 interfaceAssignmentCompat.ts:13:9: 'coleur' is declared here. } eeks=z; // nope: array assignment ~~~~ !!! error TS2322: Type 'IEye[]' is not assignable to type 'IFrenchEye[]'. -!!! error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'. +!!! error TS2322: Property 'coleur' is missing in type 'IEye' but required in type 'IFrenchEye'. +!!! related TS2728 interfaceAssignmentCompat.ts:13:9: 'coleur' is declared here. return result; } } diff --git a/tests/baselines/reference/intersectionAndUnionTypes.errors.txt b/tests/baselines/reference/intersectionAndUnionTypes.errors.txt index 6bdfc0df64c..69450109b96 100644 --- a/tests/baselines/reference/intersectionAndUnionTypes.errors.txt +++ b/tests/baselines/reference/intersectionAndUnionTypes.errors.txt @@ -5,6 +5,7 @@ intersectionAndUnionTypes.ts(20,1): error TS2322: Type 'B' is not assignable to intersectionAndUnionTypes.ts(23,1): error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'. Type 'A' is not assignable to type '(A & B) | (C & D)'. Type 'A' is not assignable to type 'A & B'. + Property 'b' is missing in type 'A' but required in type 'B'. intersectionAndUnionTypes.ts(25,1): error TS2322: Type 'C | D' is not assignable to type '(A & B) | (C & D)'. Type 'C' is not assignable to type '(A & B) | (C & D)'. Type 'C' is not assignable to type 'C & D'. @@ -77,6 +78,8 @@ intersectionAndUnionTypes.ts(37,1): error TS2322: Type '(A | B) & (C | D)' is no !!! error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'. !!! error TS2322: Type 'A' is not assignable to type '(A & B) | (C & D)'. !!! error TS2322: Type 'A' is not assignable to type 'A & B'. +!!! error TS2322: Property 'b' is missing in type 'A' but required in type 'B'. +!!! related TS2728 intersectionAndUnionTypes.ts:2:15: 'b' is declared here. x = cnd; // Ok x = cod; ~ diff --git a/tests/baselines/reference/invariantGenericErrorElaboration.errors.txt b/tests/baselines/reference/invariantGenericErrorElaboration.errors.txt index 677229d6d03..bef0d7adbf2 100644 --- a/tests/baselines/reference/invariantGenericErrorElaboration.errors.txt +++ b/tests/baselines/reference/invariantGenericErrorElaboration.errors.txt @@ -1,8 +1,11 @@ invariantGenericErrorElaboration.ts(3,7): error TS2322: Type 'Num' is not assignable to type 'Runtype'. The types of 'constraint.constraint' are incompatible between these types. Type 'Constraint>' is not assignable to type 'Constraint>>'. - Type 'Runtype' is not assignable to type 'Num'. + Property 'tag' is missing in type 'Runtype' but required in type 'Num'. invariantGenericErrorElaboration.ts(4,19): error TS2322: Type 'Num' is not assignable to type 'Runtype'. + The types of 'constraint.constraint' are incompatible between these types. + Type 'Constraint>' is not assignable to type 'Constraint>>'. + Property 'tag' is missing in type 'Runtype' but required in type 'Num'. ==== invariantGenericErrorElaboration.ts (2 errors) ==== @@ -13,10 +16,13 @@ invariantGenericErrorElaboration.ts(4,19): error TS2322: Type 'Num' is not assig !!! error TS2322: Type 'Num' is not assignable to type 'Runtype'. !!! error TS2322: The types of 'constraint.constraint' are incompatible between these types. !!! error TS2322: Type 'Constraint>' is not assignable to type 'Constraint>>'. -!!! error TS2322: Type 'Runtype' is not assignable to type 'Num'. +!!! error TS2322: Property 'tag' is missing in type 'Runtype' but required in type 'Num'. const Foo = Obj({ foo: Num }) ~~~ !!! error TS2322: Type 'Num' is not assignable to type 'Runtype'. +!!! error TS2322: The types of 'constraint.constraint' are incompatible between these types. +!!! error TS2322: Type 'Constraint>' is not assignable to type 'Constraint>>'. +!!! error TS2322: Property 'tag' is missing in type 'Runtype' but required in type 'Num'. !!! related TS6501 invariantGenericErrorElaboration.ts:17:34: The expected type comes from this index signature. interface Runtype { diff --git a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt index 03db7e32b33..310b446568d 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt @@ -7,6 +7,9 @@ iteratorSpreadInArray6.ts(15,14): error TS2769: No overload matches this call. Overload 2 of 2, '(...items: (number | ConcatArray)[]): number[]', gave the following error. Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray'. Type 'symbol[]' is not assignable to type 'ConcatArray'. + The types returned by 'slice(...)' are incompatible between these types. + Type 'symbol[]' is not assignable to type 'number[]'. + Type 'symbol' is not assignable to type 'number'. ==== iteratorSpreadInArray6.ts (1 errors) ==== @@ -34,4 +37,7 @@ iteratorSpreadInArray6.ts(15,14): error TS2769: No overload matches this call. !!! error TS2769: Type 'symbol' is not assignable to type 'number'. !!! error TS2769: Overload 2 of 2, '(...items: (number | ConcatArray)[]): number[]', gave the following error. !!! error TS2769: Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray'. -!!! error TS2769: Type 'symbol[]' is not assignable to type 'ConcatArray'. \ No newline at end of file +!!! error TS2769: Type 'symbol[]' is not assignable to type 'ConcatArray'. +!!! error TS2769: The types returned by 'slice(...)' are incompatible between these types. +!!! error TS2769: Type 'symbol[]' is not assignable to type 'number[]'. +!!! error TS2769: Type 'symbol' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/jsxComponentTypeErrors.errors.txt b/tests/baselines/reference/jsxComponentTypeErrors.errors.txt index 2328ac62d1a..be8d8618eb5 100644 --- a/tests/baselines/reference/jsxComponentTypeErrors.errors.txt +++ b/tests/baselines/reference/jsxComponentTypeErrors.errors.txt @@ -10,6 +10,9 @@ jsxComponentTypeErrors.tsx(25,16): error TS2786: 'FunctionComponent' cannot be u Type 'undefined' is not assignable to type '"element"'. jsxComponentTypeErrors.tsx(26,16): error TS2786: 'FunctionComponent' cannot be used as a JSX component. Its return type '{ type: "abc" | undefined; }' is not a valid JSX element. + Types of property 'type' are incompatible. + Type '"abc" | undefined' is not assignable to type '"element"'. + Type 'undefined' is not assignable to type '"element"'. jsxComponentTypeErrors.tsx(27,16): error TS2786: 'ClassComponent' cannot be used as a JSX component. Its instance type 'ClassComponent' is not a valid JSX element. Types of property 'type' are incompatible. @@ -19,6 +22,8 @@ jsxComponentTypeErrors.tsx(28,16): error TS2786: 'MixedComponent' cannot be used Type 'ClassComponent' is not assignable to type 'Element | ElementClass | null'. Type 'ClassComponent' is not assignable to type 'Element | ElementClass'. Type 'ClassComponent' is not assignable to type 'ElementClass'. + Types of property 'type' are incompatible. + Type 'string' is not assignable to type '"element-class"'. jsxComponentTypeErrors.tsx(37,16): error TS2786: 'obj.MemberFunctionComponent' cannot be used as a JSX component. Its return type '{}' is not a valid JSX element. Property 'type' is missing in type '{}' but required in type 'Element'. @@ -69,6 +74,9 @@ jsxComponentTypeErrors.tsx(38,16): error TS2786: 'obj. MemberClassComponent' can ~~~~~~~~~~~~~~~~~ !!! error TS2786: 'FunctionComponent' cannot be used as a JSX component. !!! error TS2786: Its return type '{ type: "abc" | undefined; }' is not a valid JSX element. +!!! error TS2786: Types of property 'type' are incompatible. +!!! error TS2786: Type '"abc" | undefined' is not assignable to type '"element"'. +!!! error TS2786: Type 'undefined' is not assignable to type '"element"'. const elem3 = ; ~~~~~~~~~~~~~~ !!! error TS2786: 'ClassComponent' cannot be used as a JSX component. @@ -82,6 +90,8 @@ jsxComponentTypeErrors.tsx(38,16): error TS2786: 'obj. MemberClassComponent' can !!! error TS2786: Type 'ClassComponent' is not assignable to type 'Element | ElementClass | null'. !!! error TS2786: Type 'ClassComponent' is not assignable to type 'Element | ElementClass'. !!! error TS2786: Type 'ClassComponent' is not assignable to type 'ElementClass'. +!!! error TS2786: Types of property 'type' are incompatible. +!!! error TS2786: Type 'string' is not assignable to type '"element-class"'. const obj = { MemberFunctionComponent() { diff --git a/tests/baselines/reference/keyofAndIndexedAccess.errors.txt b/tests/baselines/reference/keyofAndIndexedAccess.errors.txt index b9df4e46891..e833106df6f 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccess.errors.txt @@ -11,6 +11,8 @@ keyofAndIndexedAccess.ts(317,5): error TS2322: Type 'T[keyof T]' is not assignab Type 'T[string]' is not assignable to type '{}'. keyofAndIndexedAccess.ts(318,5): error TS2322: Type 'T[K]' is not assignable to type '{}'. Type 'T[keyof T]' is not assignable to type '{}'. + Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{}'. + Type 'T[string]' is not assignable to type '{}'. ==== keyofAndIndexedAccess.ts (5 errors) ==== @@ -351,6 +353,8 @@ keyofAndIndexedAccess.ts(318,5): error TS2322: Type 'T[K]' is not assignable to ~ !!! error TS2322: Type 'T[K]' is not assignable to type '{}'. !!! error TS2322: Type 'T[keyof T]' is not assignable to type '{}'. +!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{}'. +!!! error TS2322: Type 'T[string]' is not assignable to type '{}'. } function f92(x: T, y: T[keyof T], z: T[K]) { diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index e19b848ab74..4377dad060e 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -22,6 +22,7 @@ keyofAndIndexedAccessErrors.ts(64,33): error TS2345: Argument of type '"name" | Type '"size"' is not assignable to type 'keyof Shape'. keyofAndIndexedAccessErrors.ts(66,24): error TS2345: Argument of type '"size"' is not assignable to parameter of type 'keyof Shape'. keyofAndIndexedAccessErrors.ts(67,24): error TS2345: Argument of type '"name" | "size"' is not assignable to parameter of type 'keyof Shape'. + Type '"size"' is not assignable to type 'keyof Shape'. keyofAndIndexedAccessErrors.ts(73,5): error TS2536: Type 'keyof T | keyof U' cannot be used to index type 'T | U'. keyofAndIndexedAccessErrors.ts(74,5): error TS2536: Type 'keyof T | keyof U' cannot be used to index type 'T | U'. keyofAndIndexedAccessErrors.ts(82,5): error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'. @@ -34,10 +35,28 @@ keyofAndIndexedAccessErrors.ts(82,5): error TS2322: Type 'keyof T | keyof U' is Type 'string' is not assignable to type 'keyof U'. keyofAndIndexedAccessErrors.ts(83,5): error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'. Type 'keyof T' is not assignable to type 'keyof T & keyof U'. + Type 'string | number | symbol' is not assignable to type 'keyof T & keyof U'. + Type 'string' is not assignable to type 'keyof T & keyof U'. + Type 'string' is not assignable to type 'keyof T'. + Type 'keyof T' is not assignable to type 'keyof U'. + Type 'string | number | symbol' is not assignable to type 'keyof U'. + Type 'string' is not assignable to type 'keyof U'. keyofAndIndexedAccessErrors.ts(86,5): error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'. Type 'keyof T' is not assignable to type 'keyof T & keyof U'. + Type 'string | number | symbol' is not assignable to type 'keyof T & keyof U'. + Type 'string' is not assignable to type 'keyof T & keyof U'. + Type 'string' is not assignable to type 'keyof T'. + Type 'keyof T' is not assignable to type 'keyof U'. + Type 'string | number | symbol' is not assignable to type 'keyof U'. + Type 'string' is not assignable to type 'keyof U'. keyofAndIndexedAccessErrors.ts(87,5): error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'. Type 'keyof T' is not assignable to type 'keyof T & keyof U'. + Type 'string | number | symbol' is not assignable to type 'keyof T & keyof U'. + Type 'string' is not assignable to type 'keyof T & keyof U'. + Type 'string' is not assignable to type 'keyof T'. + Type 'keyof T' is not assignable to type 'keyof U'. + Type 'string | number | symbol' is not assignable to type 'keyof U'. + Type 'string' is not assignable to type 'keyof U'. keyofAndIndexedAccessErrors.ts(103,9): error TS2322: Type 'Extract' is not assignable to type 'K'. 'Extract' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. Type 'string' is not assignable to type 'K'. @@ -45,6 +64,8 @@ keyofAndIndexedAccessErrors.ts(103,9): error TS2322: Type 'Extract]' is not assignable to type 'T[K]'. Type 'Extract' is not assignable to type 'K'. 'Extract' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. + Type 'string' is not assignable to type 'K'. + 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. keyofAndIndexedAccessErrors.ts(108,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. @@ -184,6 +205,7 @@ keyofAndIndexedAccessErrors.ts(165,5): error TS2322: Type 'number' is not assign setProperty(shape, cond ? "name" : "size", 10); // Error ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '"name" | "size"' is not assignable to parameter of type 'keyof Shape'. +!!! error TS2345: Type '"size"' is not assignable to type 'keyof Shape'. } function f20(x: T | U, y: T & U, k1: keyof (T | U), k2: keyof T & keyof U, k3: keyof (T & U), k4: keyof T | keyof U) { @@ -216,16 +238,34 @@ keyofAndIndexedAccessErrors.ts(165,5): error TS2322: Type 'number' is not assign ~~ !!! error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'. !!! error TS2322: Type 'keyof T' is not assignable to type 'keyof T & keyof U'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof T & keyof U'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof T & keyof U'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof T'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'keyof U'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof U'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof U'. k2 = k1; k2 = k3; // Error ~~ !!! error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'. !!! error TS2322: Type 'keyof T' is not assignable to type 'keyof T & keyof U'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof T & keyof U'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof T & keyof U'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof T'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'keyof U'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof U'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof U'. k2 = k4; // Error ~~ !!! error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'. !!! error TS2322: Type 'keyof T' is not assignable to type 'keyof T & keyof U'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof T & keyof U'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof T & keyof U'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof T'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'keyof U'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof U'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof U'. k3 = k1; k3 = k2; @@ -253,6 +293,8 @@ keyofAndIndexedAccessErrors.ts(165,5): error TS2322: Type 'number' is not assign !!! error TS2322: Type 'T[Extract]' is not assignable to type 'T[K]'. !!! error TS2322: Type 'Extract' is not assignable to type 'K'. !!! error TS2322: 'Extract' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. } tk = uk; uk = tk; // error diff --git a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt index 3d6cf65e0e6..e846c48f903 100644 --- a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt +++ b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt @@ -3,6 +3,8 @@ lastPropertyInLiteralWins.ts(8,5): error TS2322: Type '(num: number) => void' is Type 'string' is not assignable to type 'number'. lastPropertyInLiteralWins.ts(9,5): error TS1117: An object literal cannot have multiple properties with the same name. lastPropertyInLiteralWins.ts(9,5): error TS2322: Type '(num: number) => void' is not assignable to type '(str: string) => void'. + Types of parameters 'num' and 'str' are incompatible. + Type 'string' is not assignable to type 'number'. lastPropertyInLiteralWins.ts(14,5): error TS1117: An object literal cannot have multiple properties with the same name. @@ -25,6 +27,8 @@ lastPropertyInLiteralWins.ts(14,5): error TS1117: An object literal cannot have !!! error TS1117: An object literal cannot have multiple properties with the same name. ~~~~~ !!! error TS2322: Type '(num: number) => void' is not assignable to type '(str: string) => void'. +!!! error TS2322: Types of parameters 'num' and 'str' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. !!! related TS6500 lastPropertyInLiteralWins.ts:2:5: The expected type comes from property 'thunk' which is declared here on type 'Thing' }); diff --git a/tests/baselines/reference/mappedTypeWithAny.errors.txt b/tests/baselines/reference/mappedTypeWithAny.errors.txt index a2553052c96..f53402fd7fc 100644 --- a/tests/baselines/reference/mappedTypeWithAny.errors.txt +++ b/tests/baselines/reference/mappedTypeWithAny.errors.txt @@ -1,6 +1,6 @@ mappedTypeWithAny.ts(23,16): error TS2339: Property 'notAValue' does not exist on type 'Data'. mappedTypeWithAny.ts(45,5): error TS2740: Type 'Objectish' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. -mappedTypeWithAny.ts(46,5): error TS2322: Type 'Objectish' is not assignable to type 'any[]'. +mappedTypeWithAny.ts(46,5): error TS2740: Type 'Objectish' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. mappedTypeWithAny.ts(53,5): error TS2322: Type 'string[]' is not assignable to type '[any, any]'. Target requires 2 element(s) but source may have fewer. @@ -57,7 +57,7 @@ mappedTypeWithAny.ts(53,5): error TS2322: Type 'string[]' is not assignable to t !!! error TS2740: Type 'Objectish' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. arr = indirectArrayish; ~~~ -!!! error TS2322: Type 'Objectish' is not assignable to type 'any[]'. +!!! error TS2740: Type 'Objectish' is missing the following properties from type 'any[]': length, pop, push, concat, and 16 more. } declare function stringifyArray(arr: T): { -readonly [K in keyof T]: string }; diff --git a/tests/baselines/reference/noUncheckedIndexedAccess.errors.txt b/tests/baselines/reference/noUncheckedIndexedAccess.errors.txt index 1199c0dbb17..21463e3016b 100644 --- a/tests/baselines/reference/noUncheckedIndexedAccess.errors.txt +++ b/tests/baselines/reference/noUncheckedIndexedAccess.errors.txt @@ -3,29 +3,49 @@ noUncheckedIndexedAccess.ts(3,32): error TS2344: Type 'boolean | undefined' does noUncheckedIndexedAccess.ts(12,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(13,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(14,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(15,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(16,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(17,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(18,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(19,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(20,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(21,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(22,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(23,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(24,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(25,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(38,1): error TS2322: Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(39,1): error TS2322: Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(40,1): error TS2322: Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(41,1): error TS2322: Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(46,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(47,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(48,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(49,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(50,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(55,5): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(63,5): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. + Type 'undefined' is not assignable to type 'boolean'. noUncheckedIndexedAccess.ts(79,7): error TS2322: Type 'number | boolean | undefined' is not assignable to type 'number | boolean'. Type 'undefined' is not assignable to type 'number | boolean'. noUncheckedIndexedAccess.ts(85,1): error TS2322: Type 'undefined' is not assignable to type 'string'. @@ -58,42 +78,55 @@ noUncheckedIndexedAccess.ts(99,11): error TS2322: Type 'undefined' is not assign const e2: boolean = strMap.bar; ~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e3: boolean = strMap[0]; ~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e4: boolean = strMap[0 as string | number]; ~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e5: boolean = strMap[0 as string | 0 | 1]; ~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e6: boolean = strMap[0 as 0 | 1]; ~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e7: boolean = strMap["foo" as "foo" | "baz"]; ~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e8: boolean = strMap[NumericEnum1.A]; ~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e9: boolean = strMap[NumericEnum2.A]; ~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e10: boolean = strMap[StringEnum1.A]; ~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e11: boolean = strMap[StringEnum1.A as StringEnum1]; ~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e12: boolean = strMap[NumericEnum1.A as NumericEnum1]; ~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e13: boolean = strMap[NumericEnum2.A as NumericEnum2]; ~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const e14: boolean = strMap[null as any]; ~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. // Should be OK const ok1: boolean | undefined = strMap["foo"]; @@ -125,18 +158,23 @@ noUncheckedIndexedAccess.ts(99,11): error TS2322: Type 'undefined' is not assign const num_ok1: boolean = numMap[0]; ~~~~~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const num_ok2: boolean = numMap[0 as number]; ~~~~~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const num_ok3: boolean = numMap[0 as 0 | 1]; ~~~~~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const num_ok4: boolean = numMap[NumericEnum1.A]; ~~~~~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. const num_ok5: boolean = numMap[NumericEnum2.A]; ~~~~~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. // Generics function generic1(arg: T): boolean { @@ -144,6 +182,7 @@ noUncheckedIndexedAccess.ts(99,11): error TS2322: Type 'undefined' is not assign return arg["blah"]; ~~~~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. } function generic2(arg: T): boolean { // Should OK @@ -154,6 +193,7 @@ noUncheckedIndexedAccess.ts(99,11): error TS2322: Type 'undefined' is not assign return strMap[arg]; ~~~~~~ !!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'. +!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'. } // Element access into known properties is ok diff --git a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt index d47bc79c372..c819749e009 100644 --- a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt @@ -1,5 +1,5 @@ objectLiteralIndexerErrors.ts(13,54): error TS2741: Property 'y' is missing in type 'A' but required in type 'B'. -objectLiteralIndexerErrors.ts(14,14): error TS2322: Type 'A' is not assignable to type 'B'. +objectLiteralIndexerErrors.ts(14,14): error TS2741: Property 'y' is missing in type 'A' but required in type 'B'. ==== objectLiteralIndexerErrors.ts (2 errors) ==== @@ -22,5 +22,6 @@ objectLiteralIndexerErrors.ts(14,14): error TS2322: Type 'A' is not assignable t !!! related TS6501 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 'A' is not assignable to type 'B'. +!!! error TS2741: Property 'y' is missing in type 'A' but required in type 'B'. +!!! related TS2728 objectLiteralIndexerErrors.ts:6:5: 'y' is declared here. !!! related TS6501 objectLiteralIndexerErrors.ts:13:26: The expected type comes from this index signature. \ No newline at end of file diff --git a/tests/baselines/reference/objectSpreadStrictNull.errors.txt b/tests/baselines/reference/objectSpreadStrictNull.errors.txt index c2f044c4806..2ead2fb05bb 100644 --- a/tests/baselines/reference/objectSpreadStrictNull.errors.txt +++ b/tests/baselines/reference/objectSpreadStrictNull.errors.txt @@ -5,6 +5,7 @@ objectSpreadStrictNull.ts(14,9): error TS2322: Type '{ sn: number | undefined; } objectSpreadStrictNull.ts(15,9): error TS2322: Type '{ sn: number | undefined; }' is not assignable to type '{ sn: string | number; }'. Types of property 'sn' are incompatible. Type 'number | undefined' is not assignable to type 'string | number'. + Type 'undefined' is not assignable to type 'string | number'. objectSpreadStrictNull.ts(18,9): error TS2322: Type '{ sn: string | number | undefined; }' is not assignable to type '{ sn: string | number | boolean; }'. Types of property 'sn' are incompatible. Type 'string | number | undefined' is not assignable to type 'string | number | boolean'. @@ -41,6 +42,7 @@ objectSpreadStrictNull.ts(42,5): error TS2322: Type '{ foo: number | undefined; !!! error TS2322: Type '{ sn: number | undefined; }' is not assignable to type '{ sn: string | number; }'. !!! error TS2322: Types of property 'sn' are incompatible. !!! error TS2322: Type 'number | undefined' is not assignable to type 'string | number'. +!!! error TS2322: Type 'undefined' is not assignable to type 'string | number'. let allUndefined: { sn: string | number | undefined } = { ...undefinedString, ...undefinedNumber }; let undefinedWithOptionalContinues: { sn: string | number | boolean } = { ...definiteBoolean, ...undefinedString, ...optionalNumber }; diff --git a/tests/baselines/reference/objectTypeWithStringAndNumberIndexSignatureToAny.errors.txt b/tests/baselines/reference/objectTypeWithStringAndNumberIndexSignatureToAny.errors.txt index 1ac58b7f62d..12be949583f 100644 --- a/tests/baselines/reference/objectTypeWithStringAndNumberIndexSignatureToAny.errors.txt +++ b/tests/baselines/reference/objectTypeWithStringAndNumberIndexSignatureToAny.errors.txt @@ -4,17 +4,18 @@ objectTypeWithStringAndNumberIndexSignatureToAny.ts(49,5): error TS2739: Type 'S objectTypeWithStringAndNumberIndexSignatureToAny.ts(50,5): error TS2739: Type 'NumberTo' is missing the following properties from type 'Obj': hello, world objectTypeWithStringAndNumberIndexSignatureToAny.ts(51,5): error TS2739: Type 'StringAndNumberTo' is missing the following properties from type 'Obj': hello, world objectTypeWithStringAndNumberIndexSignatureToAny.ts(61,5): error TS2322: Type 'Obj' is not assignable to type 'NumberTo'. + Index signature for type 'number' is missing in type 'Obj'. objectTypeWithStringAndNumberIndexSignatureToAny.ts(65,5): error TS2322: Type 'Obj' is not assignable to type 'StringTo & NumberTo'. Type 'Obj' is not assignable to type 'NumberTo'. Index signature for type 'number' is missing in type 'Obj'. -objectTypeWithStringAndNumberIndexSignatureToAny.ts(67,5): error TS2322: Type 'StringTo' is not assignable to type 'Obj'. -objectTypeWithStringAndNumberIndexSignatureToAny.ts(68,5): error TS2322: Type 'NumberTo' is not assignable to type 'Obj'. +objectTypeWithStringAndNumberIndexSignatureToAny.ts(67,5): error TS2739: Type 'StringTo' is missing the following properties from type 'Obj': hello, world +objectTypeWithStringAndNumberIndexSignatureToAny.ts(68,5): error TS2739: Type 'NumberTo' is missing the following properties from type 'Obj': hello, world objectTypeWithStringAndNumberIndexSignatureToAny.ts(69,5): error TS2739: Type 'StringTo & NumberTo' is missing the following properties from type 'Obj': hello, world objectTypeWithStringAndNumberIndexSignatureToAny.ts(84,5): error TS2322: Type 'Obj' is not assignable to type 'NumberToNumber'. Index signature for type 'number' is missing in type 'Obj'. objectTypeWithStringAndNumberIndexSignatureToAny.ts(88,5): error TS2322: Type 'Obj' is not assignable to type 'StringToAnyNumberToNumber'. Index signature for type 'number' is missing in type 'Obj'. -objectTypeWithStringAndNumberIndexSignatureToAny.ts(90,5): error TS2322: Type 'StringTo' is not assignable to type 'Obj'. +objectTypeWithStringAndNumberIndexSignatureToAny.ts(90,5): error TS2739: Type 'StringTo' is missing the following properties from type 'Obj': hello, world objectTypeWithStringAndNumberIndexSignatureToAny.ts(91,5): error TS2739: Type 'NumberTo' is missing the following properties from type 'Obj': hello, world @@ -91,6 +92,7 @@ objectTypeWithStringAndNumberIndexSignatureToAny.ts(91,5): error TS2739: Type 'N nToAny = someObj; ~~~~~~ !!! error TS2322: Type 'Obj' is not assignable to type 'NumberTo'. +!!! error TS2322: Index signature for type 'number' is missing in type 'Obj'. bothToAny = sToAny; bothToAny = nToAny; @@ -102,10 +104,10 @@ objectTypeWithStringAndNumberIndexSignatureToAny.ts(91,5): error TS2739: Type 'N someObj = sToAny; ~~~~~~~ -!!! error TS2322: Type 'StringTo' is not assignable to type 'Obj'. +!!! error TS2739: Type 'StringTo' is missing the following properties from type 'Obj': hello, world someObj = nToAny; ~~~~~~~ -!!! error TS2322: Type 'NumberTo' is not assignable to type 'Obj'. +!!! error TS2739: Type 'NumberTo' is missing the following properties from type 'Obj': hello, world someObj = bothToAny; ~~~~~~~ !!! error TS2739: Type 'StringTo & NumberTo' is missing the following properties from type 'Obj': hello, world @@ -137,7 +139,7 @@ objectTypeWithStringAndNumberIndexSignatureToAny.ts(91,5): error TS2739: Type 'N someObj = sToAny; ~~~~~~~ -!!! error TS2322: Type 'StringTo' is not assignable to type 'Obj'. +!!! error TS2739: Type 'StringTo' is missing the following properties from type 'Obj': hello, world someObj = nToNumber; ~~~~~~~ !!! error TS2739: Type 'NumberTo' is missing the following properties from type 'Obj': hello, world diff --git a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt index d6f3cd897e6..9a005634ba8 100644 --- a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt +++ b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt @@ -17,12 +17,13 @@ overloadresolutionWithConstraintCheckingDeferred.ts(16,23): error TS2769: No ove Overload 2 of 3, '(arg: (x: C) => any): string', gave the following error. Argument of type '(x: D) => G' is not assignable to parameter of type '(x: C) => any'. Types of parameters 'x' and 'x' are incompatible. - Type 'C' is not assignable to type 'D'. + Property 'q' is missing in type 'C' but required in type 'D'. Overload 3 of 3, '(arg: (x: B) => any): number', gave the following error. Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. Types of parameters 'x' and 'x' are incompatible. - Type 'B' is not assignable to type 'D'. + Property 'q' is missing in type 'B' but required in type 'D'. overloadresolutionWithConstraintCheckingDeferred.ts(16,38): error TS2344: Type 'D' does not satisfy the constraint 'A'. + Property 'x' is missing in type 'D' but required in type 'A'. overloadresolutionWithConstraintCheckingDeferred.ts(18,27): error TS2769: No overload matches this call. Overload 1 of 3, '(arg: (x: D) => number): string', gave the following error. Argument of type '(x: D) => G' is not assignable to parameter of type '(x: D) => number'. @@ -30,12 +31,13 @@ overloadresolutionWithConstraintCheckingDeferred.ts(18,27): error TS2769: No ove Overload 2 of 3, '(arg: (x: C) => any): string', gave the following error. Argument of type '(x: D) => G' is not assignable to parameter of type '(x: C) => any'. Types of parameters 'x' and 'x' are incompatible. - Type 'C' is not assignable to type 'D'. + Property 'q' is missing in type 'C' but required in type 'D'. Overload 3 of 3, '(arg: (x: B) => any): number', gave the following error. Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. Types of parameters 'x' and 'x' are incompatible. - Type 'B' is not assignable to type 'D'. + Property 'q' is missing in type 'B' but required in type 'D'. overloadresolutionWithConstraintCheckingDeferred.ts(19,14): error TS2344: Type 'D' does not satisfy the constraint 'A'. + Property 'x' is missing in type 'D' but required in type 'A'. ==== overloadresolutionWithConstraintCheckingDeferred.ts (6 errors) ==== @@ -81,14 +83,18 @@ overloadresolutionWithConstraintCheckingDeferred.ts(19,14): error TS2344: Type ' !!! error TS2769: Overload 2 of 3, '(arg: (x: C) => any): string', gave the following error. !!! error TS2769: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: C) => any'. !!! error TS2769: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2769: Type 'C' is not assignable to type 'D'. +!!! error TS2769: Property 'q' is missing in type 'C' but required in type 'D'. !!! error TS2769: Overload 3 of 3, '(arg: (x: B) => any): number', gave the following error. !!! error TS2769: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. !!! error TS2769: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2769: Type 'B' is not assignable to type 'D'. +!!! error TS2769: Property 'q' is missing in type 'B' but required in type 'D'. !!! related TS6502 overloadresolutionWithConstraintCheckingDeferred.ts:10:27: The expected type comes from the return type of this signature. +!!! related TS2728 overloadresolutionWithConstraintCheckingDeferred.ts:4:15: 'q' is declared here. +!!! related TS2728 overloadresolutionWithConstraintCheckingDeferred.ts:4:15: 'q' is declared here. ~~~~~~~~ !!! error TS2344: Type 'D' does not satisfy the constraint 'A'. +!!! error TS2344: Property 'x' is missing in type 'D' but required in type 'A'. +!!! related TS2728 overloadresolutionWithConstraintCheckingDeferred.ts:1:15: 'x' is declared here. var result3: string = foo(x => { // x has type D ~~~~~~~~~~~~~~~~~~~~~~ @@ -99,14 +105,18 @@ overloadresolutionWithConstraintCheckingDeferred.ts(19,14): error TS2344: Type ' !!! error TS2769: Overload 2 of 3, '(arg: (x: C) => any): string', gave the following error. !!! error TS2769: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: C) => any'. !!! error TS2769: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2769: Type 'C' is not assignable to type 'D'. +!!! error TS2769: Property 'q' is missing in type 'C' but required in type 'D'. !!! error TS2769: Overload 3 of 3, '(arg: (x: B) => any): number', gave the following error. !!! error TS2769: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. !!! error TS2769: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2769: Type 'B' is not assignable to type 'D'. +!!! error TS2769: Property 'q' is missing in type 'B' but required in type 'D'. +!!! related TS2728 overloadresolutionWithConstraintCheckingDeferred.ts:4:15: 'q' is declared here. +!!! related TS2728 overloadresolutionWithConstraintCheckingDeferred.ts:4:15: 'q' is declared here. var y: G; // error that D does not satisfy constraint, y is of type G, entire call to foo is an error ~~~~~~~~ !!! error TS2344: Type 'D' does not satisfy the constraint 'A'. +!!! error TS2344: Property 'x' is missing in type 'D' but required in type 'A'. +!!! related TS2728 overloadresolutionWithConstraintCheckingDeferred.ts:1:15: 'x' is declared here. return y; }); \ No newline at end of file diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index 55ac1623ccc..ea1a007e7c8 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -63,6 +63,8 @@ promisePermutations.ts(106,19): error TS2769: No overload matches this call. promisePermutations.ts(109,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'cb' and 'value' are incompatible. + Type 'string' is not assignable to type '(a: T) => T'. promisePermutations.ts(110,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. @@ -114,9 +116,12 @@ promisePermutations.ts(137,33): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. + Type 'string' is not assignable to type 'number'. promisePermutations.ts(144,35): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. + Type 'string' is not assignable to type 'number'. promisePermutations.ts(152,36): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. @@ -130,6 +135,7 @@ promisePermutations.ts(158,21): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. + Type 'number' is not assignable to type 'string'. promisePermutations.ts(159,21): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. @@ -350,6 +356,8 @@ promisePermutations.ts(160,21): error TS2769: No overload matches this call. !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'cb' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type '(a: T) => T'. !!! related TS2771 promisePermutations.ts:13:5: The last overload is declared here. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ @@ -453,6 +461,7 @@ promisePermutations.ts(160,21): error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. !!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'string' is not assignable to type 'number'. !!! related TS2771 promisePermutations.ts:5:5: The last overload is declared here. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok @@ -465,6 +474,8 @@ promisePermutations.ts(160,21): error TS2769: No overload matches this call. !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'string' is not assignable to type 'number'. !!! related TS2771 promisePermutations.ts:13:5: The last overload is declared here. var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s10 = testFunction10P(x => x); @@ -499,6 +510,7 @@ promisePermutations.ts(160,21): error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. !!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. !!! related TS2771 promisePermutations.ts:5:5: The last overload is declared here. var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // error ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index 87559b404a6..c9840881c94 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -43,6 +43,8 @@ promisePermutations2.ts(105,19): error TS2769: No overload matches this call. promisePermutations2.ts(108,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'cb' and 'value' are incompatible. + Type 'string' is not assignable to type '(a: T) => T'. promisePermutations2.ts(109,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. @@ -80,9 +82,12 @@ promisePermutations2.ts(133,19): error TS2345: Argument of type '(x: T, cb: < Target signature provides too few arguments. Expected 2 or more, but got 1. promisePermutations2.ts(136,33): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. + Type 'string' is not assignable to type 'number'. promisePermutations2.ts(143,35): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. + Type 'string' is not assignable to type 'number'. promisePermutations2.ts(151,36): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. promisePermutations2.ts(155,21): error TS2769: No overload matches this call. @@ -92,6 +97,7 @@ promisePermutations2.ts(155,21): error TS2769: No overload matches this call. Type 'number' is not assignable to type 'string'. promisePermutations2.ts(157,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. + Type 'number' is not assignable to type 'string'. promisePermutations2.ts(158,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. Type 'Promise' is not assignable to type 'Promise'. Type 'number' is not assignable to type 'string'. @@ -277,6 +283,8 @@ promisePermutations2.ts(159,21): error TS2345: Argument of type '{ (x: number): !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'cb' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type '(a: T) => T'. !!! related TS2771 promisePermutations2.ts:12:5: The last overload is declared here. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ @@ -360,6 +368,7 @@ promisePermutations2.ts(159,21): error TS2345: Argument of type '{ (x: number): ~~~~~~~~~ !!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. !!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -371,6 +380,8 @@ promisePermutations2.ts(159,21): error TS2345: Argument of type '{ (x: number): !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'string' is not assignable to type 'number'. !!! related TS2771 promisePermutations2.ts:12:5: The last overload is declared here. var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s10 = testFunction10P(x => x); @@ -400,6 +411,7 @@ promisePermutations2.ts(159,21): error TS2345: Argument of type '{ (x: number): ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. !!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // ok ~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index 4b653256db3..e3967f6750a 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -56,6 +56,8 @@ promisePermutations3.ts(105,19): error TS2345: Argument of type '(cb: (a: T) Types of parameters 'cb' and 'value' are incompatible. Type 'string' is not assignable to type '(a: T) => T'. promisePermutations3.ts(108,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'cb' and 'value' are incompatible. + Type 'string' is not assignable to type '(a: T) => T'. promisePermutations3.ts(109,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'cb' and 'value' are incompatible. Type 'string' is not assignable to type '(a: T) => T'. @@ -97,7 +99,10 @@ promisePermutations3.ts(136,33): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. + Type 'string' is not assignable to type 'number'. promisePermutations3.ts(143,35): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. + Type 'string' is not assignable to type 'number'. promisePermutations3.ts(151,36): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. @@ -109,6 +114,7 @@ promisePermutations3.ts(157,21): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. + Type 'number' is not assignable to type 'string'. promisePermutations3.ts(158,21): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. @@ -320,6 +326,8 @@ promisePermutations3.ts(165,21): error TS2345: Argument of type '{ (x: T): IP var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. @@ -407,6 +415,7 @@ promisePermutations3.ts(165,21): error TS2345: Argument of type '{ (x: T): IP !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. !!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'string' is not assignable to type 'number'. !!! related TS2771 promisePermutations3.ts:7:5: The last overload is declared here. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok @@ -417,6 +426,8 @@ promisePermutations3.ts(165,21): error TS2345: Argument of type '{ (x: T): IP var r10d = r10.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~~~ !!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s10 = testFunction10P(x => x); var s10a = s10.then(testFunction10, testFunction10, testFunction10); // ok @@ -447,6 +458,7 @@ promisePermutations3.ts(165,21): error TS2345: Argument of type '{ (x: T): IP !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. !!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. !!! related TS2771 promisePermutations3.ts:7:5: The last overload is declared here. var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // error ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/promisesWithConstraints.errors.txt b/tests/baselines/reference/promisesWithConstraints.errors.txt index 3f689043ea5..45d3e8e057b 100644 --- a/tests/baselines/reference/promisesWithConstraints.errors.txt +++ b/tests/baselines/reference/promisesWithConstraints.errors.txt @@ -1,7 +1,7 @@ promisesWithConstraints.ts(15,1): error TS2322: Type 'Promise' is not assignable to type 'Promise'. Property 'y' is missing in type 'Foo' but required in type 'Bar'. promisesWithConstraints.ts(20,1): error TS2322: Type 'CPromise' is not assignable to type 'CPromise'. - Type 'Foo' is not assignable to type 'Bar'. + Property 'y' is missing in type 'Foo' but required in type 'Bar'. ==== promisesWithConstraints.ts (2 errors) ==== @@ -31,5 +31,6 @@ promisesWithConstraints.ts(20,1): error TS2322: Type 'CPromise' is not assi b2 = a2; // was error ~~ !!! error TS2322: Type 'CPromise' is not assignable to type 'CPromise'. -!!! error TS2322: Type 'Foo' is not assignable to type 'Bar'. +!!! error TS2322: Property 'y' is missing in type 'Foo' but required in type 'Bar'. +!!! related TS2728 promisesWithConstraints.ts:10:20: 'y' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt b/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt index b3d8cecc8c1..8d798bc537f 100644 --- a/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt +++ b/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt @@ -5,6 +5,8 @@ reactDefaultPropsInferenceSuccess.tsx(27,36): error TS2769: No overload matches Type 'void' is not assignable to type 'boolean'. Overload 2 of 2, '(props: Props, context?: any): FieldFeedback', gave the following error. Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. + Type 'void' is not assignable to type 'boolean'. reactDefaultPropsInferenceSuccess.tsx(43,41): error TS2769: No overload matches this call. Overload 1 of 2, '(props: Readonly): FieldFeedbackBeta', gave the following error. Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. @@ -12,12 +14,15 @@ reactDefaultPropsInferenceSuccess.tsx(43,41): error TS2769: No overload matches Type 'void' is not assignable to type 'boolean'. Overload 2 of 2, '(props: Props, context?: any): FieldFeedbackBeta', gave the following error. Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. + Type 'void' is not assignable to type 'boolean'. reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2769: No overload matches this call. Overload 1 of 2, '(props: Readonly): FieldFeedback2', gave the following error. Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. Type 'void' is not assignable to type 'boolean'. Overload 2 of 2, '(props: MyPropsProps, context?: any): FieldFeedback2', gave the following error. Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. + Type 'void' is not assignable to type 'boolean'. ==== reactDefaultPropsInferenceSuccess.tsx (3 errors) ==== @@ -56,6 +61,8 @@ reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2769: No overload matches !!! error TS2769: Type 'void' is not assignable to type 'boolean'. !!! error TS2769: Overload 2 of 2, '(props: Props, context?: any): FieldFeedback', gave the following error. !!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. +!!! error TS2769: Type 'void' is not assignable to type 'boolean'. !!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children" | "error"> & Partial & Readonly, "when">> & Partial boolean; }, never>>' !!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children" | "error"> & Partial & Readonly, "when">> & Partial boolean; }, never>>' @@ -82,6 +89,8 @@ reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2769: No overload matches !!! error TS2769: Type 'void' is not assignable to type 'boolean'. !!! error TS2769: Overload 2 of 2, '(props: Props, context?: any): FieldFeedbackBeta', gave the following error. !!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. +!!! error TS2769: Type 'void' is not assignable to type 'boolean'. !!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children"> & Partial & Readonly, keyof Props>> & Partial>' !!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children"> & Partial & Readonly, keyof Props>> & Partial>' @@ -112,6 +121,7 @@ reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2769: No overload matches !!! error TS2769: Type 'void' is not assignable to type 'boolean'. !!! error TS2769: Overload 2 of 2, '(props: MyPropsProps, context?: any): FieldFeedback2', gave the following error. !!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. +!!! error TS2769: Type 'void' is not assignable to type 'boolean'. !!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:46:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children" | "error"> & Partial & Readonly, "when">> & Partial boolean; }, never>>' !!! related TS6500 reactDefaultPropsInferenceSuccess.tsx:46:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children" | "error"> & Partial & Readonly, "when">> & Partial boolean; }, never>>' diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt index 73e20f3dce2..06adbd50c99 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt @@ -7,6 +7,9 @@ reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): error TS2344: Type 'G Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof TInjectedProps & string] | TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. ==== reactReduxLikeDeferredInferenceAllowsAssignment.ts (1 errors) ==== @@ -96,6 +99,9 @@ reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): error TS2344: Type 'G !!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. !!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. !!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof TInjectedProps & string] | TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. >; declare const connect: { diff --git a/tests/baselines/reference/relationComplexityError.errors.txt b/tests/baselines/reference/relationComplexityError.errors.txt index 9738edb2d9d..e6753e6b596 100644 --- a/tests/baselines/reference/relationComplexityError.errors.txt +++ b/tests/baselines/reference/relationComplexityError.errors.txt @@ -1,4 +1,4 @@ -relationComplexityError.ts(12,5): error TS2322: Type 'T1 & T2' is not assignable to type 'T1 | null'. +relationComplexityError.ts(12,5): error TS2859: Excessive complexity comparing types 'T1 & T2' and 'T1 | null'. relationComplexityError.ts(12,5): error TS2859: Excessive complexity comparing types 'T1 & T2' and 'T1 | null'. @@ -16,7 +16,7 @@ relationComplexityError.ts(12,5): error TS2859: Excessive complexity comparing t function f2(x: T1 | null, y: T1 & T2) { x = y; // Complexity error ~ -!!! error TS2322: Type 'T1 & T2' is not assignable to type 'T1 | null'. +!!! error TS2859: Excessive complexity comparing types 'T1 & T2' and 'T1 | null'. ~~~~~ !!! error TS2859: Excessive complexity comparing types 'T1 & T2' and 'T1 | null'. } diff --git a/tests/baselines/reference/setMethods.errors.txt b/tests/baselines/reference/setMethods.errors.txt index dc46f007ec6..62b1e3babe1 100644 --- a/tests/baselines/reference/setMethods.errors.txt +++ b/tests/baselines/reference/setMethods.errors.txt @@ -1,11 +1,17 @@ setMethods.ts(13,17): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size setMethods.ts(19,24): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. + Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size setMethods.ts(25,22): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. + Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size setMethods.ts(31,31): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. + Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size setMethods.ts(37,22): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. + Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size setMethods.ts(43,24): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. + Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size setMethods.ts(49,26): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. + Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size ==== setMethods.ts (7 errors) ==== @@ -33,6 +39,7 @@ setMethods.ts(49,26): error TS2345: Argument of type 'undefined[]' is not assign numberSet.intersection([]); ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. +!!! error TS2345: Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size numberSet.intersection(new Set); numberSet.intersection(stringSet); numberSet.intersection(numberMap); @@ -41,6 +48,7 @@ setMethods.ts(49,26): error TS2345: Argument of type 'undefined[]' is not assign numberSet.difference([]); ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. +!!! error TS2345: Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size numberSet.difference(new Set); numberSet.difference(stringSet); numberSet.difference(numberMap); @@ -49,6 +57,7 @@ setMethods.ts(49,26): error TS2345: Argument of type 'undefined[]' is not assign numberSet.symmetricDifference([]); ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. +!!! error TS2345: Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size numberSet.symmetricDifference(new Set); numberSet.symmetricDifference(stringSet); numberSet.symmetricDifference(numberMap); @@ -57,6 +66,7 @@ setMethods.ts(49,26): error TS2345: Argument of type 'undefined[]' is not assign numberSet.isSubsetOf([]); ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. +!!! error TS2345: Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size numberSet.isSubsetOf(new Set); numberSet.isSubsetOf(stringSet); numberSet.isSubsetOf(numberMap); @@ -65,6 +75,7 @@ setMethods.ts(49,26): error TS2345: Argument of type 'undefined[]' is not assign numberSet.isSupersetOf([]); ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. +!!! error TS2345: Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size numberSet.isSupersetOf(new Set); numberSet.isSupersetOf(stringSet); numberSet.isSupersetOf(numberMap); @@ -73,6 +84,7 @@ setMethods.ts(49,26): error TS2345: Argument of type 'undefined[]' is not assign numberSet.isDisjointFrom([]); ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'ReadonlySetLike'. +!!! error TS2345: Type 'undefined[]' is missing the following properties from type 'ReadonlySetLike': has, size numberSet.isDisjointFrom(new Set); numberSet.isDisjointFrom(stringSet); numberSet.isDisjointFrom(numberMap); diff --git a/tests/baselines/reference/strictFunctionTypesErrors.errors.txt b/tests/baselines/reference/strictFunctionTypesErrors.errors.txt index 0b5ad519223..8c04449ebb3 100644 --- a/tests/baselines/reference/strictFunctionTypesErrors.errors.txt +++ b/tests/baselines/reference/strictFunctionTypesErrors.errors.txt @@ -39,14 +39,18 @@ strictFunctionTypesErrors.ts(61,1): error TS2322: Type 'Func, Type 'Object' is not assignable to type 'string'. strictFunctionTypesErrors.ts(62,1): error TS2322: Type 'Func, string>' is not assignable to type 'Func, Object>'. Type 'Func' is not assignable to type 'Func'. + Type 'Object' is not assignable to type 'string'. strictFunctionTypesErrors.ts(65,1): error TS2322: Type 'Func, Object>' is not assignable to type 'Func, string>'. Type 'Func' is not assignable to type 'Func'. + Type 'Object' is not assignable to type 'string'. strictFunctionTypesErrors.ts(66,1): error TS2322: Type 'Func, string>' is not assignable to type 'Func, string>'. Type 'Func' is not assignable to type 'Func'. + Type 'Object' is not assignable to type 'string'. strictFunctionTypesErrors.ts(67,1): error TS2322: Type 'Func, Object>' is not assignable to type 'Func, string>'. Type 'Object' is not assignable to type 'string'. strictFunctionTypesErrors.ts(74,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. Type 'Func' is not assignable to type 'Func'. + Type 'Object' is not assignable to type 'string'. strictFunctionTypesErrors.ts(75,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. Type 'Object' is not assignable to type 'string'. strictFunctionTypesErrors.ts(76,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. @@ -57,32 +61,34 @@ strictFunctionTypesErrors.ts(80,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. Type 'Func' is not assignable to type 'Func'. + Type 'Object' is not assignable to type 'string'. strictFunctionTypesErrors.ts(84,1): error TS2322: Type 'Func>' is not assignable to type 'Func>'. Type 'Func' is not assignable to type 'Func'. + Type 'Object' is not assignable to type 'string'. strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Comparer2' is not assignable to type 'Comparer2'. Property 'dog' is missing in type 'Animal' but required in type 'Dog'. strictFunctionTypesErrors.ts(126,1): error TS2322: Type 'Crate' is not assignable to type 'Crate'. Types of property 'onSetItem' are incompatible. Type '(item: Dog) => void' is not assignable to type '(item: Animal) => void'. Types of parameters 'item' and 'item' are incompatible. - Type 'Animal' is not assignable to type 'Dog'. + Property 'dog' is missing in type 'Animal' but required in type 'Dog'. strictFunctionTypesErrors.ts(127,1): error TS2322: Type 'Crate' is not assignable to type 'Crate'. Types of property 'item' are incompatible. - Type 'Animal' is not assignable to type 'Dog'. + Property 'dog' is missing in type 'Animal' but required in type 'Dog'. strictFunctionTypesErrors.ts(133,1): error TS2328: Types of parameters 'f' and 'f' are incompatible. - Type 'Animal' is not assignable to type 'Dog'. + Property 'dog' is missing in type 'Animal' but required in type 'Dog'. strictFunctionTypesErrors.ts(134,1): error TS2322: Type '(f: (x: Animal) => Animal) => void' is not assignable to type '(f: (x: Dog) => Dog) => void'. Types of parameters 'f' and 'f' are incompatible. Types of parameters 'x' and 'x' are incompatible. - Type 'Animal' is not assignable to type 'Dog'. + Property 'dog' is missing in type 'Animal' but required in type 'Dog'. strictFunctionTypesErrors.ts(147,5): error TS2322: Type '(cb: (x: Animal) => Animal) => void' is not assignable to type '(cb: (x: Dog) => Animal) => void'. Types of parameters 'cb' and 'cb' are incompatible. Types of parameters 'x' and 'x' are incompatible. - Type 'Animal' is not assignable to type 'Dog'. + Property 'dog' is missing in type 'Animal' but required in type 'Dog'. strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(cb: (x: Animal) => Animal) => void' is not assignable to type '(cb: (x: Dog) => Animal) => void'. Types of parameters 'cb' and 'cb' are incompatible. Types of parameters 'x' and 'x' are incompatible. - Type 'Animal' is not assignable to type 'Dog'. + Property 'dog' is missing in type 'Animal' but required in type 'Dog'. ==== strictFunctionTypesErrors.ts (35 errors) ==== @@ -207,16 +213,19 @@ strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(cb: (x: Animal) => Ani ~~ !!! error TS2322: Type 'Func, string>' is not assignable to type 'Func, Object>'. !!! error TS2322: Type 'Func' is not assignable to type 'Func'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. h3 = h4; // Ok h4 = h1; // Error ~~ !!! error TS2322: Type 'Func, Object>' is not assignable to type 'Func, string>'. !!! error TS2322: Type 'Func' is not assignable to type 'Func'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. h4 = h2; // Error ~~ !!! error TS2322: Type 'Func, string>' is not assignable to type 'Func, string>'. !!! error TS2322: Type 'Func' is not assignable to type 'Func'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. h4 = h3; // Error ~~ !!! error TS2322: Type 'Func, Object>' is not assignable to type 'Func, string>'. @@ -231,6 +240,7 @@ strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(cb: (x: Animal) => Ani ~~ !!! error TS2322: Type 'Func>' is not assignable to type 'Func>'. !!! error TS2322: Type 'Func' is not assignable to type 'Func'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. i1 = i3; // Error ~~ !!! error TS2322: Type 'Func>' is not assignable to type 'Func>'. @@ -255,10 +265,12 @@ strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(cb: (x: Animal) => Ani ~~ !!! error TS2322: Type 'Func>' is not assignable to type 'Func>'. !!! error TS2322: Type 'Func' is not assignable to type 'Func'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. i3 = i4; // Error ~~ !!! error TS2322: Type 'Func>' is not assignable to type 'Func>'. !!! error TS2322: Type 'Func' is not assignable to type 'Func'. +!!! error TS2322: Type 'Object' is not assignable to type 'string'. i4 = i1; // Ok i4 = i2; // Ok @@ -310,12 +322,14 @@ strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(cb: (x: Animal) => Ani !!! error TS2322: Types of property 'onSetItem' are incompatible. !!! error TS2322: Type '(item: Dog) => void' is not assignable to type '(item: Animal) => void'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'Animal' is not assignable to type 'Dog'. +!!! error TS2322: Property 'dog' is missing in type 'Animal' but required in type 'Dog'. +!!! related TS2728 strictFunctionTypesErrors.ts:91:32: 'dog' is declared here. dogCrate = animalCrate; // Error ~~~~~~~~ !!! error TS2322: Type 'Crate' is not assignable to type 'Crate'. !!! error TS2322: Types of property 'item' are incompatible. -!!! error TS2322: Type 'Animal' is not assignable to type 'Dog'. +!!! error TS2322: Property 'dog' is missing in type 'Animal' but required in type 'Dog'. +!!! related TS2728 strictFunctionTypesErrors.ts:91:32: 'dog' is declared here. // Verify that callback parameters are strictly checked @@ -324,13 +338,15 @@ strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(cb: (x: Animal) => Ani fc1 = fc2; // Error ~~~ !!! error TS2328: Types of parameters 'f' and 'f' are incompatible. -!!! error TS2328: Type 'Animal' is not assignable to type 'Dog'. +!!! error TS2328: Property 'dog' is missing in type 'Animal' but required in type 'Dog'. +!!! related TS2728 strictFunctionTypesErrors.ts:91:32: 'dog' is declared here. fc2 = fc1; // Error ~~~ !!! error TS2322: Type '(f: (x: Animal) => Animal) => void' is not assignable to type '(f: (x: Dog) => Dog) => void'. !!! error TS2322: Types of parameters 'f' and 'f' are incompatible. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Animal' is not assignable to type 'Dog'. +!!! error TS2322: Property 'dog' is missing in type 'Animal' but required in type 'Dog'. +!!! related TS2728 strictFunctionTypesErrors.ts:91:32: 'dog' is declared here. // Verify that callback parameters aren't loosely checked when types // originate in method declarations @@ -348,7 +364,8 @@ strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(cb: (x: Animal) => Ani !!! error TS2322: Type '(cb: (x: Animal) => Animal) => void' is not assignable to type '(cb: (x: Dog) => Animal) => void'. !!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Animal' is not assignable to type 'Dog'. +!!! error TS2322: Property 'dog' is missing in type 'Animal' but required in type 'Dog'. +!!! related TS2728 strictFunctionTypesErrors.ts:91:32: 'dog' is declared here. } namespace n2 { @@ -361,5 +378,6 @@ strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(cb: (x: Animal) => Ani !!! error TS2322: Type '(cb: (x: Animal) => Animal) => void' is not assignable to type '(cb: (x: Dog) => Animal) => void'. !!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'Animal' is not assignable to type 'Dog'. +!!! error TS2322: Property 'dog' is missing in type 'Animal' but required in type 'Dog'. +!!! related TS2728 strictFunctionTypesErrors.ts:91:32: 'dog' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/stringMappingOverPatternLiterals.errors.txt b/tests/baselines/reference/stringMappingOverPatternLiterals.errors.txt index d450ef0fcf0..aa201dde6e1 100644 --- a/tests/baselines/reference/stringMappingOverPatternLiterals.errors.txt +++ b/tests/baselines/reference/stringMappingOverPatternLiterals.errors.txt @@ -18,6 +18,7 @@ stringMappingOverPatternLiterals.ts(57,5): error TS2322: Type 'string' is not as stringMappingOverPatternLiterals.ts(78,5): error TS2322: Type 'Uppercase' is not assignable to type 'Uppercase>'. Type 'string' is not assignable to type 'Lowercase'. stringMappingOverPatternLiterals.ts(79,5): error TS2322: Type 'Uppercase' is not assignable to type 'Uppercase>'. + Type 'string' is not assignable to type 'Lowercase'. stringMappingOverPatternLiterals.ts(83,5): error TS2322: Type 'Lowercase>' is not assignable to type 'Uppercase'. stringMappingOverPatternLiterals.ts(84,5): error TS2322: Type 'Lowercase>' is not assignable to type 'Uppercase'. stringMappingOverPatternLiterals.ts(85,5): error TS2322: Type 'Lowercase>' is not assignable to type 'Uppercase>'. @@ -27,11 +28,15 @@ stringMappingOverPatternLiterals.ts(89,5): error TS2322: Type 'Uppercase' is not assignable to type '`A${string}`'. Type 'string' is not assignable to type '`A${string}`'. stringMappingOverPatternLiterals.ts(130,5): error TS2322: Type 'Capitalize' is not assignable to type '`A${string}`'. + Type 'string' is not assignable to type '`A${string}`'. stringMappingOverPatternLiterals.ts(131,5): error TS2322: Type 'Capitalize' is not assignable to type '`A${string}`'. + Type 'string' is not assignable to type '`A${string}`'. stringMappingOverPatternLiterals.ts(147,5): error TS2322: Type 'Uncapitalize' is not assignable to type '`a${string}`'. Type 'string' is not assignable to type '`a${string}`'. stringMappingOverPatternLiterals.ts(148,5): error TS2322: Type 'Uncapitalize' is not assignable to type '`a${string}`'. + Type 'string' is not assignable to type '`a${string}`'. stringMappingOverPatternLiterals.ts(149,5): error TS2322: Type 'Uncapitalize' is not assignable to type '`a${string}`'. + Type 'string' is not assignable to type '`a${string}`'. ==== stringMappingOverPatternLiterals.ts (29 errors) ==== @@ -151,6 +156,7 @@ stringMappingOverPatternLiterals.ts(149,5): error TS2322: Type 'Uncapitalize' is not assignable to type 'Uppercase>'. +!!! error TS2322: Type 'string' is not assignable to type 'Lowercase'. // and this should also not be equivlent to any others var x4: Lowercase> = null as any; @@ -219,9 +225,11 @@ stringMappingOverPatternLiterals.ts(149,5): error TS2322: Type 'Uncapitalize' is not assignable to type '`A${string}`'. +!!! error TS2322: Type 'string' is not assignable to type '`A${string}`'. cap_tem_map2 = cap_str; ~~~~~~~~~~~~ !!! error TS2322: Type 'Capitalize' is not assignable to type '`A${string}`'. +!!! error TS2322: Type 'string' is not assignable to type '`A${string}`'. // All these are uncapitalized uncap_str = uncap_tem; @@ -244,7 +252,9 @@ stringMappingOverPatternLiterals.ts(149,5): error TS2322: Type 'Uncapitalize' is not assignable to type '`a${string}`'. +!!! error TS2322: Type 'string' is not assignable to type '`a${string}`'. uncap_tem_map2 = uncap_str; ~~~~~~~~~~~~~~ !!! error TS2322: Type 'Uncapitalize' is not assignable to type '`a${string}`'. +!!! error TS2322: Type 'string' is not assignable to type '`a${string}`'. } \ No newline at end of file diff --git a/tests/baselines/reference/subclassThisTypeAssignable01.errors.txt b/tests/baselines/reference/subclassThisTypeAssignable01.errors.txt index b385c350407..e97bdfb5ac0 100644 --- a/tests/baselines/reference/subclassThisTypeAssignable01.errors.txt +++ b/tests/baselines/reference/subclassThisTypeAssignable01.errors.txt @@ -1,4 +1,5 @@ file1.js(2,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent'. + Index signature for type 'number' is missing in type 'C'. tile1.ts(2,30): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. tile1.ts(6,81): error TS2744: Type parameter defaults can only reference previously declared type parameters. tile1.ts(11,40): error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle'. @@ -62,4 +63,5 @@ tile1.ts(24,7): error TS2322: Type 'C' is not assignable to type 'ClassComponent const test9 = new C(); ~~~~~ !!! error TS2322: Type 'C' is not assignable to type 'ClassComponent'. +!!! error TS2322: Index signature for type 'number' is missing in type 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt index 572c103836f..4ffb55f7afd 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt @@ -2,6 +2,7 @@ subtypingWithNumericIndexer2.ts(11,11): error TS2430: Interface 'B' incorrectly 'number' index signatures are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithNumericIndexer2.ts(24,27): error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithNumericIndexer2.ts(32,15): error TS2430: Interface 'B3' incorrectly extends interface 'A'. 'number' index signatures are incompatible. Type 'Base' is not assignable to type 'T'. @@ -48,6 +49,8 @@ subtypingWithNumericIndexer2.ts(40,15): error TS2430: Interface 'B5' incorrec interface B extends A { ~~~~ !!! error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. +!!! error TS2344: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 subtypingWithNumericIndexer2.ts:4:34: 'bar' is declared here. [x: number]: Derived; // error } diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt index f6ad0824e6f..f08112dbb97 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt @@ -2,6 +2,7 @@ subtypingWithNumericIndexer3.ts(11,7): error TS2415: Class 'B' incorrectly exten 'number' index signatures are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithNumericIndexer3.ts(24,23): error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithNumericIndexer3.ts(32,11): error TS2415: Class 'B3' incorrectly extends base class 'A'. 'number' index signatures are incompatible. Type 'Base' is not assignable to type 'T'. @@ -48,6 +49,8 @@ subtypingWithNumericIndexer3.ts(40,11): error TS2415: Class 'B5' incorrectly class B extends A { ~~~~ !!! error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. +!!! error TS2344: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 subtypingWithNumericIndexer3.ts:4:34: 'bar' is declared here. [x: number]: Derived; // error } diff --git a/tests/baselines/reference/subtypingWithObjectMembers3.errors.txt b/tests/baselines/reference/subtypingWithObjectMembers3.errors.txt index c59241257c5..c69465b1ee1 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers3.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembers3.errors.txt @@ -3,19 +3,19 @@ subtypingWithObjectMembers3.ts(17,15): error TS2430: Interface 'B' incorrectly e Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithObjectMembers3.ts(27,15): error TS2430: Interface 'B2' incorrectly extends interface 'A2'. Types of property '2.0' are incompatible. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithObjectMembers3.ts(37,15): error TS2430: Interface 'B3' incorrectly extends interface 'A3'. Types of property ''2.0'' are incompatible. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithObjectMembers3.ts(49,15): error TS2430: Interface 'B' incorrectly extends interface 'A'. Types of property 'bar' are incompatible. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithObjectMembers3.ts(59,15): error TS2430: Interface 'B2' incorrectly extends interface 'A2'. Types of property '2.0' are incompatible. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithObjectMembers3.ts(69,15): error TS2430: Interface 'B3' incorrectly extends interface 'A3'. Types of property ''2.0'' are incompatible. - Type 'Base' is not assignable to type 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. ==== subtypingWithObjectMembers3.ts (6 errors) ==== @@ -54,7 +54,8 @@ subtypingWithObjectMembers3.ts(69,15): error TS2430: Interface 'B3' incorrectly ~~ !!! error TS2430: Interface 'B2' incorrectly extends interface 'A2'. !!! error TS2430: Types of property '2.0' are incompatible. -!!! error TS2430: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2430: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 subtypingWithObjectMembers3.ts:6:5: 'bar' is declared here. 1: Derived; // ok 2: Base; // error } @@ -68,7 +69,8 @@ subtypingWithObjectMembers3.ts(69,15): error TS2430: Interface 'B3' incorrectly ~~ !!! error TS2430: Interface 'B3' incorrectly extends interface 'A3'. !!! error TS2430: Types of property ''2.0'' are incompatible. -!!! error TS2430: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2430: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 subtypingWithObjectMembers3.ts:6:5: 'bar' is declared here. '1': Derived; // ok '2.0': Base; // error } @@ -84,7 +86,8 @@ subtypingWithObjectMembers3.ts(69,15): error TS2430: Interface 'B3' incorrectly ~ !!! error TS2430: Interface 'B' incorrectly extends interface 'A'. !!! error TS2430: Types of property 'bar' are incompatible. -!!! error TS2430: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2430: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 subtypingWithObjectMembers3.ts:6:5: 'bar' is declared here. foo?: Derived; // ok bar?: Base; // error } @@ -98,7 +101,8 @@ subtypingWithObjectMembers3.ts(69,15): error TS2430: Interface 'B3' incorrectly ~~ !!! error TS2430: Interface 'B2' incorrectly extends interface 'A2'. !!! error TS2430: Types of property '2.0' are incompatible. -!!! error TS2430: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2430: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 subtypingWithObjectMembers3.ts:6:5: 'bar' is declared here. 1?: Derived; // ok 2?: Base; // error } @@ -112,7 +116,8 @@ subtypingWithObjectMembers3.ts(69,15): error TS2430: Interface 'B3' incorrectly ~~ !!! error TS2430: Interface 'B3' incorrectly extends interface 'A3'. !!! error TS2430: Types of property ''2.0'' are incompatible. -!!! error TS2430: Type 'Base' is not assignable to type 'Derived'. +!!! error TS2430: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 subtypingWithObjectMembers3.ts:6:5: 'bar' is declared here. '1'?: Derived; // ok '2.0'?: Base; // error } diff --git a/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt b/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt index 36cd6465749..8a43b708b19 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt +++ b/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt @@ -2,6 +2,7 @@ subtypingWithStringIndexer2.ts(11,11): error TS2430: Interface 'B' incorrectly e 'string' index signatures are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithStringIndexer2.ts(24,27): error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithStringIndexer2.ts(32,15): error TS2430: Interface 'B3' incorrectly extends interface 'A'. 'string' index signatures are incompatible. Type 'Base' is not assignable to type 'T'. @@ -48,6 +49,8 @@ subtypingWithStringIndexer2.ts(40,15): error TS2430: Interface 'B5' incorrect interface B extends A { ~~~~ !!! error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. +!!! error TS2344: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 subtypingWithStringIndexer2.ts:4:34: 'bar' is declared here. [x: string]: Derived; // error } diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt b/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt index 9f55434c78a..2097ececc05 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt +++ b/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt @@ -2,6 +2,7 @@ subtypingWithStringIndexer3.ts(11,7): error TS2415: Class 'B' incorrectly extend 'string' index signatures are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithStringIndexer3.ts(24,23): error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. + Property 'bar' is missing in type 'Base' but required in type 'Derived'. subtypingWithStringIndexer3.ts(32,11): error TS2415: Class 'B3' incorrectly extends base class 'A'. 'string' index signatures are incompatible. Type 'Base' is not assignable to type 'T'. @@ -48,6 +49,8 @@ subtypingWithStringIndexer3.ts(40,11): error TS2415: Class 'B5' incorrectly e class B extends A { ~~~~ !!! error TS2344: Type 'Base' does not satisfy the constraint 'Derived'. +!!! error TS2344: Property 'bar' is missing in type 'Base' but required in type 'Derived'. +!!! related TS2728 subtypingWithStringIndexer3.ts:4:34: 'bar' is declared here. [x: string]: Derived; // error } diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt index b9eb286af2f..4ebe0dd9bd5 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt @@ -1,21 +1,28 @@ taggedTemplateStringsWithOverloadResolution1.ts(9,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. taggedTemplateStringsWithOverloadResolution1.ts(10,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. taggedTemplateStringsWithOverloadResolution1.ts(11,13): error TS2769: No overload matches this call. Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. taggedTemplateStringsWithOverloadResolution1.ts(12,13): error TS2769: No overload matches this call. Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. taggedTemplateStringsWithOverloadResolution1.ts(13,13): error TS2769: No overload matches this call. Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. taggedTemplateStringsWithOverloadResolution1.ts(14,23): error TS2554: Expected 1-3 arguments, but got 4. taggedTemplateStringsWithOverloadResolution1.ts(19,20): error TS2769: No overload matches this call. Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. @@ -43,30 +50,44 @@ taggedTemplateStringsWithOverloadResolution1.ts(21,24): error TS2554: Expected 1 var b = foo([], 1); // string ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2345: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. !!! related TS2793 taggedTemplateStringsWithOverloadResolution1.ts:5:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var c = foo([], 1, 2); // boolean ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. !!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. !!! related TS2793 taggedTemplateStringsWithOverloadResolution1.ts:5:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var d = foo([], 1, true); // boolean (with error) ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. !!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. !!! related TS2793 taggedTemplateStringsWithOverloadResolution1.ts:5:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var e = foo([], 1, "2"); // {} ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. !!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. !!! related TS2793 taggedTemplateStringsWithOverloadResolution1.ts:5:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var f = foo([], 1, 2, 3); // any (with error) ~ diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt index 1db36713d9c..128b830203e 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt @@ -1,21 +1,28 @@ taggedTemplateStringsWithOverloadResolution1_ES6.ts(9,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. taggedTemplateStringsWithOverloadResolution1_ES6.ts(10,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. taggedTemplateStringsWithOverloadResolution1_ES6.ts(11,13): error TS2769: No overload matches this call. Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. taggedTemplateStringsWithOverloadResolution1_ES6.ts(12,13): error TS2769: No overload matches this call. Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. taggedTemplateStringsWithOverloadResolution1_ES6.ts(13,13): error TS2769: No overload matches this call. Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. taggedTemplateStringsWithOverloadResolution1_ES6.ts(14,23): error TS2554: Expected 1-3 arguments, but got 4. taggedTemplateStringsWithOverloadResolution1_ES6.ts(19,20): error TS2769: No overload matches this call. Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. @@ -43,30 +50,44 @@ taggedTemplateStringsWithOverloadResolution1_ES6.ts(21,24): error TS2554: Expect var b = foo([], 1); // string ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2345: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. !!! related TS2793 taggedTemplateStringsWithOverloadResolution1_ES6.ts:5:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var c = foo([], 1, 2); // boolean ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. !!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. !!! related TS2793 taggedTemplateStringsWithOverloadResolution1_ES6.ts:5:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var d = foo([], 1, true); // boolean (with error) ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. !!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. !!! related TS2793 taggedTemplateStringsWithOverloadResolution1_ES6.ts:5:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var e = foo([], 1, "2"); // {} ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. !!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. !!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. +!!! related TS2728 lib.es5.d.ts:--:--: 'raw' is declared here. !!! related TS2793 taggedTemplateStringsWithOverloadResolution1_ES6.ts:5:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var f = foo([], 1, 2, 3); // any (with error) ~ diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt index 6362a162253..5ce0e368dcd 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt @@ -38,20 +38,22 @@ thisTypeInFunctionsNegative.ts(108,1): error TS2322: Type '(this: { x: number; } Property 'x' is missing in type '{ n: number; }' but required in type '{ x: number; }'. thisTypeInFunctionsNegative.ts(110,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. The 'this' types of each signature are incompatible. - Type 'C' is not assignable to type 'D'. + Type 'C' is missing the following properties from type 'D': x, explicitD thisTypeInFunctionsNegative.ts(111,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. The 'this' types of each signature are incompatible. - Type 'C' is not assignable to type 'D'. + Type 'C' is missing the following properties from type 'D': x, explicitD thisTypeInFunctionsNegative.ts(112,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. The 'this' types of each signature are incompatible. - Type 'C' is not assignable to type 'D'. + Type 'C' is missing the following properties from type 'D': x, explicitD thisTypeInFunctionsNegative.ts(113,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. The 'this' types of each signature are incompatible. - Type 'C' is not assignable to type 'D'. + Type 'C' is missing the following properties from type 'D': x, explicitD thisTypeInFunctionsNegative.ts(114,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'. The 'this' types of each signature are incompatible. Type '{ n: number; }' is missing the following properties from type 'D': x, explicitThis, explicitD thisTypeInFunctionsNegative.ts(115,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is missing the following properties from type 'D': x, explicitD thisTypeInFunctionsNegative.ts(116,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'. The 'this' types of each signature are incompatible. Type 'void' is not assignable to type 'D'. @@ -64,8 +66,10 @@ thisTypeInFunctionsNegative.ts(145,1): error TS2322: Type '(this: Base2) => numb Property 'y' is missing in type 'Base1' but required in type 'Base2'. thisTypeInFunctionsNegative.ts(146,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. The 'this' types of each signature are incompatible. - Type 'Base1' is not assignable to type 'Base2'. + Property 'y' is missing in type 'Base1' but required in type 'Base2'. thisTypeInFunctionsNegative.ts(148,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. + The 'this' types of each signature are incompatible. + Property 'y' is missing in type 'Base1' but required in type 'Base2'. thisTypeInFunctionsNegative.ts(154,16): error TS2679: A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'. thisTypeInFunctionsNegative.ts(158,17): error TS2681: A constructor cannot have a 'this' parameter. thisTypeInFunctionsNegative.ts(162,9): error TS2681: A constructor cannot have a 'this' parameter. @@ -278,22 +282,22 @@ thisTypeInFunctionsNegative.ts(178,22): error TS2730: An arrow function cannot h ~~~~~~~~~~~ !!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. !!! error TS2322: The 'this' types of each signature are incompatible. -!!! error TS2322: Type 'C' is not assignable to type 'D'. +!!! error TS2322: Type 'C' is missing the following properties from type 'D': x, explicitD c.explicitC = d.explicitThis; ~~~~~~~~~~~ !!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. !!! error TS2322: The 'this' types of each signature are incompatible. -!!! error TS2322: Type 'C' is not assignable to type 'D'. +!!! error TS2322: Type 'C' is missing the following properties from type 'D': x, explicitD c.explicitThis = d.explicitD; ~~~~~~~~~~~~~~ !!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. !!! error TS2322: The 'this' types of each signature are incompatible. -!!! error TS2322: Type 'C' is not assignable to type 'D'. +!!! error TS2322: Type 'C' is missing the following properties from type 'D': x, explicitD c.explicitThis = d.explicitThis; ~~~~~~~~~~~~~~ !!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. !!! error TS2322: The 'this' types of each signature are incompatible. -!!! error TS2322: Type 'C' is not assignable to type 'D'. +!!! error TS2322: Type 'C' is missing the following properties from type 'D': x, explicitD c.explicitProperty = d.explicitD; ~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'. @@ -302,6 +306,8 @@ thisTypeInFunctionsNegative.ts(178,22): error TS2730: An arrow function cannot h c.explicitThis = d.explicitThis; ~~~~~~~~~~~~~~ !!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is missing the following properties from type 'D': x, explicitD c.explicitVoid = d.explicitD; ~~~~~~~~~~~~~~ !!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'. @@ -351,11 +357,15 @@ thisTypeInFunctionsNegative.ts(178,22): error TS2730: An arrow function cannot h ~~~~~~~~~~~ !!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. !!! error TS2322: The 'this' types of each signature are incompatible. -!!! error TS2322: Type 'Base1' is not assignable to type 'Base2'. +!!! error TS2322: Property 'y' is missing in type 'Base1' but required in type 'Base2'. +!!! related TS2728 thisTypeInFunctionsNegative.ts:131:5: 'y' is declared here. d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } ~~~~~~~~~~~ !!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Property 'y' is missing in type 'Base1' but required in type 'Base2'. +!!! related TS2728 thisTypeInFunctionsNegative.ts:131:5: 'y' is declared here. ////// use this-type for construction with new //// function VoidThis(this: void) { diff --git a/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt b/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt index 33a85ca2e99..5bd0a3bf133 100644 --- a/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt +++ b/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt @@ -13,6 +13,7 @@ tsxNotUsingApparentTypeOfSFC.tsx(18,14): error TS2769: No overload matches this Type 'P' is not assignable to type 'IntrinsicAttributes'. Overload 2 of 2, '(props: P, context?: any): MyComponent', gave the following error. Type 'P' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly

'. + Type 'P' is not assignable to type 'IntrinsicAttributes'. ==== tsxNotUsingApparentTypeOfSFC.tsx (4 errors) ==== @@ -54,7 +55,9 @@ tsxNotUsingApparentTypeOfSFC.tsx(18,14): error TS2769: No overload matches this !!! error TS2769: Type 'P' is not assignable to type 'IntrinsicAttributes'. !!! error TS2769: Overload 2 of 2, '(props: P, context?: any): MyComponent', gave the following error. !!! error TS2769: Type 'P' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Readonly

'. +!!! error TS2769: Type 'P' is not assignable to type 'IntrinsicAttributes'. !!! related TS2208 tsxNotUsingApparentTypeOfSFC.tsx:5:15: This type parameter might need an `extends JSX.IntrinsicAttributes` constraint. !!! related TS2208 tsxNotUsingApparentTypeOfSFC.tsx:5:15: This type parameter might need an `extends JSX.IntrinsicAttributes & JSX.IntrinsicClassAttributes & Readonly<{ children?: React.ReactNode; }> & Readonly

` constraint. +!!! related TS2208 tsxNotUsingApparentTypeOfSFC.tsx:5:15: This type parameter might need an `extends JSX.IntrinsicAttributes` constraint. !!! related TS2208 tsxNotUsingApparentTypeOfSFC.tsx:5:15: This type parameter might need an `extends JSX.IntrinsicAttributes & JSX.IntrinsicClassAttributes & Readonly<{ children?: React.ReactNode; }> & Readonly

` constraint. } \ No newline at end of file diff --git a/tests/baselines/reference/tsxTypeArgumentResolution.errors.txt b/tests/baselines/reference/tsxTypeArgumentResolution.errors.txt index 3c9c65b490b..dcadad81bab 100644 --- a/tests/baselines/reference/tsxTypeArgumentResolution.errors.txt +++ b/tests/baselines/reference/tsxTypeArgumentResolution.errors.txt @@ -8,6 +8,8 @@ file.tsx(39,14): error TS2344: Type 'Prop' does not satisfy the constraint '{ a: Types of property 'a' are incompatible. Type 'number' is not assignable to type 'string'. file.tsx(41,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'. file.tsx(47,14): error TS2558: Expected 1-2 type arguments, but got 3. file.tsx(49,14): error TS2558: Expected 1-2 type arguments, but got 3. file.tsx(51,47): error TS2322: Type 'string' is not assignable to type 'number'. @@ -76,6 +78,8 @@ file.tsx(53,47): error TS2322: Type 'string' is not assignable to type 'number'. x = a={10} b="hi">; // error ~~~~ !!! 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'. x = a="hi" b="hi" />; // OK diff --git a/tests/baselines/reference/tupleTypes.errors.txt b/tests/baselines/reference/tupleTypes.errors.txt index af2d68e9d37..77dc44771da 100644 --- a/tests/baselines/reference/tupleTypes.errors.txt +++ b/tests/baselines/reference/tupleTypes.errors.txt @@ -11,6 +11,7 @@ tupleTypes.ts(18,1): error TS2322: Type '[number, string, number]' is not assign tupleTypes.ts(35,14): error TS2493: Tuple type '[number, string]' of length '2' has no element at index '2'. tupleTypes.ts(36,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'tt2' must be of type 'undefined', but here has type 'string | number'. tupleTypes.ts(41,1): error TS2322: Type '[]' is not assignable to type '[number, string]'. + Source has 0 element(s) but target requires 2. tupleTypes.ts(47,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'. Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. @@ -96,6 +97,7 @@ tupleTypes.ts(63,4): error TS2540: Cannot assign to 'length' because it is a rea tt = []; // Error ~~ !!! error TS2322: Type '[]' is not assignable to type '[number, string]'. +!!! error TS2322: Source has 0 element(s) but target requires 2. var a: number[]; var a1: [number, string]; diff --git a/tests/baselines/reference/typeAssignabilityErrorMessage.errors.txt b/tests/baselines/reference/typeAssignabilityErrorMessage.errors.txt new file mode 100644 index 00000000000..42802d6a82c --- /dev/null +++ b/tests/baselines/reference/typeAssignabilityErrorMessage.errors.txt @@ -0,0 +1,73 @@ +typeAssignabilityErrorMessage.ts(14,5): error TS2739: Type 'ThroughStream' is missing the following properties from type 'ReadStream': f, g, h, i, j +typeAssignabilityErrorMessage.ts(17,5): error TS2739: Type 'ThroughStream' is missing the following properties from type 'ReadStream': f, g, h, i, j +typeAssignabilityErrorMessage.ts(40,5): error TS2322: Type 'Foo' is not assignable to type 'Bar'. + Type 'Foo' is not assignable to type '{ foo: { what: number; }; }'. + The types of 'foo.what' are incompatible between these types. + Type 'string' is not assignable to type 'number'. +typeAssignabilityErrorMessage.ts(42,5): error TS2345: Argument of type 'OtherWrap' is not assignable to parameter of type 'Wrap'. + Types of property 'someProp' are incompatible. + Type 'Foo' is not assignable to type 'Bar'. + Type 'Foo' is not assignable to type '{ foo: { what: number; }; }'. + The types of 'foo.what' are incompatible between these types. + Type 'string' is not assignable to type 'number'. + + +==== typeAssignabilityErrorMessage.ts (4 errors) ==== + // Example: different error code altogether + + interface ThroughStream { + a: string; + } + interface ReadStream { + f: string; + g: number; + h: boolean; + i: BigInt; + j: symbol; + } + function foo(): ReadStream { + return undefined as any as ThroughStream; + ~~~~~~ +!!! error TS2739: Type 'ThroughStream' is missing the following properties from type 'ReadStream': f, g, h, i, j + } + function bar(): ReadStream { + return undefined as any as ThroughStream; + ~~~~~~ +!!! error TS2739: Type 'ThroughStream' is missing the following properties from type 'ReadStream': f, g, h, i, j + } + + // Example: different elaboration + + type Wrap = { + someProp: Bar; + } + type OtherWrap = { + someProp: Foo; + } + type Foo = { + foo: { what: T }; + } + type Bar = { + foo: { what: T }; + } | boolean; + + function fun(param: Wrap): void {} + + declare let fooStr: Foo; + declare let otherWrap: OtherWrap; + + let a: Bar = fooStr; + ~ +!!! error TS2322: Type 'Foo' is not assignable to type 'Bar'. +!!! error TS2322: Type 'Foo' is not assignable to type '{ foo: { what: number; }; }'. +!!! error TS2322: The types of 'foo.what' are incompatible between these types. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + + fun(otherWrap); + ~~~~~~~~~ +!!! error TS2345: Argument of type 'OtherWrap' is not assignable to parameter of type 'Wrap'. +!!! error TS2345: Types of property 'someProp' are incompatible. +!!! error TS2345: Type 'Foo' is not assignable to type 'Bar'. +!!! error TS2345: Type 'Foo' is not assignable to type '{ foo: { what: number; }; }'. +!!! error TS2345: The types of 'foo.what' are incompatible between these types. +!!! error TS2345: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/typeAssignabilityErrorMessage.symbols b/tests/baselines/reference/typeAssignabilityErrorMessage.symbols new file mode 100644 index 00000000000..85e841b418d --- /dev/null +++ b/tests/baselines/reference/typeAssignabilityErrorMessage.symbols @@ -0,0 +1,105 @@ +//// [tests/cases/compiler/typeAssignabilityErrorMessage.ts] //// + +=== typeAssignabilityErrorMessage.ts === +// Example: different error code altogether + +interface ThroughStream { +>ThroughStream : Symbol(ThroughStream, Decl(typeAssignabilityErrorMessage.ts, 0, 0)) + + a: string; +>a : Symbol(ThroughStream.a, Decl(typeAssignabilityErrorMessage.ts, 2, 25)) +} +interface ReadStream { +>ReadStream : Symbol(ReadStream, Decl(typeAssignabilityErrorMessage.ts, 4, 1)) + + f: string; +>f : Symbol(ReadStream.f, Decl(typeAssignabilityErrorMessage.ts, 5, 22)) + + g: number; +>g : Symbol(ReadStream.g, Decl(typeAssignabilityErrorMessage.ts, 6, 14)) + + h: boolean; +>h : Symbol(ReadStream.h, Decl(typeAssignabilityErrorMessage.ts, 7, 14)) + + i: BigInt; +>i : Symbol(ReadStream.i, Decl(typeAssignabilityErrorMessage.ts, 8, 15)) +>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + + j: symbol; +>j : Symbol(ReadStream.j, Decl(typeAssignabilityErrorMessage.ts, 9, 14)) +} +function foo(): ReadStream { +>foo : Symbol(foo, Decl(typeAssignabilityErrorMessage.ts, 11, 1)) +>ReadStream : Symbol(ReadStream, Decl(typeAssignabilityErrorMessage.ts, 4, 1)) + + return undefined as any as ThroughStream; +>undefined : Symbol(undefined) +>ThroughStream : Symbol(ThroughStream, Decl(typeAssignabilityErrorMessage.ts, 0, 0)) +} +function bar(): ReadStream { +>bar : Symbol(bar, Decl(typeAssignabilityErrorMessage.ts, 14, 1)) +>ReadStream : Symbol(ReadStream, Decl(typeAssignabilityErrorMessage.ts, 4, 1)) + + return undefined as any as ThroughStream; +>undefined : Symbol(undefined) +>ThroughStream : Symbol(ThroughStream, Decl(typeAssignabilityErrorMessage.ts, 0, 0)) +} + +// Example: different elaboration + +type Wrap = { +>Wrap : Symbol(Wrap, Decl(typeAssignabilityErrorMessage.ts, 17, 1)) + + someProp: Bar; +>someProp : Symbol(someProp, Decl(typeAssignabilityErrorMessage.ts, 21, 13)) +>Bar : Symbol(Bar, Decl(typeAssignabilityErrorMessage.ts, 29, 1)) +} +type OtherWrap = { +>OtherWrap : Symbol(OtherWrap, Decl(typeAssignabilityErrorMessage.ts, 23, 1)) + + someProp: Foo; +>someProp : Symbol(someProp, Decl(typeAssignabilityErrorMessage.ts, 24, 18)) +>Foo : Symbol(Foo, Decl(typeAssignabilityErrorMessage.ts, 26, 1)) +} +type Foo = { +>Foo : Symbol(Foo, Decl(typeAssignabilityErrorMessage.ts, 26, 1)) +>T : Symbol(T, Decl(typeAssignabilityErrorMessage.ts, 27, 9)) + + foo: { what: T }; +>foo : Symbol(foo, Decl(typeAssignabilityErrorMessage.ts, 27, 15)) +>what : Symbol(what, Decl(typeAssignabilityErrorMessage.ts, 28, 10)) +>T : Symbol(T, Decl(typeAssignabilityErrorMessage.ts, 27, 9)) +} +type Bar = { +>Bar : Symbol(Bar, Decl(typeAssignabilityErrorMessage.ts, 29, 1)) +>T : Symbol(T, Decl(typeAssignabilityErrorMessage.ts, 30, 9)) + + foo: { what: T }; +>foo : Symbol(foo, Decl(typeAssignabilityErrorMessage.ts, 30, 15)) +>what : Symbol(what, Decl(typeAssignabilityErrorMessage.ts, 31, 10)) +>T : Symbol(T, Decl(typeAssignabilityErrorMessage.ts, 30, 9)) + +} | boolean; + +function fun(param: Wrap): void {} +>fun : Symbol(fun, Decl(typeAssignabilityErrorMessage.ts, 32, 12)) +>param : Symbol(param, Decl(typeAssignabilityErrorMessage.ts, 34, 13)) +>Wrap : Symbol(Wrap, Decl(typeAssignabilityErrorMessage.ts, 17, 1)) + +declare let fooStr: Foo; +>fooStr : Symbol(fooStr, Decl(typeAssignabilityErrorMessage.ts, 36, 11)) +>Foo : Symbol(Foo, Decl(typeAssignabilityErrorMessage.ts, 26, 1)) + +declare let otherWrap: OtherWrap; +>otherWrap : Symbol(otherWrap, Decl(typeAssignabilityErrorMessage.ts, 37, 11)) +>OtherWrap : Symbol(OtherWrap, Decl(typeAssignabilityErrorMessage.ts, 23, 1)) + +let a: Bar = fooStr; +>a : Symbol(a, Decl(typeAssignabilityErrorMessage.ts, 39, 3)) +>Bar : Symbol(Bar, Decl(typeAssignabilityErrorMessage.ts, 29, 1)) +>fooStr : Symbol(fooStr, Decl(typeAssignabilityErrorMessage.ts, 36, 11)) + +fun(otherWrap); +>fun : Symbol(fun, Decl(typeAssignabilityErrorMessage.ts, 32, 12)) +>otherWrap : Symbol(otherWrap, Decl(typeAssignabilityErrorMessage.ts, 37, 11)) + diff --git a/tests/baselines/reference/typeAssignabilityErrorMessage.types b/tests/baselines/reference/typeAssignabilityErrorMessage.types new file mode 100644 index 00000000000..426c33a2863 --- /dev/null +++ b/tests/baselines/reference/typeAssignabilityErrorMessage.types @@ -0,0 +1,124 @@ +//// [tests/cases/compiler/typeAssignabilityErrorMessage.ts] //// + +=== typeAssignabilityErrorMessage.ts === +// Example: different error code altogether + +interface ThroughStream { + a: string; +>a : string +> : ^^^^^^ +} +interface ReadStream { + f: string; +>f : string +> : ^^^^^^ + + g: number; +>g : number +> : ^^^^^^ + + h: boolean; +>h : boolean +> : ^^^^^^^ + + i: BigInt; +>i : BigInt +> : ^^^^^^ + + j: symbol; +>j : symbol +> : ^^^^^^ +} +function foo(): ReadStream { +>foo : () => ReadStream +> : ^^^^^^ + + return undefined as any as ThroughStream; +>undefined as any as ThroughStream : ThroughStream +> : ^^^^^^^^^^^^^ +>undefined as any : any +> : ^^^ +>undefined : undefined +> : ^^^^^^^^^ +} +function bar(): ReadStream { +>bar : () => ReadStream +> : ^^^^^^ + + return undefined as any as ThroughStream; +>undefined as any as ThroughStream : ThroughStream +> : ^^^^^^^^^^^^^ +>undefined as any : any +> : ^^^ +>undefined : undefined +> : ^^^^^^^^^ +} + +// Example: different elaboration + +type Wrap = { +>Wrap : Wrap +> : ^^^^ + + someProp: Bar; +>someProp : Bar +> : ^^^^^^^^^^^ +} +type OtherWrap = { +>OtherWrap : OtherWrap +> : ^^^^^^^^^ + + someProp: Foo; +>someProp : Foo +> : ^^^^^^^^^^^ +} +type Foo = { +>Foo : Foo +> : ^^^^^^ + + foo: { what: T }; +>foo : { what: T; } +> : ^^^^^^^^ ^^^ +>what : T +> : ^ +} +type Bar = { +>Bar : Bar +> : ^^^^^^ + + foo: { what: T }; +>foo : { what: T; } +> : ^^^^^^^^ ^^^ +>what : T +> : ^ + +} | boolean; + +function fun(param: Wrap): void {} +>fun : (param: Wrap) => void +> : ^ ^^ ^^^^^ +>param : Wrap +> : ^^^^ + +declare let fooStr: Foo; +>fooStr : Foo +> : ^^^^^^^^^^^ + +declare let otherWrap: OtherWrap; +>otherWrap : OtherWrap +> : ^^^^^^^^^ + +let a: Bar = fooStr; +>a : Bar +> : ^^^^^^^^^^^ +>fooStr : Foo +> : ^^^^^^^^^^^ + +fun(otherWrap); +>fun(otherWrap) : void +> : ^^^^ +>fun : (param: Wrap) => void +> : ^ ^^ ^^^^^ +>otherWrap : OtherWrap +> : ^^^^^^^^^ + diff --git a/tests/baselines/reference/typeComparisonCaching.errors.txt b/tests/baselines/reference/typeComparisonCaching.errors.txt index b2d68102b7d..e8a0c1a3e06 100644 --- a/tests/baselines/reference/typeComparisonCaching.errors.txt +++ b/tests/baselines/reference/typeComparisonCaching.errors.txt @@ -2,8 +2,8 @@ typeComparisonCaching.ts(26,1): error TS2322: Type 'B' is not assignable to type Types of property 's' are incompatible. Type 'number' is not assignable to type 'string'. typeComparisonCaching.ts(27,1): error TS2322: Type 'D' is not assignable to type 'C'. - Types of property 'q' are incompatible. - Type 'B' is not assignable to type 'A'. + The types of 'q.s' are incompatible between these types. + Type 'number' is not assignable to type 'string'. ==== typeComparisonCaching.ts (2 errors) ==== @@ -40,6 +40,6 @@ typeComparisonCaching.ts(27,1): error TS2322: Type 'D' is not assignable to type c = d; // Should not be allowed ~ !!! error TS2322: Type 'D' is not assignable to type 'C'. -!!! error TS2322: Types of property 'q' are incompatible. -!!! error TS2322: Type 'B' is not assignable to type 'A'. +!!! error TS2322: The types of 'q.s' are incompatible between these types. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt index 11653f4d939..5141906bd95 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt @@ -58,8 +58,12 @@ typeGuardFunctionErrors.ts(159,31): error TS2344: Type 'Bar' does not satisfy th Types of property ''a'' are incompatible. Type 'number' is not assignable to type 'string'. typeGuardFunctionErrors.ts(162,31): error TS2344: Type 'Bar' does not satisfy the constraint 'Foo'. + Types of property ''a'' are incompatible. + Type 'number' is not assignable to type 'string'. typeGuardFunctionErrors.ts(163,35): error TS2344: Type 'number' does not satisfy the constraint 'Foo'. typeGuardFunctionErrors.ts(164,51): error TS2344: Type 'Bar' does not satisfy the constraint 'Foo'. + Types of property ''a'' are incompatible. + Type 'number' is not assignable to type 'string'. typeGuardFunctionErrors.ts(165,51): error TS2344: Type 'number' does not satisfy the constraint 'Foo'. typeGuardFunctionErrors.ts(166,45): error TS2677: A type predicate's type must be assignable to its parameter's type. Type 'NeedsFoo' is not assignable to type 'number'. @@ -342,12 +346,16 @@ typeGuardFunctionErrors.ts(166,54): error TS2344: Type 'number' does not satisfy declare var anError: NeedsFoo; // error, as expected ~~~ !!! error TS2344: Type 'Bar' does not satisfy the constraint 'Foo'. +!!! error TS2344: Types of property ''a'' are incompatible. +!!! error TS2344: Type 'number' is not assignable to type 'string'. declare var alsoAnError: NeedsFoo; // also error, as expected ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'Foo'. declare function newError1(x: any): x is NeedsFoo; // should error ~~~ !!! error TS2344: Type 'Bar' does not satisfy the constraint 'Foo'. +!!! error TS2344: Types of property ''a'' are incompatible. +!!! error TS2344: Type 'number' is not assignable to type 'string'. declare function newError2(x: any): x is NeedsFoo; // should error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'Foo'. diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.errors.txt index 86e6ce9a1f9..bb8daf5500d 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.errors.txt @@ -6,10 +6,10 @@ typeGuardFunctionOfFormThisErrors.ts(24,1): error TS2322: Type '() => this is Fo Property 'lead' is missing in type 'FollowerGuard' but required in type 'LeadGuard'. typeGuardFunctionOfFormThisErrors.ts(26,1): error TS2322: Type '() => this is LeadGuard' is not assignable to type '() => this is FollowerGuard'. Type predicate 'this is LeadGuard' is not assignable to 'this is FollowerGuard'. - Type 'LeadGuard' is not assignable to type 'FollowerGuard'. + Property 'follow' is missing in type 'LeadGuard' but required in type 'FollowerGuard'. typeGuardFunctionOfFormThisErrors.ts(27,1): error TS2322: Type '() => this is FollowerGuard' is not assignable to type '() => this is LeadGuard'. Type predicate 'this is FollowerGuard' is not assignable to 'this is LeadGuard'. - Type 'FollowerGuard' is not assignable to type 'LeadGuard'. + Property 'lead' is missing in type 'FollowerGuard' but required in type 'LeadGuard'. typeGuardFunctionOfFormThisErrors.ts(29,32): error TS2526: A 'this' type is available only in a non-static member of a class or interface. typeGuardFunctionOfFormThisErrors.ts(55,7): error TS2339: Property 'follow' does not exist on type 'RoyalGuard'. typeGuardFunctionOfFormThisErrors.ts(58,7): error TS2339: Property 'lead' does not exist on type 'RoyalGuard'. @@ -55,12 +55,14 @@ typeGuardFunctionOfFormThisErrors.ts(58,7): error TS2339: Property 'lead' does n ~~~~~~~~~~~~ !!! error TS2322: Type '() => this is LeadGuard' is not assignable to type '() => this is FollowerGuard'. !!! error TS2322: Type predicate 'this is LeadGuard' is not assignable to 'this is FollowerGuard'. -!!! error TS2322: Type 'LeadGuard' is not assignable to type 'FollowerGuard'. +!!! error TS2322: Property 'follow' is missing in type 'LeadGuard' but required in type 'FollowerGuard'. +!!! related TS2728 typeGuardFunctionOfFormThisErrors.ts:15:5: 'follow' is declared here. a.isLeader = a.isFollower; ~~~~~~~~~~ !!! error TS2322: Type '() => this is FollowerGuard' is not assignable to type '() => this is LeadGuard'. !!! error TS2322: Type predicate 'this is FollowerGuard' is not assignable to 'this is LeadGuard'. -!!! error TS2322: Type 'FollowerGuard' is not assignable to type 'LeadGuard'. +!!! error TS2322: Property 'lead' is missing in type 'FollowerGuard' but required in type 'LeadGuard'. +!!! related TS2728 typeGuardFunctionOfFormThisErrors.ts:11:5: 'lead' is declared here. function invalidGuard(c: any): this is number { ~~~~ diff --git a/tests/baselines/reference/typeMatch2.errors.txt b/tests/baselines/reference/typeMatch2.errors.txt index ea28398ac1d..a5766a5e378 100644 --- a/tests/baselines/reference/typeMatch2.errors.txt +++ b/tests/baselines/reference/typeMatch2.errors.txt @@ -7,6 +7,7 @@ typeMatch2.ts(18,5): error TS2322: Type 'Animal[]' is not assignable to type 'Gi typeMatch2.ts(22,5): error TS2322: Type '{ f1: number; f2: Animal[]; }' is not assignable to type '{ f1: number; f2: Giraffe[]; }'. Types of property 'f2' are incompatible. Type 'Animal[]' is not assignable to type 'Giraffe[]'. + Property 'g' is missing in type 'Animal' but required in type 'Giraffe'. typeMatch2.ts(34,26): error TS2353: Object literal may only specify known properties, and 'z' does not exist in type '{ x: number; y: number; }'. typeMatch2.ts(35,5): error TS2741: Property 'y' is missing in type '{ x: number; }' but required in type '{ x: number; y: number; }'. @@ -51,6 +52,8 @@ typeMatch2.ts(35,5): error TS2741: Property 'y' is missing in type '{ x: number; !!! error TS2322: Type '{ f1: number; f2: Animal[]; }' is not assignable to type '{ f1: number; f2: Giraffe[]; }'. !!! error TS2322: Types of property 'f2' are incompatible. !!! error TS2322: Type 'Animal[]' is not assignable to type 'Giraffe[]'. +!!! error TS2322: Property 'g' is missing in type 'Animal' but required in type 'Giraffe'. +!!! related TS2728 typeMatch2.ts:10:40: 'g' is declared here. } function f4() { diff --git a/tests/baselines/reference/typeParamExtendsOtherTypeParam.errors.txt b/tests/baselines/reference/typeParamExtendsOtherTypeParam.errors.txt index 4df263c7e28..70c7ee1f6a4 100644 --- a/tests/baselines/reference/typeParamExtendsOtherTypeParam.errors.txt +++ b/tests/baselines/reference/typeParamExtendsOtherTypeParam.errors.txt @@ -15,6 +15,7 @@ typeParamExtendsOtherTypeParam.ts(17,37): error TS2344: Type '{ a: string; }' do typeParamExtendsOtherTypeParam.ts(28,15): error TS2344: Type 'I1' does not satisfy the constraint 'I2'. Property 'b' is missing in type 'I1' but required in type 'I2'. typeParamExtendsOtherTypeParam.ts(29,15): error TS2344: Type 'I1' does not satisfy the constraint 'I2'. + Property 'b' is missing in type 'I1' but required in type 'I2'. ==== typeParamExtendsOtherTypeParam.ts (8 errors) ==== @@ -77,4 +78,6 @@ typeParamExtendsOtherTypeParam.ts(29,15): error TS2344: Type 'I1' does not satis var x8: B; ~~ !!! error TS2344: Type 'I1' does not satisfy the constraint 'I2'. +!!! error TS2344: Property 'b' is missing in type 'I1' but required in type 'I2'. +!!! related TS2728 typeParamExtendsOtherTypeParam.ts:25:5: 'b' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt b/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt index ed0f228f5e5..cbba70ca89e 100644 --- a/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt +++ b/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt @@ -2,8 +2,14 @@ typeParameterAssignmentCompat1.ts(8,5): error TS2322: Type 'Foo' is not assig Type 'U' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'. typeParameterAssignmentCompat1.ts(9,5): error TS2322: Type 'Foo' is not assignable to type 'Foo'. + Type 'T' is not assignable to type 'U'. + 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. typeParameterAssignmentCompat1.ts(16,9): error TS2322: Type 'Foo' is not assignable to type 'Foo'. + Type 'U' is not assignable to type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'. typeParameterAssignmentCompat1.ts(17,9): error TS2322: Type 'Foo' is not assignable to type 'Foo'. + Type 'T' is not assignable to type 'U'. + 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. ==== typeParameterAssignmentCompat1.ts (4 errors) ==== @@ -23,6 +29,9 @@ typeParameterAssignmentCompat1.ts(17,9): error TS2322: Type 'Foo' is not assi return x; ~~~~~~ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. +!!! related TS2208 typeParameterAssignmentCompat1.ts:5:12: This type parameter might need an `extends U` constraint. } class C { @@ -32,8 +41,14 @@ typeParameterAssignmentCompat1.ts(17,9): error TS2322: Type 'Foo' is not assi x = y; // should be an error ~ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. +!!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'. +!!! related TS2208 typeParameterAssignmentCompat1.ts:13:7: This type parameter might need an `extends T` constraint. return x; ~~~~~~ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. +!!! related TS2208 typeParameterAssignmentCompat1.ts:12:9: This type parameter might need an `extends U` constraint. } } \ No newline at end of file diff --git a/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt b/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt index db3350be239..1efc4e535a3 100644 --- a/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt +++ b/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt @@ -9,23 +9,69 @@ types.asyncGenerators.es2018.2.ts(10,7): error TS2322: Type '() => AsyncGenerato Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(13,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterableIterator'. + Call signature return types 'AsyncGenerator' and 'AsyncIterableIterator' are incompatible. + The types returned by 'next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(16,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterableIterator'. + Call signature return types 'AsyncGenerator' and 'AsyncIterableIterator' are incompatible. + The types returned by 'next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(19,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. Call signature return types 'AsyncGenerator' and 'AsyncIterable' are incompatible. - The types of '[Symbol.asyncIterator]().next' are incompatible between these types. - Type '(...args: [] | [undefined]) => Promise>' is not assignable to type '(...args: [] | [undefined]) => Promise>'. + The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(22,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterable'. + Call signature return types 'AsyncGenerator' and 'AsyncIterable' are incompatible. + The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(25,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterable'. + Call signature return types 'AsyncGenerator' and 'AsyncIterable' are incompatible. + The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(28,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. + Call signature return types 'AsyncGenerator' and 'AsyncIterator' are incompatible. + The types returned by 'next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(31,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. + Call signature return types 'AsyncGenerator' and 'AsyncIterator' are incompatible. + The types returned by 'next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(34,7): error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. - Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. + Call signature return types 'AsyncGenerator' and 'AsyncIterator' are incompatible. + The types returned by 'next(...)' are incompatible between these types. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(38,11): error TS2322: Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(41,12): error TS2322: Type 'string' is not assignable to type 'number'. types.asyncGenerators.es2018.2.ts(44,12): error TS2322: Type 'string' is not assignable to type 'number'. @@ -73,51 +119,97 @@ types.asyncGenerators.es2018.2.ts(74,12): error TS2504: Type '{}' must have a '[ const assignability2: () => AsyncIterableIterator = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterableIterator'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterableIterator' are incompatible. +!!! error TS2322: The types returned by 'next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield* ["a", "b"]; }; const assignability3: () => AsyncIterableIterator = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterableIterator'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterableIterator'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterableIterator' are incompatible. +!!! error TS2322: The types returned by 'next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield* (async function * () { yield "a"; })(); }; const assignability4: () => AsyncIterable = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. !!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterable' are incompatible. -!!! error TS2322: The types of '[Symbol.asyncIterator]().next' are incompatible between these types. -!!! error TS2322: Type '(...args: [] | [undefined]) => Promise>' is not assignable to type '(...args: [] | [undefined]) => Promise>'. +!!! error TS2322: The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield "a"; }; const assignability5: () => AsyncIterable = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterable'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterable' are incompatible. +!!! error TS2322: The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield* ["a", "b"]; }; const assignability6: () => AsyncIterable = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterable'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterable'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterable' are incompatible. +!!! error TS2322: The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield* (async function * () { yield "a"; })(); }; const assignability7: () => AsyncIterator = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterator' are incompatible. +!!! error TS2322: The types returned by 'next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield "a"; }; const assignability8: () => AsyncIterator = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterator' are incompatible. +!!! error TS2322: The types returned by 'next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield* ["a", "b"]; }; const assignability9: () => AsyncIterator = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncGenerator' is not assignable to type '() => AsyncIterator'. -!!! error TS2322: Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. +!!! error TS2322: Call signature return types 'AsyncGenerator' and 'AsyncIterator' are incompatible. +!!! error TS2322: The types returned by 'next(...)' are incompatible between these types. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield* (async function * () { yield "a"; })(); }; async function * explicitReturnType1(): AsyncIterableIterator { diff --git a/tests/baselines/reference/unionTypeCallSignatures6.errors.txt b/tests/baselines/reference/unionTypeCallSignatures6.errors.txt index a3e4e593fc4..44f7e31b242 100644 --- a/tests/baselines/reference/unionTypeCallSignatures6.errors.txt +++ b/tests/baselines/reference/unionTypeCallSignatures6.errors.txt @@ -6,7 +6,9 @@ unionTypeCallSignatures6.ts(38,4): error TS2349: This expression is not callable unionTypeCallSignatures6.ts(39,1): error TS2684: The 'this' context of type 'A & C & { f0: F0 | F3; f1: F1 | F3; f2: F1 | F4; f3: F3 | F4; f4: F3 | F5; }' is not assignable to method's 'this' of type 'B'. Property 'b' is missing in type 'A & C & { f0: F0 | F3; f1: F1 | F3; f2: F1 | F4; f3: F3 | F4; f4: F3 | F5; }' but required in type 'B'. unionTypeCallSignatures6.ts(48,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'. + Type 'void' is not assignable to type 'A'. unionTypeCallSignatures6.ts(55,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'. + Type 'void' is not assignable to type 'A'. ==== unionTypeCallSignatures6.ts (6 errors) ==== @@ -72,6 +74,7 @@ unionTypeCallSignatures6.ts(55,1): error TS2684: The 'this' context of type 'voi f3(); // error ~~~~ !!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'. +!!! error TS2684: Type 'void' is not assignable to type 'A'. interface F7 { (this: A & B & C): void; @@ -81,4 +84,5 @@ unionTypeCallSignatures6.ts(55,1): error TS2684: The 'this' context of type 'voi f4(); // error ~~~~ !!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'A & B'. +!!! error TS2684: Type 'void' is not assignable to type 'A'. \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeErrorMessageTypeRefs01.errors.txt b/tests/baselines/reference/unionTypeErrorMessageTypeRefs01.errors.txt index 2016726120a..19211ffa4bf 100644 --- a/tests/baselines/reference/unionTypeErrorMessageTypeRefs01.errors.txt +++ b/tests/baselines/reference/unionTypeErrorMessageTypeRefs01.errors.txt @@ -9,13 +9,13 @@ unionTypeErrorMessageTypeRefs01.ts(27,1): error TS2322: Type 'C' is not ass Property 'kwah' is missing in type 'Foo' but required in type 'Kwah'. unionTypeErrorMessageTypeRefs01.ts(48,1): error TS2322: Type 'X' is not assignable to type 'X | Y | Z'. Type 'X' is not assignable to type 'X'. - Type 'Foo' is not assignable to type 'Bar'. + Property 'bar' is missing in type 'Foo' but required in type 'Bar'. unionTypeErrorMessageTypeRefs01.ts(49,1): error TS2322: Type 'Y' is not assignable to type 'X | Y | Z'. Type 'Y' is not assignable to type 'Y'. - Type 'Foo' is not assignable to type 'Baz'. + Property 'baz' is missing in type 'Foo' but required in type 'Baz'. unionTypeErrorMessageTypeRefs01.ts(50,1): error TS2322: Type 'Z' is not assignable to type 'X | Y | Z'. Type 'Z' is not assignable to type 'Z'. - Type 'Foo' is not assignable to type 'Kwah'. + Property 'kwah' is missing in type 'Foo' but required in type 'Kwah'. ==== unionTypeErrorMessageTypeRefs01.ts (6 errors) ==== @@ -85,14 +85,17 @@ unionTypeErrorMessageTypeRefs01.ts(50,1): error TS2322: Type 'Z' is not ass ~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'X' is not assignable to type 'X | Y | Z'. !!! error TS2322: Type 'X' is not assignable to type 'X'. -!!! error TS2322: Type 'Foo' is not assignable to type 'Bar'. +!!! error TS2322: Property 'bar' is missing in type 'Foo' but required in type 'Bar'. +!!! related TS2728 unionTypeErrorMessageTypeRefs01.ts:2:17: 'bar' is declared here. thingOfTypeAliases = y; ~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'Y' is not assignable to type 'X | Y | Z'. !!! error TS2322: Type 'Y' is not assignable to type 'Y'. -!!! error TS2322: Type 'Foo' is not assignable to type 'Baz'. +!!! error TS2322: Property 'baz' is missing in type 'Foo' but required in type 'Baz'. +!!! related TS2728 unionTypeErrorMessageTypeRefs01.ts:3:17: 'baz' is declared here. thingOfTypeAliases = z; ~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'Z' is not assignable to type 'X | Y | Z'. !!! error TS2322: Type 'Z' is not assignable to type 'Z'. -!!! error TS2322: Type 'Foo' is not assignable to type 'Kwah'. \ No newline at end of file +!!! error TS2322: Property 'kwah' is missing in type 'Foo' but required in type 'Kwah'. +!!! related TS2728 unionTypeErrorMessageTypeRefs01.ts:4:18: 'kwah' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt index b0e587f677e..a15de01e3a7 100644 --- a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction2.errors.txt @@ -10,6 +10,9 @@ unionTypeWithRecursiveSubtypeReduction2.ts(20,1): error TS2322: Type 'Class' is Type '(Class | Property)[]' is not assignable to type 'Class[]'. Type 'Class | Property' is not assignable to type 'Class'. Type 'Property' is not assignable to type 'Class'. + Types of property 'parent' are incompatible. + Type 'Module | Class' is not assignable to type 'Namespace'. + Property 'members' is missing in type 'Class' but required in type 'Namespace'. ==== unionTypeWithRecursiveSubtypeReduction2.ts (2 errors) ==== @@ -48,4 +51,8 @@ unionTypeWithRecursiveSubtypeReduction2.ts(20,1): error TS2322: Type 'Class' is !!! error TS2322: Type '(Class | Property)[]' is not assignable to type 'Class[]'. !!! error TS2322: Type 'Class | Property' is not assignable to type 'Class'. !!! error TS2322: Type 'Property' is not assignable to type 'Class'. +!!! error TS2322: Types of property 'parent' are incompatible. +!!! error TS2322: Type 'Module | Class' is not assignable to type 'Namespace'. +!!! error TS2322: Property 'members' is missing in type 'Class' but required in type 'Namespace'. +!!! related TS2728 unionTypeWithRecursiveSubtypeReduction2.ts:6:12: 'members' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/unionTypesAssignability.errors.txt b/tests/baselines/reference/unionTypesAssignability.errors.txt index 22ab0bf812b..8ce86faf581 100644 --- a/tests/baselines/reference/unionTypesAssignability.errors.txt +++ b/tests/baselines/reference/unionTypesAssignability.errors.txt @@ -1,9 +1,9 @@ unionTypesAssignability.ts(18,1): error TS2741: Property 'foo1' is missing in type 'E' but required in type 'D'. unionTypesAssignability.ts(19,1): error TS2322: Type 'D | E' is not assignable to type 'D'. - Type 'E' is not assignable to type 'D'. + Property 'foo1' is missing in type 'E' but required in type 'D'. unionTypesAssignability.ts(20,1): error TS2741: Property 'foo2' is missing in type 'D' but required in type 'E'. unionTypesAssignability.ts(22,1): error TS2322: Type 'D | E' is not assignable to type 'E'. - Type 'D' is not assignable to type 'E'. + Property 'foo2' is missing in type 'D' but required in type 'E'. unionTypesAssignability.ts(24,1): error TS2322: Type 'string' is not assignable to type 'number'. unionTypesAssignability.ts(25,1): error TS2322: Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. @@ -13,8 +13,8 @@ unionTypesAssignability.ts(28,1): error TS2322: Type 'string | number' is not as unionTypesAssignability.ts(31,1): error TS2741: Property 'foo1' is missing in type 'C' but required in type 'D'. unionTypesAssignability.ts(32,1): error TS2741: Property 'foo2' is missing in type 'C' but required in type 'E'. unionTypesAssignability.ts(33,1): error TS2322: Type 'C' is not assignable to type 'D | E'. -unionTypesAssignability.ts(35,1): error TS2322: Type 'D' is not assignable to type 'E'. -unionTypesAssignability.ts(37,1): error TS2322: Type 'E' is not assignable to type 'D'. +unionTypesAssignability.ts(35,1): error TS2741: Property 'foo2' is missing in type 'D' but required in type 'E'. +unionTypesAssignability.ts(37,1): error TS2741: Property 'foo1' is missing in type 'E' but required in type 'D'. unionTypesAssignability.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'. unionTypesAssignability.ts(43,1): error TS2322: Type 'string' is not assignable to type 'number'. unionTypesAssignability.ts(64,5): error TS2322: Type 'U' is not assignable to type 'T'. @@ -52,7 +52,8 @@ unionTypesAssignability.ts(71,5): error TS2322: Type 'T | U' is not assignable t d = unionDE; // error e is not assignable to d ~ !!! error TS2322: Type 'D | E' is not assignable to type 'D'. -!!! error TS2322: Type 'E' is not assignable to type 'D'. +!!! error TS2322: Property 'foo1' is missing in type 'E' but required in type 'D'. +!!! related TS2728 unionTypesAssignability.ts:3:21: 'foo1' is declared here. e = d; ~ !!! error TS2741: Property 'foo2' is missing in type 'D' but required in type 'E'. @@ -61,7 +62,8 @@ unionTypesAssignability.ts(71,5): error TS2322: Type 'T | U' is not assignable t e = unionDE; // error d is not assignable to e ~ !!! error TS2322: Type 'D | E' is not assignable to type 'E'. -!!! error TS2322: Type 'D' is not assignable to type 'E'. +!!! error TS2322: Property 'foo2' is missing in type 'D' but required in type 'E'. +!!! related TS2728 unionTypesAssignability.ts:4:21: 'foo2' is declared here. num = num; num = str; ~~~ @@ -94,11 +96,13 @@ unionTypesAssignability.ts(71,5): error TS2322: Type 'T | U' is not assignable t d = d; e = d; ~ -!!! error TS2322: Type 'D' is not assignable to type 'E'. +!!! error TS2741: Property 'foo2' is missing in type 'D' but required in type 'E'. +!!! related TS2728 unionTypesAssignability.ts:4:21: 'foo2' is declared here. unionDE = d; // ok d = e; ~ -!!! error TS2322: Type 'E' is not assignable to type 'D'. +!!! error TS2741: Property 'foo1' is missing in type 'E' but required in type 'D'. +!!! related TS2728 unionTypesAssignability.ts:3:21: 'foo1' is declared here. e = e; unionDE = e; // ok num = num; diff --git a/tests/baselines/reference/varianceAnnotations.errors.txt b/tests/baselines/reference/varianceAnnotations.errors.txt index d34477cce47..c58ce8ee943 100644 --- a/tests/baselines/reference/varianceAnnotations.errors.txt +++ b/tests/baselines/reference/varianceAnnotations.errors.txt @@ -63,7 +63,7 @@ varianceAnnotations.ts(160,68): error TS2345: Argument of type 'ActionObject<{ t Type 'StateNode' is not assignable to type 'StateNode'. Types of property '_storedEvent' are incompatible. Type '{ type: "PLAY"; value: number; } | { type: "RESET"; }' is not assignable to type '{ type: "PLAY"; value: number; }'. - Type '{ type: "RESET"; }' is not assignable to type '{ type: "PLAY"; value: number; }'. + Property 'value' is missing in type '{ type: "RESET"; }' but required in type '{ type: "PLAY"; value: number; }'. ==== varianceAnnotations.ts (31 errors) ==== @@ -323,7 +323,8 @@ varianceAnnotations.ts(160,68): error TS2345: Argument of type 'ActionObject<{ t !!! error TS2345: Type 'StateNode' is not assignable to type 'StateNode'. !!! error TS2345: Types of property '_storedEvent' are incompatible. !!! error TS2345: Type '{ type: "PLAY"; value: number; } | { type: "RESET"; }' is not assignable to type '{ type: "PLAY"; value: number; }'. -!!! error TS2345: Type '{ type: "RESET"; }' is not assignable to type '{ type: "PLAY"; value: number; }'. +!!! error TS2345: Property 'value' is missing in type '{ type: "RESET"; }' but required in type '{ type: "PLAY"; value: number; }'. +!!! related TS2728 varianceAnnotations.ts:158:48: 'value' is declared here. // Repros from #48618 diff --git a/tests/cases/compiler/typeAssignabilityErrorMessage.ts b/tests/cases/compiler/typeAssignabilityErrorMessage.ts new file mode 100644 index 00000000000..071217a624f --- /dev/null +++ b/tests/cases/compiler/typeAssignabilityErrorMessage.ts @@ -0,0 +1,46 @@ +// @strict: true +// @target: es2020 +// @noEmit: true + +// Example: different error code altogether + +interface ThroughStream { + a: string; +} +interface ReadStream { + f: string; + g: number; + h: boolean; + i: BigInt; + j: symbol; +} +function foo(): ReadStream { + return undefined as any as ThroughStream; +} +function bar(): ReadStream { + return undefined as any as ThroughStream; +} + +// Example: different elaboration + +type Wrap = { + someProp: Bar; +} +type OtherWrap = { + someProp: Foo; +} +type Foo = { + foo: { what: T }; +} +type Bar = { + foo: { what: T }; +} | boolean; + +function fun(param: Wrap): void {} + +declare let fooStr: Foo; +declare let otherWrap: OtherWrap; + +let a: Bar = fooStr; + +fun(otherWrap); \ No newline at end of file