From b14b231d267e5cf3208d19540974ca8e6f73fb74 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 19 Apr 2020 13:26:38 -0400 Subject: [PATCH 01/14] Report primitive type in literal-to-primitive relation complaints --- src/compiler/checker.ts | 11 +++- .../reference/ES5For-of30.errors.txt | 8 +-- ...rs_spec_section-4.5_error-cases.errors.txt | 16 +++--- .../reference/aliasAssignments.errors.txt | 4 +- ...owJscheckJsTypeParameterNoCrash.errors.txt | 4 +- ...indsToFunctionScopeArgumentList.errors.txt | 4 +- .../reference/arrayLiterals3.errors.txt | 4 +- .../baselines/reference/assignToFn.errors.txt | 4 +- .../reference/assignmentCompat1.errors.txt | 8 +-- ...CompatFunctionsWithOptionalArgs.errors.txt | 4 +- ...ember-off-of-function-interface.errors.txt | 16 +++--- ...ember-off-of-function-interface.errors.txt | 16 +++--- ...nmentToParenthesizedIdentifiers.errors.txt | 48 ++++++++-------- .../asyncArrowFunction_allowJs.errors.txt | 12 ++-- .../baselines/reference/baseCheck.errors.txt | 4 +- .../reference/bigintIndex.errors.txt | 4 +- .../reference/bigintWithLib.errors.txt | 8 +-- .../reference/booleanAssignment.errors.txt | 8 +-- ...OptionalParameterAndInitializer.errors.txt | 4 +- ...dBeResolvedBeforeSpecialization.errors.txt | 4 +- ...uresThatDifferOnlyByReturnType2.errors.txt | 4 +- ...onstrainedToOtherTypeParameter2.errors.txt | 12 ++-- .../chainedPrototypeAssignment.errors.txt | 8 +-- ...heckExportsObjectAssignProperty.errors.txt | 24 ++++---- ...tsObjectAssignPrototypeProperty.errors.txt | 12 ++-- .../reference/checkJsFiles.errors.txt | 4 +- .../reference/checkJsFiles2.errors.txt | 4 +- .../reference/checkJsFiles3.errors.txt | 4 +- .../reference/checkJsFiles4.errors.txt | 4 +- .../reference/checkJsdocReturnTag2.errors.txt | 12 ++-- .../reference/checkJsdocTypeTag2.errors.txt | 12 ++-- ...ckJsdocTypeTagOnObjectProperty2.errors.txt | 16 +++--- .../checkObjectDefineProperty.errors.txt | 4 +- ...ssignabilityConstructorFunction.errors.txt | 4 +- ...assCanExtendConstructorFunction.errors.txt | 8 +-- .../classMemberInitializerScoping.errors.txt | 4 +- .../classPropertyErrorOnNameOnly.errors.txt | 8 +-- ...yofReliesOnKeyofNeverUpperBound.errors.txt | 48 ++++++++-------- .../reference/conditionalTypes1.errors.txt | 24 ++++---- .../constEnumPropertyAccess2.errors.txt | 4 +- ...mplementationWithDefaultValues2.errors.txt | 12 ++-- ...ctorParameterShadowsOuterScopes.errors.txt | 4 +- .../constructorReturnsInvalidType.errors.txt | 4 +- ...rWithAssignableReturnExpression.errors.txt | 4 +- ...torWithIncompleteTypeAnnotation.errors.txt | 4 +- .../controlFlowArrayErrors.errors.txt | 16 +++--- ...efaultArgsInFunctionExpressions.errors.txt | 12 ++-- .../derivedGenericClassWithAny.errors.txt | 16 +++--- ...tructuringParameterDeclaration2.errors.txt | 16 +++--- ...tructuringParameterDeclaration4.errors.txt | 4 +- ...structuringParameterProperties5.errors.txt | 4 +- ...structuringVariableDeclaration2.errors.txt | 8 +-- .../reference/enumAssignmentCompat.errors.txt | 16 +++--- .../enumAssignmentCompat2.errors.txt | 16 +++--- ...AnnotationAndInvalidInitializer.errors.txt | 16 +++--- ...ssignmentConstrainedGenericType.errors.txt | 4 +- .../extractInferenceImprovement.errors.txt | 4 +- ...erInSignatureWithRestParameters.errors.txt | 4 +- tests/baselines/reference/for-of46.errors.txt | 4 +- .../reference/functionAssignment.errors.txt | 4 +- .../reference/functionCall10.errors.txt | 8 +-- .../reference/functionCall11.errors.txt | 4 +- .../reference/functionCall12.errors.txt | 8 +-- .../reference/functionCall13.errors.txt | 4 +- .../reference/functionCall14.errors.txt | 4 +- .../reference/functionCall16.errors.txt | 8 +-- .../reference/functionCall17.errors.txt | 12 ++-- .../reference/functionCall6.errors.txt | 4 +- .../reference/functionCall7.errors.txt | 4 +- .../reference/functionCall8.errors.txt | 4 +- .../reference/functionCall9.errors.txt | 4 +- ...onCallOnConstrainedTypeVariable.errors.txt | 12 ++-- ...functionConstraintSatisfaction2.errors.txt | 4 +- .../reference/functionOverloads.errors.txt | 4 +- .../reference/functionOverloads2.errors.txt | 8 +-- .../reference/functionOverloads27.errors.txt | 4 +- .../generatorExplicitReturnType.errors.txt | 4 +- ...nstraintsTypeArgumentInference2.errors.txt | 4 +- ...cCallWithFunctionTypedArguments.errors.txt | 24 ++++---- ...CallWithFunctionTypedArguments2.errors.txt | 8 +-- ...lWithGenericSignatureArguments2.errors.txt | 16 +++--- ...thObjectTypeArgsAndInitializers.errors.txt | 8 +-- ...kedInsideItsContainingFunction1.errors.txt | 8 +-- ...ithFunctionTypedMemberArguments.errors.txt | 24 ++++---- .../genericDefaultsErrors.errors.txt | 4 +- .../reference/genericNewInterface.errors.txt | 8 +-- .../reference/genericRestArgs.errors.txt | 16 +++--- .../genericRestParameters3.errors.txt | 8 +-- .../genericWithOpenTypeParameters1.errors.txt | 8 +-- .../getSetAccessorContextualTyping.errors.txt | 4 +- ...thCommonJSAssignmentDeclaration.errors.txt | 4 +- .../reference/incompatibleTypes.errors.txt | 4 +- .../indexIntoArraySubclass.errors.txt | 4 +- .../reference/inferSetterParamType.errors.txt | 4 +- ...renceShouldFailOnEvolvingArrays.errors.txt | 12 ++-- ...pingWithObjectLiteralProperties.errors.txt | 8 +-- ...ringClassMembersFromAssignments.errors.txt | 8 +-- ...eritedConstructorWithRestParams.errors.txt | 8 +-- ...ritedConstructorWithRestParams2.errors.txt | 20 +++---- .../innerTypeCheckOfLambdaArgument.errors.txt | 4 +- .../intersectionPropertyCheck.errors.txt | 4 +- .../invalidAssignmentsToVoid.errors.txt | 12 ++-- .../invalidBooleanAssignments.errors.txt | 24 ++++---- .../invalidNumberAssignments.errors.txt | 8 +-- .../invalidStringAssignments.errors.txt | 8 +-- .../invalidVoidAssignments.errors.txt | 8 +-- .../reference/invalidVoidValues.errors.txt | 12 ++-- ...onExpressionInFunctionParameter.errors.txt | 4 +- .../isolatedModulesNoEmitOnError.errors.txt | 4 +- .../iterableArrayPattern28.errors.txt | 4 +- .../jsContainerMergeTsDeclaration2.errors.txt | 4 +- .../jsFileClassPropertyType.errors.txt | 4 +- .../jsFileClassPropertyType2.errors.txt | 4 +- .../jsFileClassPropertyType3.errors.txt | 4 +- ...yAssignedAfterMethodDeclaration.errors.txt | 4 +- .../reference/jsdocRestParameter.errors.txt | 4 +- ...sdocTemplateConstructorFunction.errors.txt | 4 +- ...docTemplateConstructorFunction2.errors.txt | 4 +- .../jsdocTypeFromChainedAssignment.errors.txt | 16 +++--- ...jsdocTypeFromChainedAssignment2.errors.txt | 16 +++--- .../jsdocTypeTagParameterType.errors.txt | 8 +-- .../keyofAndIndexedAccess2.errors.txt | 48 ++++++++-------- .../keyofAndIndexedAccessErrors.errors.txt | 16 +++--- .../keyofDoesntContainSymbols.errors.txt | 4 +- .../keyofIsLiteralContexualType.errors.txt | 4 +- .../reference/maxConstraints.errors.txt | 4 +- ...bolWithOutES6WellknownSymbolLib.errors.txt | 4 +- .../reference/neverTypeErrors1.errors.txt | 16 +++--- .../reference/neverTypeErrors2.errors.txt | 16 +++--- .../reference/noEmitOnError.errors.txt | 4 +- .../reference/noErrorTruncation.errors.txt | 4 +- .../nonPrimitiveAssignError.errors.txt | 4 +- .../nonPrimitiveInGeneric.errors.txt | 8 +-- .../reference/nonPrimitiveNarrow.errors.txt | 4 +- .../nonPrimitiveUnionIntersection.errors.txt | 12 ++-- .../reference/numberToString.errors.txt | 4 +- .../numberVsBigIntOperations.errors.txt | 8 +-- .../numericIndexExpressions.errors.txt | 16 +++--- .../reference/objectCreate-errors.errors.txt | 24 ++++---- ...onExpressionInFunctionParameter.errors.txt | 4 +- .../objectLitTargetTypeCallSite.errors.txt | 4 +- .../reference/objectLiteralErrors.errors.txt | 4 +- .../optionalBindingParameters1.errors.txt | 4 +- .../optionalBindingParameters2.errors.txt | 4 +- ...alBindingParametersInOverloads1.errors.txt | 4 +- ...alBindingParametersInOverloads2.errors.txt | 4 +- .../baselines/reference/overload1.errors.txt | 8 +-- ...rloadOnConstNoAnyImplementation.errors.txt | 4 +- ...loadOnConstNoAnyImplementation2.errors.txt | 8 +-- ...dOnConstNoStringImplementation2.errors.txt | 4 +- .../reference/overloadResolution.errors.txt | 28 +++++----- ...loadResolutionClassConstructors.errors.txt | 20 +++---- .../overloadResolutionConstructors.errors.txt | 28 +++++----- .../overloadResolutionTest1.errors.txt | 8 +-- ...aramTagOnFunctionUsingArguments.errors.txt | 4 +- ...ationInStrictModeByDefaultInES6.errors.txt | 4 +- .../primitiveConstraints2.errors.txt | 4 +- .../privateNameFieldsESNext.errors.txt | 4 +- .../amd/nodeModulesImportHigher.errors.txt | 4 +- .../node/nodeModulesImportHigher.errors.txt | 4 +- .../nodeModulesMaxDepthExceeded.errors.txt | 4 +- .../nodeModulesMaxDepthExceeded.errors.txt | 4 +- .../nodeModulesMaxDepthIncreased.errors.txt | 4 +- .../nodeModulesMaxDepthIncreased.errors.txt | 4 +- tests/baselines/reference/qualify.errors.txt | 8 +-- .../recursiveFunctionTypes.errors.txt | 28 +++++----- .../recursiveTupleTypeInference.errors.txt | 4 +- .../recursiveTypeReferences1.errors.txt | 4 +- ...estParameterWithBindingPattern3.errors.txt | 12 ++-- .../reference/returnInConstructor1.errors.txt | 8 +-- ...pertyAssignmentsInDestructuring.errors.txt | 24 +++----- ...yAssignmentsInDestructuring_ES6.errors.txt | 24 +++----- ...edSignatureAsCallbackParameter1.errors.txt | 8 +-- .../reference/strictBindCallApply1.errors.txt | 48 ++++++++-------- ...ingLiteralsWithEqualityChecks03.errors.txt | 8 +-- ...ingLiteralsWithEqualityChecks04.errors.txt | 8 +-- .../stringPropertyAccessWithError.errors.txt | 4 +- .../superCallArgsMustMatch.errors.txt | 4 +- .../superCallAssignResult.errors.txt | 4 +- .../reference/symbolProperty46.errors.txt | 4 +- .../reference/symbolProperty47.errors.txt | 8 +-- ...eStringsWithOverloadResolution1.errors.txt | 8 +-- ...ingsWithOverloadResolution1_ES6.errors.txt | 8 +-- ...eStringsWithOverloadResolution3.errors.txt | 16 +++--- ...ingsWithOverloadResolution3_ES6.errors.txt | 16 +++--- ...essionsInSubstitutionExpression.errors.txt | 4 +- ...ionsInSubstitutionExpressionES6.errors.txt | 4 +- ...hIncompleteTemplateExpressions3.errors.txt | 4 +- ...hIncompleteTemplateExpressions6.errors.txt | 4 +- ...ggedTemplatesWithTypeArguments2.errors.txt | 8 +-- .../reference/targetTypeBaseCalls.errors.txt | 12 ++-- ...essionsInSubstitutionExpression.errors.txt | 4 +- ...ionsInSubstitutionExpressionES6.errors.txt | 4 +- .../thisTypeInFunctionsNegative.errors.txt | 20 +++---- .../reference/ts-expect-error.errors.txt | 4 +- .../baselines/reference/ts-ignore.errors.txt | 4 +- .../when-preserveWatchOutput-is-not-used.js | 6 +- ...veWatchOutput-is-passed-on-command-line.js | 6 +- .../own-file-emit-with-errors-incremental.js | 8 +-- .../own-file-emit-with-errors-watch.js | 8 +-- .../own-file-emit-with-errors-incremental.js | 8 +-- .../own-file-emit-with-errors-watch.js | 8 +-- ...on-emit-is-disabled-in-compiler-options.js | 4 +- .../tsxAttributeResolution14.errors.txt | 4 +- .../tsxAttributeResolution6.errors.txt | 4 +- .../tsxSpreadAttributesResolution2.errors.txt | 4 +- ...elessFunctionComponentOverload4.errors.txt | 16 +++--- ...elessFunctionComponentOverload5.errors.txt | 16 +++--- ...ionComponentsWithTypeArguments2.errors.txt | 4 +- .../reference/tsxUnionElementType1.errors.txt | 4 +- .../reference/tsxUnionElementType4.errors.txt | 4 +- .../typeArgInference2WithError.errors.txt | 4 +- ...peArgumentConstraintResolution1.errors.txt | 8 +-- ...entInferenceConstructSignatures.errors.txt | 4 +- .../typeArgumentInferenceErrors.errors.txt | 4 +- ...OnFunctionsWithNoTypeParameters.errors.txt | 8 +-- ...eAssertionToGenericFunctionType.errors.txt | 4 +- ...InsideFunctionExpressionInArray.errors.txt | 4 +- .../typeFromJSConstructor.errors.txt | 12 ++-- .../typeFromJSInitializer.errors.txt | 4 +- .../typeFromPropertyAssignment22.errors.txt | 4 +- .../typeFromPropertyAssignment31.errors.txt | 8 +-- .../typeFromPropertyAssignment32.errors.txt | 8 +-- .../typeFromPropertyAssignment33.errors.txt | 8 +-- .../typeGuardFunctionErrors.errors.txt | 4 +- ...nstanceOfByConstructorSignature.errors.txt | 4 +- .../baselines/reference/typeName1.errors.txt | 56 +++++++++---------- .../reference/typeOfOnTypeArg.errors.txt | 4 +- .../reference/typeOfOperator1.errors.txt | 8 +-- ...meterAsTypeParameterConstraint2.errors.txt | 4 +- .../reference/typeTagModuleExports.errors.txt | 4 +- .../typeTagPrototypeAssignment.errors.txt | 4 +- .../types.asyncGenerators.es2018.2.errors.txt | 12 ++-- .../unionTypeCallSignatures.errors.txt | 56 +++++++++---------- .../unionTypeConstructSignatures.errors.txt | 56 +++++++++---------- .../reference/unionTypeInference.errors.txt | 8 +-- .../unionTypeWithIndexSignature.errors.txt | 4 +- .../reference/uniqueSymbolsErrors.errors.txt | 4 +- .../reference/unknownType1.errors.txt | 4 +- tests/baselines/reference/vararg.errors.txt | 8 +-- .../reference/widenedTypes.errors.txt | 8 +-- .../wrappedRecursiveGenericType.errors.txt | 8 +-- 242 files changed, 1099 insertions(+), 1104 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 087353fb9fdc3..4fee6c27924b6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4070,12 +4070,19 @@ namespace ts { let leftStr = symbolValueDeclarationIsContextSensitive(left.symbol) ? typeToString(left, left.symbol.valueDeclaration) : typeToString(left); let rightStr = symbolValueDeclarationIsContextSensitive(right.symbol) ? typeToString(right, right.symbol.valueDeclaration) : typeToString(right); if (leftStr === rightStr) { - leftStr = typeToString(left, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); - rightStr = typeToString(right, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); + leftStr = getTypeNameForErrorDisplay(left); + rightStr = getTypeNameForErrorDisplay(right); + } + else if (isLiteralType(left) && !isLiteralType(right)) { + leftStr = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(left)) } return [leftStr, rightStr]; } + function getTypeNameForErrorDisplay(type: Type) { + return typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); + } + function symbolValueDeclarationIsContextSensitive(symbol: Symbol): boolean { return symbol && symbol.valueDeclaration && isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration); } diff --git a/tests/baselines/reference/ES5For-of30.errors.txt b/tests/baselines/reference/ES5For-of30.errors.txt index 284dd372e5a72..e99b8284bf336 100644 --- a/tests/baselines/reference/ES5For-of30.errors.txt +++ b/tests/baselines/reference/ES5For-of30.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'string | number' is not an array type. -tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,7): error TS2322: Type '1' is not assignable to type 'string'. -tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,7): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts (3 errors) ==== @@ -10,9 +10,9 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error ~~~~~~~~~~~~~~~ !!! error TS2461: Type 'string | number' is not an array type. ~ -!!! error TS2322: Type '1' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. ~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. a; b; } \ No newline at end of file diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt index 278de87e729db..154d923b6194f 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt @@ -1,14 +1,14 @@ tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,48): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,48): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,47): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,47): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,52): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,52): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,51): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,51): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -21,13 +21,13 @@ tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. public get AnnotatedSetter_SetterLast() { return ""; } ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. public set AnnotatedSetter_SetterLast(a: number) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -39,13 +39,13 @@ tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. public set AnnotatedGetter_GetterLast(aStr) { aStr = 0; } ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. public get AnnotatedGetter_GetterLast(): string { return ""; } ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. diff --git a/tests/baselines/reference/aliasAssignments.errors.txt b/tests/baselines/reference/aliasAssignments.errors.txt index b93875bc6311a..43d6ea58e5826 100644 --- a/tests/baselines/reference/aliasAssignments.errors.txt +++ b/tests/baselines/reference/aliasAssignments.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/aliasAssignments_1.ts(3,1): error TS2322: Type '1' is not assignable to type 'typeof import("tests/cases/compiler/aliasAssignments_moduleA")'. +tests/cases/compiler/aliasAssignments_1.ts(3,1): error TS2322: Type 'number' is not assignable to type 'typeof import("tests/cases/compiler/aliasAssignments_moduleA")'. tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof import("tests/cases/compiler/aliasAssignments_moduleA")' is not assignable to type 'number'. @@ -7,7 +7,7 @@ tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof impo var x = moduleA; x = 1; // Should be error ~ -!!! error TS2322: Type '1' is not assignable to type 'typeof import("tests/cases/compiler/aliasAssignments_moduleA")'. +!!! error TS2322: Type 'number' is not assignable to type 'typeof import("tests/cases/compiler/aliasAssignments_moduleA")'. var y = 1; y = moduleA; // should be error ~ diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.errors.txt b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.errors.txt index 5548bc5e3dcc4..b3a3e81fea162 100644 --- a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.errors.txt +++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/app.js(6,7): error TS2322: Type '1' is not assignable to type 'WatchHandler'. +tests/cases/compiler/app.js(6,7): error TS2322: Type 'number' is not assignable to type 'WatchHandler'. ==== tests/cases/compiler/func.ts (0 errors) ==== @@ -16,7 +16,7 @@ tests/cases/compiler/app.js(6,7): error TS2322: Type '1' is not assignable to ty data1(val) { this.data2 = 1; ~~~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'WatchHandler'. +!!! error TS2322: Type 'number' is not assignable to type 'WatchHandler'. }, data2(val) { }, } diff --git a/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt b/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt index c19f00fa1da73..89ef8ded91c64 100644 --- a/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt +++ b/tests/baselines/reference/argumentsBindsToFunctionScopeArgumentList.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS2322: Type '10' is not assignable to type 'IArguments'. +tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS2322: Type 'number' is not assignable to type 'IArguments'. ==== tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts (1 errors) ==== @@ -6,5 +6,5 @@ tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS function foo(a) { arguments = 10; /// This shouldnt be of type number and result in error. ~~~~~~~~~ -!!! error TS2322: Type '10' is not assignable to type 'IArguments'. +!!! error TS2322: Type 'number' is not assignable to type 'IArguments'. } \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiterals3.errors.txt b/tests/baselines/reference/arrayLiterals3.errors.txt index 7a7213dd30b3e..17c3d582b4d6a 100644 --- a/tests/baselines/reference/arrayLiterals3.errors.txt +++ b/tests/baselines/reference/arrayLiterals3.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(10,5): error TS2739: Type '[]' is missing the following properties from type '[any, any, any]': 0, 1, 2 tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,38): error TS2322: Type 'string' is not assignable to type 'boolean'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,48): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,51): error TS2322: Type 'true' is not assignable to type 'number'. +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,51): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'. Types of property 'length' are incompatible. Type '4' is not assignable to type '2'. @@ -31,7 +31,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error ~ !!! error TS2322: Type 'number' is not assignable to type 'string'. ~~~~ -!!! error TS2322: Type 'true' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1), diff --git a/tests/baselines/reference/assignToFn.errors.txt b/tests/baselines/reference/assignToFn.errors.txt index 42a1a129a2395..7f2c7855a359d 100644 --- a/tests/baselines/reference/assignToFn.errors.txt +++ b/tests/baselines/reference/assignToFn.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/assignToFn.ts(8,5): error TS2322: Type '"hello"' is not assignable to type '(n: number) => boolean'. +tests/cases/compiler/assignToFn.ts(8,5): error TS2322: Type 'string' is not assignable to type '(n: number) => boolean'. ==== tests/cases/compiler/assignToFn.ts (1 errors) ==== @@ -11,6 +11,6 @@ tests/cases/compiler/assignToFn.ts(8,5): error TS2322: Type '"hello"' is not ass x.f="hello"; ~~~ -!!! error TS2322: Type '"hello"' is not assignable to type '(n: number) => boolean'. +!!! error TS2322: Type 'string' is not assignable to type '(n: number) => boolean'. } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompat1.errors.txt b/tests/baselines/reference/assignmentCompat1.errors.txt index d393d553ce414..38bc0af3dc85b 100644 --- a/tests/baselines/reference/assignmentCompat1.errors.txt +++ b/tests/baselines/reference/assignmentCompat1.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2741: Property 'one' is missing in type '{ [index: string]: any; }' but required in type '{ one: number; }'. tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2741: Property 'one' is missing in type '{ [index: number]: any; }' but required in type '{ one: number; }'. -tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type '"foo"' is not assignable to type '{ [index: string]: any; }'. -tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'false' is not assignable to type '{ [index: number]: any; }'. +tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'. +tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'. ==== tests/cases/compiler/assignmentCompat1.ts (4 errors) ==== @@ -20,10 +20,10 @@ tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'false' is n z = x; // Ok because index signature type is any y = "foo"; // Error ~ -!!! error TS2322: Type '"foo"' is not assignable to type '{ [index: string]: any; }'. +!!! error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'. z = "foo"; // OK, string has numeric indexer z = false; // Error ~ -!!! error TS2322: Type 'false' is not assignable to type '{ [index: number]: any; }'. +!!! error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt b/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt index 870c5f8839dea..292852bf99217 100644 --- a/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt +++ b/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(4,17): error TS2322: Type 'false' is not assignable to type 'string'. +tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(4,17): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(5,5): error TS2345: Argument of type '{ name: string; }' is not assignable to parameter of type '{ id: number; name?: string; }'. Property 'id' is missing in type '{ name: string; }' but required in type '{ id: number; name?: string; }'. @@ -12,7 +12,7 @@ tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts(5,5): error TS foo({ id: 1234, name: "hello" }); // Ok foo({ id: 1234, name: false }); // Error, name of wrong type ~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. !!! related TS6500 tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts:1:31: The expected type comes from property 'name' which is declared here on type '{ id: number; name?: string; }' foo({ name: "hello" }); // Error, id required but missing ~~~~~~~~~~~~~~~~~ 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 cc61e0ebfe475..92ea8a146528d 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 @@ -1,10 +1,10 @@ -tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(10,1): error TS2322: Type '""' is not assignable to type 'Applicable'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Applicable'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(11,1): error TS2741: Property 'apply' is missing in type 'string[]' but required in type 'Applicable'. -tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1): error TS2322: Type '4' is not assignable to type 'Applicable'. +tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Applicable'. tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(13,1): error TS2741: Property 'apply' is missing in type '{}' but required in type 'Applicable'. -tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type '""' is not assignable to parameter of type 'Applicable'. +tests/cases/compiler/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'. tests/cases/compiler/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'. -tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type '4' is not assignable to parameter of type 'Applicable'. +tests/cases/compiler/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'. tests/cases/compiler/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'. @@ -21,14 +21,14 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi // Should fail x = ''; ~ -!!! error TS2322: Type '""' is not assignable to type 'Applicable'. +!!! error TS2322: Type 'string' is not assignable to type 'Applicable'. x = ['']; ~ !!! error TS2741: Property 'apply' is missing in type 'string[]' but required in type 'Applicable'. !!! related TS2728 tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts:4:5: 'apply' is declared here. x = 4; ~ -!!! error TS2322: Type '4' is not assignable to type 'Applicable'. +!!! error TS2322: Type 'number' is not assignable to type 'Applicable'. x = {}; ~ !!! error TS2741: Property 'apply' is missing in type '{}' but required in type 'Applicable'. @@ -43,13 +43,13 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi // Should Fail fn(''); ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'Applicable'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'. fn(['']); ~~~~ !!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Applicable'. fn(4); ~ -!!! error TS2345: Argument of type '4' is not assignable to parameter of type 'Applicable'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Applicable'. fn({}); ~~ !!! error TS2345: Argument of type '{}' 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 d1894692635a5..b7a51bce4a0d1 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 @@ -1,10 +1,10 @@ -tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(10,1): error TS2322: Type '""' is not assignable to type 'Callable'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Callable'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(11,1): error TS2741: Property 'call' is missing in type 'string[]' but required in type 'Callable'. -tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(12,1): error TS2322: Type '4' is not assignable to type 'Callable'. +tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Callable'. tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(13,1): error TS2741: Property 'call' is missing in type '{}' but required in type 'Callable'. -tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type '""' is not assignable to parameter of type 'Callable'. +tests/cases/compiler/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'. tests/cases/compiler/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'. -tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type '4' is not assignable to parameter of type 'Callable'. +tests/cases/compiler/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'. tests/cases/compiler/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'. @@ -21,14 +21,14 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio // Should fail x = ''; ~ -!!! error TS2322: Type '""' is not assignable to type 'Callable'. +!!! error TS2322: Type 'string' is not assignable to type 'Callable'. x = ['']; ~ !!! error TS2741: Property 'call' is missing in type 'string[]' but required in type 'Callable'. !!! related TS2728 tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts:4:5: 'call' is declared here. x = 4; ~ -!!! error TS2322: Type '4' is not assignable to type 'Callable'. +!!! error TS2322: Type 'number' is not assignable to type 'Callable'. x = {}; ~ !!! error TS2741: Property 'call' is missing in type '{}' but required in type 'Callable'. @@ -43,13 +43,13 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio // Should Fail fn(''); ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'Callable'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Callable'. fn(['']); ~~~~ !!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Callable'. fn(4); ~ -!!! error TS2345: Argument of type '4' is not assignable to parameter of type 'Callable'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Callable'. fn({}); ~~ !!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'Callable'. diff --git a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt index b5d6d0668a7dc..6a031ff6863be 100644 --- a/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt +++ b/tests/baselines/reference/assignmentToParenthesizedIdentifiers.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(4,1): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(5,1): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(13,1): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(14,1): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(15,1): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(4,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(5,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(13,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(14,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(15,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(17,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(18,2): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(25,5): error TS2539: Cannot assign to 'M3' because it is not a variable. @@ -11,13 +11,13 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(33,13): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(37,1): error TS2539: Cannot assign to 'fn' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(38,2): error TS2539: Cannot assign to 'fn' because it is not a variable. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(43,5): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(44,5): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(48,5): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(49,5): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(54,5): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(55,5): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(56,5): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(43,5): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(44,5): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(48,5): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(49,5): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(54,5): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(55,5): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(56,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(62,1): error TS2539: Cannot assign to 'E' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(63,2): error TS2539: Cannot assign to 'E' because it is not a variable. tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(69,1): error TS2539: Cannot assign to 'C' because it is not a variable. @@ -30,10 +30,10 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize (x) = 3; // OK x = ''; // Error ~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. (x) = ''; // Error ~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. module M { export var y: number; @@ -43,13 +43,13 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize (M.y) = 3; // OK M.y = ''; // Error ~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. (M).y = ''; // Error ~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. (M.y) = ''; // Error ~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. M = { y: 3 }; // Error ~ @@ -98,32 +98,32 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize (x) = 3; // OK x = ''; // Error ~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. (x) = ''; // Error ~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. (y).t = 3; // OK (y.t) = 3; // OK (y).t = ''; // Error ~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. (y.t) = ''; // Error ~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. y['t'] = 3; // OK (y)['t'] = 3; // OK (y['t']) = 3; // OK y['t'] = ''; // Error ~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. (y)['t'] = ''; // Error ~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. (y['t']) = ''; // Error ~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } enum E { diff --git a/tests/baselines/reference/asyncArrowFunction_allowJs.errors.txt b/tests/baselines/reference/asyncArrowFunction_allowJs.errors.txt index 6c8d0c370d209..79fc6647f1f5e 100644 --- a/tests/baselines/reference/asyncArrowFunction_allowJs.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction_allowJs.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(3,17): error TS2322: Type '0' is not assignable to type 'string'. -tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(7,23): error TS2322: Type '0' is not assignable to type 'string'. -tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(12,2): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(3,17): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(7,23): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(12,2): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(19,3): error TS2345: Argument of type '() => Promise' is not assignable to parameter of type '() => string'. Type 'Promise' is not assignable to type 'string'. @@ -10,20 +10,20 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(19,3): error TS2 /** @type {function(): string} */ const a = () => 0 ~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. // Error (good) /** @type {function(): string} */ const b = async () => 0 ~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. // No error (bad) /** @type {function(): string} */ const c = async () => { return 0 ~~~~~~~~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. } /** @type {function(function(): string): void} */ diff --git a/tests/baselines/reference/baseCheck.errors.txt b/tests/baselines/reference/baseCheck.errors.txt index 67358a1033834..16bdd632b502f 100644 --- a/tests/baselines/reference/baseCheck.errors.txt +++ b/tests/baselines/reference/baseCheck.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. D tests/cases/compiler/baseCheck.ts(17,53): error TS2554: Expected 2 arguments, but got 1. tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/compiler/baseCheck.ts(18,62): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/compiler/baseCheck.ts(19,68): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/compiler/baseCheck.ts(22,9): error TS2304: Cannot find name 'x'. tests/cases/compiler/baseCheck.ts(23,7): error TS2304: Cannot find name 'x'. @@ -40,7 +40,7 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'. !!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. class F extends C { constructor(public z: number) { super("hello", this.z) } } // first param type ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ~~~~ !!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. diff --git a/tests/baselines/reference/bigintIndex.errors.txt b/tests/baselines/reference/bigintIndex.errors.txt index daf9fa7562dd9..216e2d4857f07 100644 --- a/tests/baselines/reference/bigintIndex.errors.txt +++ b/tests/baselines/reference/bigintIndex.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/a.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/compiler/a.ts(8,11): error TS2538: Type '1n' cannot be used as an index type. -tests/cases/compiler/a.ts(14,1): error TS2322: Type '123n' is not assignable to type 'string | number | symbol'. +tests/cases/compiler/a.ts(14,1): error TS2322: Type 'bigint' is not assignable to type 'string | number | symbol'. tests/cases/compiler/a.ts(19,12): error TS2538: Type 'bigint' cannot be used as an index type. tests/cases/compiler/b.ts(2,12): error TS1136: Property assignment expected. tests/cases/compiler/b.ts(2,14): error TS1005: ';' expected. @@ -29,7 +29,7 @@ tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be key = Symbol(); key = 123n; // should error ~~~ -!!! error TS2322: Type '123n' is not assignable to type 'string | number | symbol'. +!!! error TS2322: Type 'bigint' is not assignable to type 'string | number | symbol'. // Show correct usage of bigint index: explicitly convert to string const bigNum: bigint = 0n; diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index 62b63d69bf324..976f35ba6a82e 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -22,8 +22,8 @@ tests/cases/compiler/bigintWithLib.ts(28,35): error TS2769: No overload matches Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. Type 'number[]' is not assignable to type 'SharedArrayBuffer'. tests/cases/compiler/bigintWithLib.ts(33,13): error TS2540: Cannot assign to 'length' because it is a read-only property. -tests/cases/compiler/bigintWithLib.ts(40,25): error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'. -tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'. +tests/cases/compiler/bigintWithLib.ts(40,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'. +tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'. ==== tests/cases/compiler/bigintWithLib.ts (7 errors) ==== @@ -97,12 +97,12 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12 dataView.setBigInt64(1, -1n, true); dataView.setBigInt64(1, -1); // should error ~~ -!!! error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'. dataView.setBigUint64(2, 123n); dataView.setBigUint64(2, 123n, true); dataView.setBigUint64(2, 123); // should error ~~~ -!!! error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'. bigintVal = dataView.getBigInt64(1); bigintVal = dataView.getBigInt64(1, true); bigintVal = dataView.getBigUint64(2); diff --git a/tests/baselines/reference/booleanAssignment.errors.txt b/tests/baselines/reference/booleanAssignment.errors.txt index 8a928c57404b9..429b9843598c6 100644 --- a/tests/baselines/reference/booleanAssignment.errors.txt +++ b/tests/baselines/reference/booleanAssignment.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/booleanAssignment.ts(2,1): error TS2322: Type '1' is not assignable to type 'Boolean'. -tests/cases/compiler/booleanAssignment.ts(3,1): error TS2322: Type '"a"' is not assignable to type 'Boolean'. +tests/cases/compiler/booleanAssignment.ts(2,1): error TS2322: Type 'number' is not assignable to type 'Boolean'. +tests/cases/compiler/booleanAssignment.ts(3,1): error TS2322: Type 'string' is not assignable to type 'Boolean'. tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not assignable to type 'Boolean'. The types returned by 'valueOf()' are incompatible between these types. Type 'Object' is not assignable to type 'boolean'. @@ -9,10 +9,10 @@ tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not a var b = new Boolean(); b = 1; // Error ~ -!!! error TS2322: Type '1' is not assignable to type 'Boolean'. +!!! error TS2322: Type 'number' is not assignable to type 'Boolean'. b = "a"; // Error ~ -!!! error TS2322: Type '"a"' is not assignable to type 'Boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'Boolean'. b = {}; // Error ~ !!! error TS2322: Type '{}' is not assignable to type 'Boolean'. diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt index 0b542186c292d..63a63309c31f6 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt @@ -12,7 +12,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWith tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(44,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer. @@ -91,7 +91,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWith ~ !!! error TS1015: Parameter cannot have question mark and initializer. ~~~~~~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. b: (x?: any = '') => { } ~ !!! error TS1015: Parameter cannot have question mark and initializer. diff --git a/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.errors.txt b/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.errors.txt index 03219e806ef08..1c558910a8c0a 100644 --- a/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.errors.txt +++ b/tests/baselines/reference/callSignaturesShouldBeResolvedBeforeSpecialization.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts(9,10): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts(9,10): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts (1 errors) ==== @@ -12,5 +12,5 @@ tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts(9,10) test("expects boolean instead of string"); // should not error - "test" should not expect a boolean test(true); // should error - string expected ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt index 87999dec851d4..4ff65843eba64 100644 --- a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(8,11): error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I'. Named property 'foo' of types 'I' and 'I' are not identical. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts (2 errors) ==== @@ -21,5 +21,5 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesTha var r = x.foo(1); // no error var r2 = x.foo(''); // error ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt index a3893a8374797..6926ee47722ce 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt @@ -2,9 +2,9 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete 'S' could be instantiated with an arbitrary type which could be unrelated to 'T'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(10,35): error TS2322: Type 'T' is not assignable to type 'S'. 'S' could be instantiated with an arbitrary type which could be unrelated to 'T'. -tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts (5 errors) ==== @@ -49,16 +49,16 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete // Should get an error that we are assigning a string to a number (new Chain2(i)).then(ii => t).then(tt => s).value.x = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. // Staying at T or S should keep the constraint. // Get an error when we assign a string to a number in both cases (new Chain2(i)).then(ii => t).then(tt => t).then(tt => t).then(tt => t).value.x = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. (new Chain2(i)).then(ii => s).then(ss => s).then(ss => s).then(ss => s).value.x = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. return null; } diff --git a/tests/baselines/reference/chainedPrototypeAssignment.errors.txt b/tests/baselines/reference/chainedPrototypeAssignment.errors.txt index 154a66c2a5802..509cad2d114eb 100644 --- a/tests/baselines/reference/chainedPrototypeAssignment.errors.txt +++ b/tests/baselines/reference/chainedPrototypeAssignment.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/salsa/use.js(5,5): error TS2345: Argument of type '"nope"' is not assignable to parameter of type 'number'. -tests/cases/conformance/salsa/use.js(6,5): error TS2345: Argument of type '"not really"' is not assignable to parameter of type 'number'. +tests/cases/conformance/salsa/use.js(5,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/salsa/use.js(6,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== tests/cases/conformance/salsa/use.js (2 errors) ==== @@ -9,10 +9,10 @@ tests/cases/conformance/salsa/use.js(6,5): error TS2345: Argument of type '"not var b = new mod.B() a.m('nope') ~~~~~~ -!!! error TS2345: Argument of type '"nope"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. b.m('not really') ~~~~~~~~~~~~ -!!! error TS2345: Argument of type '"not really"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== tests/cases/conformance/salsa/types.d.ts (0 errors) ==== declare function require(name: string): any; diff --git a/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt b/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt index cce3d89a761ed..6a4bdaf30a80f 100644 --- a/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt +++ b/tests/baselines/reference/checkExportsObjectAssignProperty.errors.txt @@ -1,13 +1,13 @@ tests/cases/conformance/jsdoc/validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. tests/cases/conformance/jsdoc/validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. -tests/cases/conformance/jsdoc/validator.ts(19,1): error TS2322: Type '"no"' is not assignable to type 'number'. -tests/cases/conformance/jsdoc/validator.ts(20,1): error TS2322: Type '"no"' is not assignable to type 'number'. -tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/validator.ts(19,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/validator.ts(20,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsdoc/validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. tests/cases/conformance/jsdoc/validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. -tests/cases/conformance/jsdoc/validator.ts(39,1): error TS2322: Type '0' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/validator.ts(40,1): error TS2322: Type '"no"' is not assignable to type 'number'. -tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/validator.ts(39,1): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/validator.ts(40,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsdoc/validator.ts (10 errors) ==== @@ -35,13 +35,13 @@ tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not !!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. m1.thing = "no"; ~~~~~~~~ -!!! error TS2322: Type '"no"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. m1.rwAccessors = "no"; ~~~~~~~~~~~~~~ -!!! error TS2322: Type '"no"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. m1.setonlyAccessor = 0; ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. import m2 = require("./mod2"); @@ -65,13 +65,13 @@ tests/cases/conformance/jsdoc/validator.ts(41,1): error TS2322: Type '0' is not !!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. m2.thing = 0; ~~~~~~~~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. m2.rwAccessors = "no"; ~~~~~~~~~~~~~~ -!!! error TS2322: Type '"no"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. m2.setonlyAccessor = 0; ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsdoc/mod1.js (0 errors) ==== Object.defineProperty(exports, "thing", { value: 42, writable: true }); diff --git a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt index 4d9ced8525397..316c07854eb3d 100644 --- a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt +++ b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/jsdoc/validator.ts(19,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. tests/cases/conformance/jsdoc/validator.ts(20,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. -tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type '"no"' is not assignable to type 'number'. -tests/cases/conformance/jsdoc/validator.ts(22,1): error TS2322: Type '"no"' is not assignable to type 'number'. -tests/cases/conformance/jsdoc/validator.ts(23,1): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/validator.ts(21,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/validator.ts(22,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/validator.ts(23,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsdoc/validator.ts (5 errors) ==== @@ -32,13 +32,13 @@ tests/cases/conformance/jsdoc/validator.ts(23,1): error TS2322: Type '0' is not !!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. m1.thing = "no"; ~~~~~~~~ -!!! error TS2322: Type '"no"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. m1.rwAccessors = "no"; ~~~~~~~~~~~~~~ -!!! error TS2322: Type '"no"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. m1.setonlyAccessor = 0; ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsdoc/mod1.js (0 errors) ==== diff --git a/tests/baselines/reference/checkJsFiles.errors.txt b/tests/baselines/reference/checkJsFiles.errors.txt index 4f6e59233b2fd..af11070f31766 100644 --- a/tests/baselines/reference/checkJsFiles.errors.txt +++ b/tests/baselines/reference/checkJsFiles.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/a.js(2,1): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/compiler/a.js(2,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/a.js (1 errors) ==== var x = "string"; x = 0; ~ -!!! error TS2322: Type '0' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsFiles2.errors.txt b/tests/baselines/reference/checkJsFiles2.errors.txt index 2bdca3c8c18f7..6b76852e4b8a5 100644 --- a/tests/baselines/reference/checkJsFiles2.errors.txt +++ b/tests/baselines/reference/checkJsFiles2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/compiler/a.js(3,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/a.js (1 errors) ==== @@ -6,4 +6,4 @@ tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type var x = "string"; x = 0; ~ -!!! error TS2322: Type '0' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsFiles3.errors.txt b/tests/baselines/reference/checkJsFiles3.errors.txt index 2bdca3c8c18f7..6b76852e4b8a5 100644 --- a/tests/baselines/reference/checkJsFiles3.errors.txt +++ b/tests/baselines/reference/checkJsFiles3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/compiler/a.js(3,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/a.js (1 errors) ==== @@ -6,4 +6,4 @@ tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type var x = "string"; x = 0; ~ -!!! error TS2322: Type '0' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsFiles4.errors.txt b/tests/baselines/reference/checkJsFiles4.errors.txt index 2bdca3c8c18f7..6b76852e4b8a5 100644 --- a/tests/baselines/reference/checkJsFiles4.errors.txt +++ b/tests/baselines/reference/checkJsFiles4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/compiler/a.js(3,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/a.js (1 errors) ==== @@ -6,4 +6,4 @@ tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type var x = "string"; x = 0; ~ -!!! error TS2322: Type '0' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsdocReturnTag2.errors.txt b/tests/baselines/reference/checkJsdocReturnTag2.errors.txt index 23a450c83ca89..8ff291f2e5579 100644 --- a/tests/baselines/reference/checkJsdocReturnTag2.errors.txt +++ b/tests/baselines/reference/checkJsdocReturnTag2.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/jsdoc/returns.js(6,5): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'true | 5' is not assignable to type 'string | number'. - Type 'true' is not assignable to type 'string | number'. +tests/cases/conformance/jsdoc/returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. + Type 'boolean' is not assignable to type 'string | number'. ==== tests/cases/conformance/jsdoc/returns.js (2 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'true | 5' is function f() { return 5; ~~~~~~~~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. } /** @@ -20,6 +20,6 @@ tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'true | 5' is function f1() { return 5 || true; ~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'true | 5' is not assignable to type 'string | number'. -!!! error TS2322: Type 'true' is not assignable to type 'string | number'. +!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. } \ No newline at end of file diff --git a/tests/baselines/reference/checkJsdocTypeTag2.errors.txt b/tests/baselines/reference/checkJsdocTypeTag2.errors.txt index 2f57ec7f542f9..ca1750593060e 100644 --- a/tests/baselines/reference/checkJsdocTypeTag2.errors.txt +++ b/tests/baselines/reference/checkJsdocTypeTag2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/jsdoc/0.js(3,5): error TS2322: Type 'true' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/0.js(6,5): error TS2322: Type '"hello"' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/0.js(3,5): error TS2322: Type 'boolean' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/0.js(6,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/jsdoc/0.js(8,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. -tests/cases/conformance/jsdoc/0.js(10,4): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'. +tests/cases/conformance/jsdoc/0.js(10,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/jsdoc/0.js(17,1): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsdoc/0.js(20,21): error TS2339: Property 'concat' does not exist on type 'number'. tests/cases/conformance/jsdoc/0.js(24,19): error TS2322: Type 'number' is not assignable to type 'string'. @@ -12,12 +12,12 @@ tests/cases/conformance/jsdoc/0.js(24,19): error TS2322: Type 'number' is not as /** @type {String} */ var S = true; ~ -!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. /** @type {number} */ var n = "hello"; ~ -!!! error TS2322: Type '"hello"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. /** @type {function (number)} */ ~~~~~~~~~~~~~~~~~ @@ -25,7 +25,7 @@ tests/cases/conformance/jsdoc/0.js(24,19): error TS2322: Type 'number' is not as const x1 = (a) => a + 1; x1("string"); ~~~~~~~~ -!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. /** @type {function (number): number} */ const x2 = (a) => a + 1; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt index a94d8f7a3ba36..825347f0d776f 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/jsdoc/0.js(5,3): error TS2322: Type 'number' is not assignable to type 'string | undefined'. -tests/cases/conformance/jsdoc/0.js(8,7): error TS2322: Type '"42"' is not assignable to type 'number'. -tests/cases/conformance/jsdoc/0.js(11,20): error TS2322: Type '"lol"' is not assignable to type 'number'. -tests/cases/conformance/jsdoc/0.js(13,15): error TS2322: Type '"0"' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/0.js(8,7): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/0.js(11,20): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/0.js(13,15): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/jsdoc/0.js(15,3): error TS2322: Type 'undefined' is not assignable to type 'string'. tests/cases/conformance/jsdoc/0.js(19,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsdoc/0.js(22,5): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"' is not assignable to parameter of type 'number'. +tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== tests/cases/conformance/jsdoc/0.js (8 errors) ==== @@ -20,16 +20,16 @@ tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"' method1(n1) { return "42"; ~~~~~~~~~~~~ -!!! error TS2322: Type '"42"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. }, /** @type {function(number): number} */ method2: (n1) => "lol", ~~~~~ -!!! error TS2322: Type '"lol"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. /** @type {function(number): number} */ arrowFunc: (num="0") => num + 42, ~~~~~~~ -!!! error TS2322: Type '"0"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. /** @type {string} */ lol ~~~ @@ -46,4 +46,4 @@ tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"' ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. ~~~ -!!! error TS2345: Argument of type '"0"' is not assignable to parameter of type 'number'. \ No newline at end of file +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/checkObjectDefineProperty.errors.txt b/tests/baselines/reference/checkObjectDefineProperty.errors.txt index 373b219d96c02..c9e04c601037a 100644 --- a/tests/baselines/reference/checkObjectDefineProperty.errors.txt +++ b/tests/baselines/reference/checkObjectDefineProperty.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/jsdoc/validate.ts(14,3): error TS2540: Cannot assign to 'lastName' because it is a read-only property. tests/cases/conformance/jsdoc/validate.ts(15,3): error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. -tests/cases/conformance/jsdoc/validate.ts(16,1): error TS2322: Type '12' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/validate.ts(16,1): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsdoc/validate.ts(17,3): error TS2540: Cannot assign to 'middleInit' because it is a read-only property. @@ -26,7 +26,7 @@ tests/cases/conformance/jsdoc/validate.ts(17,3): error TS2540: Cannot assign to !!! error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. x.zipStr = 12; // should fail ~~~~~~~~ -!!! error TS2322: Type '12' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. x.middleInit = "R"; // should also fail ~~~~~~~~~~ !!! error TS2540: Cannot assign to 'middleInit' because it is a read-only property. diff --git a/tests/baselines/reference/classAbstractAssignabilityConstructorFunction.errors.txt b/tests/baselines/reference/classAbstractAssignabilityConstructorFunction.errors.txt index fbcc597409a21..c6c242396d8d8 100644 --- a/tests/baselines/reference/classAbstractAssignabilityConstructorFunction.errors.txt +++ b/tests/baselines/reference/classAbstractAssignabilityConstructorFunction.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts(7,1): error TS2322: Type 'typeof A' is not assignable to type 'new () => A'. Cannot assign an abstract constructor type to a non-abstract constructor type. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts(8,1): error TS2322: Type '"asdf"' is not assignable to type 'new () => A'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts(8,1): error TS2322: Type 'string' is not assignable to type 'new () => A'. ==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts (2 errors) ==== @@ -16,4 +16,4 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst !!! error TS2322: Cannot assign an abstract constructor type to a non-abstract constructor type. AAA = "asdf"; ~~~ -!!! error TS2322: Type '"asdf"' is not assignable to type 'new () => A'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'new () => A'. \ No newline at end of file diff --git a/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt b/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt index 02c5940be143e..1fd6c25a714e4 100644 --- a/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt +++ b/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/salsa/first.js(31,5): error TS2416: Property 'load' in t Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[]) => void'. tests/cases/conformance/salsa/first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. tests/cases/conformance/salsa/generic.js(19,19): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/salsa/generic.js(20,32): error TS2345: Argument of type '0' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'. +tests/cases/conformance/salsa/generic.js(20,32): error TS2345: Argument of type 'number' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'. tests/cases/conformance/salsa/second.ts(8,25): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. tests/cases/conformance/salsa/second.ts(14,7): error TS2417: Class static side 'typeof Conestoga' incorrectly extends base class static side 'typeof Wagon'. Types of property 'circle' are incompatible. @@ -11,7 +11,7 @@ tests/cases/conformance/salsa/second.ts(14,7): error TS2417: Class static side ' Types of parameters 'others' and 'wagons' are incompatible. Type 'Wagon[]' is not assignable to type '(typeof Wagon)[]'. Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'. -tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type '"nope"' is not assignable to parameter of type 'number'. +tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== tests/cases/conformance/salsa/first.js (3 errors) ==== @@ -102,7 +102,7 @@ tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type ' // error: wrong type super('nope'); ~~~~~~ -!!! error TS2345: Argument of type '"nope"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. } // should error since others is not optional static circle(others: (typeof Wagon)[]) { @@ -138,6 +138,6 @@ tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type ' !!! related TS6210 tests/cases/conformance/salsa/generic.js:5:15: An argument for 'flavour' was not provided. var errorArgType = new Chowder(0); ~ -!!! error TS2345: Argument of type '0' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'. \ No newline at end of file diff --git a/tests/baselines/reference/classMemberInitializerScoping.errors.txt b/tests/baselines/reference/classMemberInitializerScoping.errors.txt index d6625b3d1f8e9..dddc7a82a3f52 100644 --- a/tests/baselines/reference/classMemberInitializerScoping.errors.txt +++ b/tests/baselines/reference/classMemberInitializerScoping.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/classMemberInitializerScoping.ts(3,17): error TS2301: Initializer of instance member variable 'y' cannot reference identifier 'aaa' declared in the constructor. -tests/cases/compiler/classMemberInitializerScoping.ts(6,9): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/compiler/classMemberInitializerScoping.ts(6,9): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/classMemberInitializerScoping.ts (2 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/classMemberInitializerScoping.ts(6,9): error TS2322: Type ' constructor(aaa) { this.y = ''; // was: error, cannot assign string to number ~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } } diff --git a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt index 7ef791997dd32..6a7e077de4421 100644 --- a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt +++ b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(7,3): error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. - Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. + Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. - Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. + Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. @@ -16,7 +16,7 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type ' insideClass: FuncType = function(val) { // error span goes from here ~~~~~~~~~~~ !!! error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. -!!! error TS2322: Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. +!!! 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: @@ -37,7 +37,7 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type ' const outsideClass: FuncType = function(val) { // compare to errors only on this line in this case ~~~~~~~~~~~~ !!! error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. -!!! error TS2322: Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. +!!! 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: diff --git a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt index af63c18523d6a..4edd2a5a09be0 100644 --- a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt +++ b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt @@ -2,20 +2,20 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick | ChannelOfType, "type">'. Types of property 'type' are incompatible. Type 'T' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. - Type '"text" | "email"' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. - Type '"text"' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. - Type '"text"' is not assignable to type 'ChannelOfType["type"]'. + 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 '"text" | "email"' is not assignable to type 'ChannelOfType["type"]'. - Type '"text"' 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 'string' is not assignable to type 'ChannelOfType["type"]'. + Type 'string' is not assignable to type 'ChannelOfType["type"]'. + Type 'string' is not assignable to type 'T & "text"'. + Type 'string' is not assignable to type 'T'. + 'string' 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 '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 'string' is not assignable to type 'T & "text"'. + Type 'string' is not assignable to type 'T & "text"'. + Type 'string' is not assignable to type 'T'. + 'string' 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"'. @@ -60,20 +60,20 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t !!! error TS2322: Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick | ChannelOfType, "type">'. !!! error TS2322: Types of property 'type' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. -!!! error TS2322: Type '"text" | "email"' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. -!!! error TS2322: Type '"text"' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. -!!! error TS2322: Type '"text"' is not assignable to 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"] & 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 '"text" | "email"' is not assignable to type 'ChannelOfType["type"]'. -!!! error TS2322: Type '"text"' 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 'string' 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 'T & "text"'. +!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' 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 '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 'string' is not assignable to type 'T & "text"'. +!!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. +!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' 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"'. diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index f83761215e50a..16a81ba69c6fe 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -43,12 +43,12 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2 'ZeroOf' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. - Type '0' is not assignable to type 'T'. - '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. - Type '"" | 0' is not assignable to type 'T'. - '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. - Type '""' is not assignable to type 'T'. - '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + Type 'number' is not assignable to type 'T'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + Type 'string | number' is not assignable to type 'T'. + 'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf'. Type 'string | number' is not assignable to type 'ZeroOf'. Type 'string' is not assignable to type 'ZeroOf'. @@ -283,12 +283,12 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS !!! error TS2322: 'ZeroOf' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. !!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. -!!! error TS2322: Type '0' is not assignable to type 'T'. -!!! error TS2322: '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. -!!! error TS2322: Type '"" | 0' is not assignable to type 'T'. -!!! error TS2322: '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. -!!! error TS2322: Type '""' is not assignable to type 'T'. -!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: Type 'string | number' is not assignable to type 'T'. +!!! error TS2322: 'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. y = x; // Error ~ !!! error TS2322: Type 'T' is not assignable to type 'ZeroOf'. diff --git a/tests/baselines/reference/constEnumPropertyAccess2.errors.txt b/tests/baselines/reference/constEnumPropertyAccess2.errors.txt index c80283f65367e..7de386d886807 100644 --- a/tests/baselines/reference/constEnumPropertyAccess2.errors.txt +++ b/tests/baselines/reference/constEnumPropertyAccess2.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(13,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query. tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(14,12): error TS2476: A const enum member can only be accessed using a string literal. -tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(16,1): error TS2322: Type '"string"' is not assignable to type 'G'. +tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(16,1): error TS2322: Type 'string' is not assignable to type 'G'. tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(18,3): error TS2540: Cannot assign to 'B' because it is a read-only property. @@ -26,7 +26,7 @@ tests/cases/conformance/constEnums/constEnumPropertyAccess2.ts(18,3): error TS25 var g: G; g = "string"; ~ -!!! error TS2322: Type '"string"' is not assignable to type 'G'. +!!! error TS2322: Type 'string' is not assignable to type 'G'. function foo(x: G) { } G.B = 3; ~ diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt index 6d0f0037bc099..3d22f3fb320be 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type '1' is not assignable to type 'string'. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type '1' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type 'number' is not assignable to type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,27): error TS2322: Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(17,17): error TS2322: Type 'Date' is not assignable to type 'T'. @@ -12,7 +12,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co constructor(x); constructor(public x: string = 1) { // error ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var y = x; } } @@ -21,8 +21,8 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co constructor(x: T, y: U); constructor(x: T = 1, public y: U = x) { // error ~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'T'. -!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. ~~~~~~~~~~~~~~~ !!! 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'. diff --git a/tests/baselines/reference/constructorParameterShadowsOuterScopes.errors.txt b/tests/baselines/reference/constructorParameterShadowsOuterScopes.errors.txt index 978681dc5b376..87af1b85f2db7 100644 --- a/tests/baselines/reference/constructorParameterShadowsOuterScopes.errors.txt +++ b/tests/baselines/reference/constructorParameterShadowsOuterScopes.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(8,9): error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'x' declared in the constructor. -tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(10,9): error TS2322: Type '2' is not assignable to type 'string'. +tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(10,9): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterShadowsOuterScopes.ts(16,9): error TS2301: Initializer of instance member variable 'b' cannot reference identifier 'y' declared in the constructor. @@ -17,7 +17,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/constructorParameterS constructor(x: string) { x = 2; // error, x is string ~ -!!! error TS2322: Type '2' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. } } diff --git a/tests/baselines/reference/constructorReturnsInvalidType.errors.txt b/tests/baselines/reference/constructorReturnsInvalidType.errors.txt index faab8a5514511..e5871506863df 100644 --- a/tests/baselines/reference/constructorReturnsInvalidType.errors.txt +++ b/tests/baselines/reference/constructorReturnsInvalidType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2322: Type '1' is not assignable to type 'X'. +tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2322: Type 'number' is not assignable to type 'X'. tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. @@ -7,7 +7,7 @@ tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2409: Return constructor() { return 1; ~~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'X'. +!!! error TS2322: Type 'number' is not assignable to type 'X'. ~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } diff --git a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt index 40ab15c28a1af..893c7fe58e883 100644 --- a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt +++ b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2322: Type '1' is not assignable to type 'D'. +tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2322: Type 'number' is not assignable to type 'D'. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,18): error TS2322: Type 'number' is not assignable to type 'T'. @@ -19,7 +19,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl constructor() { return 1; // error ~~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'D'. +!!! error TS2322: Type 'number' is not assignable to type 'D'. ~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 07a11fafd3328..090d249f92327 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -42,7 +42,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(166,13): error T tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(180,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(181,13): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(183,13): error TS2322: Type 'boolean' is not assignable to type 'number'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(187,13): error TS2322: Type 'true' is not assignable to type 'number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(187,13): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(191,13): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(205,28): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(213,16): error TS2304: Cannot find name 'bool'. @@ -370,7 +370,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS i--;/*--*/ b = true && false || true;/*&& ||*/ ~ -!!! error TS2322: Type 'true' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. i = i << 5;/*<<*/ i = i >> 5;/*>>*/ var j = i; diff --git a/tests/baselines/reference/controlFlowArrayErrors.errors.txt b/tests/baselines/reference/controlFlowArrayErrors.errors.txt index 59ec0b44f5c93..91ff3032c6224 100644 --- a/tests/baselines/reference/controlFlowArrayErrors.errors.txt +++ b/tests/baselines/reference/controlFlowArrayErrors.errors.txt @@ -4,10 +4,10 @@ tests/cases/compiler/controlFlowArrayErrors.ts(11,9): error TS7034: Variable 'x' tests/cases/compiler/controlFlowArrayErrors.ts(13,13): error TS7005: Variable 'x' implicitly has an 'any[]' type. tests/cases/compiler/controlFlowArrayErrors.ts(19,9): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined. tests/cases/compiler/controlFlowArrayErrors.ts(22,9): error TS7005: Variable 'x' implicitly has an 'any[]' type. -tests/cases/compiler/controlFlowArrayErrors.ts(29,12): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. -tests/cases/compiler/controlFlowArrayErrors.ts(34,12): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. -tests/cases/compiler/controlFlowArrayErrors.ts(48,12): error TS2345: Argument of type '99' is not assignable to parameter of type 'never'. -tests/cases/compiler/controlFlowArrayErrors.ts(56,12): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/compiler/controlFlowArrayErrors.ts(29,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. +tests/cases/compiler/controlFlowArrayErrors.ts(34,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. +tests/cases/compiler/controlFlowArrayErrors.ts(48,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. +tests/cases/compiler/controlFlowArrayErrors.ts(56,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/compiler/controlFlowArrayErrors.ts(60,11): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined. tests/cases/compiler/controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x' implicitly has an 'any[]' type. @@ -55,14 +55,14 @@ tests/cases/compiler/controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x' x = [5, "hello"]; // Non-evolving array x.push(true); // Error ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. } function f5() { let x = [5, "hello"]; // Non-evolving array x.push(true); // Error ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. } function f6() { @@ -78,7 +78,7 @@ tests/cases/compiler/controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x' x; // boolean[] | (string | number)[] x.push(99); // Error ~~ -!!! error TS2345: Argument of type '99' is not assignable to parameter of type 'never'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. } function f7() { @@ -88,7 +88,7 @@ tests/cases/compiler/controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x' x.push("hello"); // Ok y.push("hello"); // Error ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. } function f8() { diff --git a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt index ef919a768ec6d..5f3501a5eea08 100644 --- a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt +++ b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt @@ -1,10 +1,10 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,5): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,19): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,19): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(5,1): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/compiler/defaultArgsInFunctionExpressions.ts(8,20): error TS2322: Type '3' is not assignable to type 'string'. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(8,20): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(14,51): error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -tests/cases/compiler/defaultArgsInFunctionExpressions.ts(17,41): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(17,41): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(20,62): error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: Cannot use namespace 'T' as a value. @@ -17,7 +17,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: C ~ !!! error TS2322: Type 'number' is not assignable to type 'string'. ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. s = f(); ~ !!! error TS2322: Type 'number' is not assignable to type 'string'. @@ -25,7 +25,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: C // Type check the default argument with the type annotation var f2 = function (a: string = 3) { return a; }; // Should error, but be of type (a: string) => string; ~~~~~~~~~~~~~ -!!! error TS2322: Type '3' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. s = f2(''); s = f2(); n = f2(); @@ -40,7 +40,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2708: C // Type check using the function's contextual type var f4: (a: number) => void = function (a = "") { }; ~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. // Contextually type the default arg using the function's contextual type var f5: (a: (s: string) => any) => void = function (a = s => s) { }; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt index e63849e4aa887..3e717a6d59a34 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt @@ -2,10 +2,10 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type '""' is not assignable to type 'T'. - '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type '""' is not assignable to type 'T'. - '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E' is not assignable to type 'C'. Types of property 'x' are incompatible. Type 'string' is not assignable to type 'number'. @@ -51,13 +51,13 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'T'. -!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. foo(): T { return ''; // error ~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'T'. -!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. } } diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index 6338e3d938c83..12beead1afb2a 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt @@ -11,10 +11,10 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(34,6): error TS2322: Type 'number' is not assignable to type '{ x: any; y: { j: any; }; }'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(35,4): error TS2345: Argument of type '{}' is not assignable to parameter of type '{ z: number; }'. Property 'z' is missing in type '{}' but required in type '{ z: number; }'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(36,6): error TS2322: Type 'true' is not assignable to type 'number'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(37,6): error TS2322: Type 'false' is not assignable to type 'number'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,6): error TS2322: Type 'true' is not assignable to type 'string | number'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(39,11): error TS2322: Type 'false' is not assignable to type '[[any]]'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(36,6): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(37,6): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,6): error TS2322: Type 'boolean' is not assignable to type 'string | number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(39,11): error TS2322: Type 'boolean' is not assignable to type '[[any]]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(40,13): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(46,13): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(47,13): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. @@ -91,18 +91,18 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( !!! related TS2728 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts:27:21: 'z' is declared here. c1({ z: true }); // Error, implied type is {z:number}? ~ -!!! error TS2322: Type 'true' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. !!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts:27:21: The expected type comes from property 'z' which is declared here on type '{ z: number; }' c2({ z: false }); // Error, implied type is {z?: number} ~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. c3({ b: true }); // Error, implied type is { b: number|string }. ~ -!!! error TS2322: Type 'true' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. !!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts:29:20: The expected type comes from property 'b' which is declared here on type '{ b: string | number; }' c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]] ~~~~~ -!!! error TS2322: Type 'false' is not assignable to type '[[any]]'. +!!! error TS2322: Type 'boolean' is not assignable to type '[[any]]'. c6([1, 2, [["string"]]]); // Error, implied type is [any, any, [[number]]] // Use initializer ~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'number'. diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index 1f7d1b48d604e..98a9ff93f7090 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(14,17): error TS1047: A rest parameter cannot be optional. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(15,16): error TS1048: A rest parameter cannot have an initializer. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(21,7): error TS2552: Cannot find name 'array2'. Did you mean 'Array'? tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(22,11): error TS2322: Type 'string' is not assignable to type '[[any]]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(23,4): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'. @@ -37,7 +37,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(1, 2, "hello", true); // Error, parameter type is (number|string)[] ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'? diff --git a/tests/baselines/reference/destructuringParameterProperties5.errors.txt b/tests/baselines/reference/destructuringParameterProperties5.errors.txt index 99ebab94fa247..c2e657b3b834d 100644 --- a/tests/baselines/reference/destructuringParameterProperties5.errors.txt +++ b/tests/baselines/reference/destructuringParameterProperties5.errors.txt @@ -10,7 +10,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7 tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,19): error TS2322: Type '{ x1: number; x2: string; x3: true; }' is not assignable to type 'ObjType1'. Object literal may only specify known properties, and 'x1' does not exist in type 'ObjType1'. tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,47): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,51): error TS2322: Type 'false' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,51): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,39): error TS2339: Property 'x1' does not exist on type 'C1'. tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,45): error TS2339: Property 'x2' does not exist on type 'C1'. tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,51): error TS2339: Property 'x3' does not exist on type 'C1'. @@ -54,7 +54,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(1 ~~ !!! error TS2322: Type 'string' is not assignable to type 'number'. ~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z]; ~~ !!! error TS2339: Property 'x1' does not exist on type 'C1'. diff --git a/tests/baselines/reference/destructuringVariableDeclaration2.errors.txt b/tests/baselines/reference/destructuringVariableDeclaration2.errors.txt index 2ea3149f2ed40..460a15c91932d 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringVariableDeclaration2.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,46): error TS2322: Type 'true' is not assignable to type 'number'. +tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,46): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,56): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,61): error TS2322: Type 'false' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,61): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(19,16): error TS2322: Type 'string' is not assignable to type 'number'. @@ -9,14 +9,14 @@ tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(1 // If the declaration includes a type annotation, T is that type. var {a1, a2}: { a1: number, a2: string } = { a1: true, a2: 1 } // Error ~~ -!!! error TS2322: Type 'true' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. !!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts:3:17: The expected type comes from property 'a1' which is declared here on type '{ a1: number; a2: string; }' ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. !!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts:3:29: The expected type comes from property 'a2' which is declared here on type '{ a1: number; a2: string; }' var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [[false]], true]; // Error ~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. // The type T associated with a destructuring variable declaration is determined as follows: // Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. diff --git a/tests/baselines/reference/enumAssignmentCompat.errors.txt b/tests/baselines/reference/enumAssignmentCompat.errors.txt index d0b8cb376c247..f1a01247146c0 100644 --- a/tests/baselines/reference/enumAssignmentCompat.errors.txt +++ b/tests/baselines/reference/enumAssignmentCompat.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/enumAssignmentCompat.ts(26,5): error TS2322: Type 'typeof W' is not assignable to type 'number'. -tests/cases/compiler/enumAssignmentCompat.ts(28,5): error TS2322: Type 'W.a' is not assignable to type 'typeof W'. -tests/cases/compiler/enumAssignmentCompat.ts(30,5): error TS2322: Type '3' is not assignable to type 'typeof W'. -tests/cases/compiler/enumAssignmentCompat.ts(32,5): error TS2322: Type 'W.a' is not assignable to type 'WStatic'. -tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type '5' is not assignable to type 'WStatic'. +tests/cases/compiler/enumAssignmentCompat.ts(28,5): error TS2322: Type 'W' is not assignable to type 'typeof W'. +tests/cases/compiler/enumAssignmentCompat.ts(30,5): error TS2322: Type 'number' is not assignable to type 'typeof W'. +tests/cases/compiler/enumAssignmentCompat.ts(32,5): error TS2322: Type 'W' is not assignable to type 'WStatic'. +tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type 'number' is not assignable to type 'WStatic'. ==== tests/cases/compiler/enumAssignmentCompat.ts (5 errors) ==== @@ -37,18 +37,18 @@ tests/cases/compiler/enumAssignmentCompat.ts(33,5): error TS2322: Type '5' is no var a: number = W.a; var b: typeof W = W.a; // error ~ -!!! error TS2322: Type 'W.a' is not assignable to type 'typeof W'. +!!! error TS2322: Type 'W' is not assignable to type 'typeof W'. var c: typeof W.a = W.a; var d: typeof W = 3; // error ~ -!!! error TS2322: Type '3' is not assignable to type 'typeof W'. +!!! error TS2322: Type 'number' is not assignable to type 'typeof W'. var e: typeof W.a = 4; var f: WStatic = W.a; // error ~ -!!! error TS2322: Type 'W.a' is not assignable to type 'WStatic'. +!!! error TS2322: Type 'W' is not assignable to type 'WStatic'. var g: WStatic = 5; // error ~ -!!! error TS2322: Type '5' is not assignable to type 'WStatic'. +!!! error TS2322: Type 'number' is not assignable to type 'WStatic'. var h: W = 3; var i: W = W.a; i = W.a; diff --git a/tests/baselines/reference/enumAssignmentCompat2.errors.txt b/tests/baselines/reference/enumAssignmentCompat2.errors.txt index 065cd35133d17..4e0660eaae3b5 100644 --- a/tests/baselines/reference/enumAssignmentCompat2.errors.txt +++ b/tests/baselines/reference/enumAssignmentCompat2.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/enumAssignmentCompat2.ts(25,5): error TS2322: Type 'typeof W' is not assignable to type 'number'. -tests/cases/compiler/enumAssignmentCompat2.ts(27,5): error TS2322: Type 'W.a' is not assignable to type 'typeof W'. -tests/cases/compiler/enumAssignmentCompat2.ts(29,5): error TS2322: Type '3' is not assignable to type 'typeof W'. -tests/cases/compiler/enumAssignmentCompat2.ts(31,5): error TS2322: Type 'W.a' is not assignable to type 'WStatic'. -tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type '5' is not assignable to type 'WStatic'. +tests/cases/compiler/enumAssignmentCompat2.ts(27,5): error TS2322: Type 'W' is not assignable to type 'typeof W'. +tests/cases/compiler/enumAssignmentCompat2.ts(29,5): error TS2322: Type 'number' is not assignable to type 'typeof W'. +tests/cases/compiler/enumAssignmentCompat2.ts(31,5): error TS2322: Type 'W' is not assignable to type 'WStatic'. +tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type 'number' is not assignable to type 'WStatic'. ==== tests/cases/compiler/enumAssignmentCompat2.ts (5 errors) ==== @@ -36,18 +36,18 @@ tests/cases/compiler/enumAssignmentCompat2.ts(32,5): error TS2322: Type '5' is n var a: number = W.a; var b: typeof W = W.a; // error ~ -!!! error TS2322: Type 'W.a' is not assignable to type 'typeof W'. +!!! error TS2322: Type 'W' is not assignable to type 'typeof W'. var c: typeof W.a = W.a; var d: typeof W = 3; // error ~ -!!! error TS2322: Type '3' is not assignable to type 'typeof W'. +!!! error TS2322: Type 'number' is not assignable to type 'typeof W'. var e: typeof W.a = 4; var f: WStatic = W.a; // error ~ -!!! error TS2322: Type 'W.a' is not assignable to type 'WStatic'. +!!! error TS2322: Type 'W' is not assignable to type 'WStatic'. var g: WStatic = 5; // error ~ -!!! error TS2322: Type '5' is not assignable to type 'WStatic'. +!!! error TS2322: Type 'number' is not assignable to type 'WStatic'. var h: W = 3; var i: W = W.a; i = W.a; diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt index f552bb35ca480..e5c9a4e068d23 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2322: Type '"this is a string"' is not assignable to type 'number'. -tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2322: Type '9.9' is not assignable to type 'string'. -tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type '9.9' is not assignable to type 'Date'. -tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(38,5): error TS2322: Type '9.9' is not assignable to type 'void'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type 'number' is not assignable to type 'Date'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(38,5): error TS2322: Type 'number' is not assignable to type 'void'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(40,5): error TS2741: Property 'id' is missing in type 'D' but required in type 'I'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(41,5): error TS2741: Property 'id' is missing in type 'D' but required in type 'C'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(42,5): error TS2739: Type 'C' is missing the following properties from type 'D': source, recurse, wrapped @@ -60,17 +60,17 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd var aNumber: number = 'this is a string'; ~~~~~~~ -!!! error TS2322: Type '"this is a string"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var aString: string = 9.9; ~~~~~~~ -!!! error TS2322: Type '9.9' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var aDate: Date = 9.9; ~~~~~ -!!! error TS2322: Type '9.9' is not assignable to type 'Date'. +!!! error TS2322: Type 'number' is not assignable to type 'Date'. var aVoid: void = 9.9; ~~~~~ -!!! error TS2322: Type '9.9' is not assignable to type 'void'. +!!! error TS2322: Type 'number' is not assignable to type 'void'. var anInterface: I = new D(); ~~~~~~~~~~~ diff --git a/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt b/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt index 5ba27334f5ea8..cf63c48925fde 100644 --- a/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt +++ b/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument of type 'true' is not assignable to parameter of type '{ a: string; b: number; }'. +tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'. ==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ==== import foo = require("./foo_0"); var x = new foo(true); // Should error ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type '{ a: string; b: number; }'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'. var y = new foo({a: "test", b: 42}); // Should be OK var z: number = y.test.b; ==== tests/cases/conformance/externalModules/foo_0.ts (0 errors) ==== diff --git a/tests/baselines/reference/extractInferenceImprovement.errors.txt b/tests/baselines/reference/extractInferenceImprovement.errors.txt index 74b2f61451505..11eda2a281c45 100644 --- a/tests/baselines/reference/extractInferenceImprovement.errors.txt +++ b/tests/baselines/reference/extractInferenceImprovement.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/extractInferenceImprovement.ts(26,26): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'never'. +tests/cases/compiler/extractInferenceImprovement.ts(26,26): error TS2345: Argument of type 'typeof s' is not assignable to parameter of type 'never'. tests/cases/compiler/extractInferenceImprovement.ts(28,1): error TS2322: Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/compiler/extractInferenceImprovement.ts(28,26): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type '"first" | "second"'. @@ -32,7 +32,7 @@ tests/cases/compiler/extractInferenceImprovement.ts(28,26): error TS2345: Argume // Should fail prop = getProperty2(obj, s); ~ -!!! error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'never'. +!!! error TS2345: Argument of type 'typeof s' is not assignable to parameter of type 'never'. prop = getProperty3(obj, s); ~~~~ diff --git a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt index aa163edc32ec1..74928b83034e0 100644 --- a/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt +++ b/tests/baselines/reference/fixTypeParameterInSignatureWithRestParameters.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,8): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts(2,8): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== tests/cases/compiler/fixTypeParameterInSignatureWithRestParameters.ts (1 errors) ==== function bar(item1: T, item2: T) { } bar(1, ""); // Should be ok ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. \ No newline at end of file +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of46.errors.txt b/tests/baselines/reference/for-of46.errors.txt index c2a47bffdf656..ad9304026a6d7 100644 --- a/tests/baselines/reference/for-of46.errors.txt +++ b/tests/baselines/reference/for-of46.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/for-ofStatements/for-of46.ts(3,7): error TS2322: Type 'false' is not assignable to type 'string'. +tests/cases/conformance/es6/for-ofStatements/for-of46.ts(3,7): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/for-ofStatements/for-of46.ts(3,18): error TS2322: Type '""' is not assignable to type 'boolean'. @@ -7,7 +7,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of46.ts(3,18): error TS2322: Ty var map = new Map([["", true]]); for ([k = false, v = ""] of map) { ~ -!!! error TS2322: Type 'false' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. ~ !!! error TS2322: Type '""' is not assignable to type 'boolean'. k; diff --git a/tests/baselines/reference/functionAssignment.errors.txt b/tests/baselines/reference/functionAssignment.errors.txt index 292c2804431b5..19fd0897f9823 100644 --- a/tests/baselines/reference/functionAssignment.errors.txt +++ b/tests/baselines/reference/functionAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/functionAssignment.ts(22,5): error TS2322: Type '4' is not assignable to type 'string'. +tests/cases/compiler/functionAssignment.ts(22,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/functionAssignment.ts(34,17): error TS2339: Property 'length' does not exist on type 'number'. @@ -26,7 +26,7 @@ tests/cases/compiler/functionAssignment.ts(34,17): error TS2339: Property 'lengt var n = ''; n = 4; ~ -!!! error TS2322: Type '4' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. }); function f3(a: { a: number; b: number; }) { } diff --git a/tests/baselines/reference/functionCall10.errors.txt b/tests/baselines/reference/functionCall10.errors.txt index 7891b7008cb4e..8352fc70a58de 100644 --- a/tests/baselines/reference/functionCall10.errors.txt +++ b/tests/baselines/reference/functionCall10.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/functionCall10.ts(3,5): error TS2345: Argument of type '"foo"' is not assignable to parameter of type 'number'. -tests/cases/compiler/functionCall10.ts(5,8): error TS2345: Argument of type '"bar"' is not assignable to parameter of type 'number'. +tests/cases/compiler/functionCall10.ts(3,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/compiler/functionCall10.ts(5,8): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== tests/cases/compiler/functionCall10.ts (2 errors) ==== @@ -7,9 +7,9 @@ tests/cases/compiler/functionCall10.ts(5,8): error TS2345: Argument of type '"ba foo(0, 1); foo('foo'); ~~~~~ -!!! error TS2345: Argument of type '"foo"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. foo(); foo(1, 'bar'); ~~~~~ -!!! error TS2345: Argument of type '"bar"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall11.errors.txt b/tests/baselines/reference/functionCall11.errors.txt index 4fb06f831570a..a473600f69f49 100644 --- a/tests/baselines/reference/functionCall11.errors.txt +++ b/tests/baselines/reference/functionCall11.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/functionCall11.ts(4,1): error TS2554: Expected 1-2 arguments, but got 0. -tests/cases/compiler/functionCall11.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall11.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/functionCall11.ts(6,15): error TS2554: Expected 1-2 arguments, but got 3. @@ -13,7 +13,7 @@ tests/cases/compiler/functionCall11.ts(6,15): error TS2554: Expected 1-2 argumen !!! related TS6210 tests/cases/compiler/functionCall11.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 1, 'bar'); ~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 3. diff --git a/tests/baselines/reference/functionCall12.errors.txt b/tests/baselines/reference/functionCall12.errors.txt index 8b6c02b480499..02591a05c82fb 100644 --- a/tests/baselines/reference/functionCall12.errors.txt +++ b/tests/baselines/reference/functionCall12.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/functionCall12.ts(4,1): error TS2554: Expected 1-3 arguments, but got 0. -tests/cases/compiler/functionCall12.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. -tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall12.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/functionCall12.ts (3 errors) ==== @@ -13,9 +13,9 @@ tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type '3' !!! related TS6210 tests/cases/compiler/functionCall12.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 1, 'bar'); foo('foo', 1, 3); ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall13.errors.txt b/tests/baselines/reference/functionCall13.errors.txt index 8e7b5ecc97aa6..5d5ef742c5eaa 100644 --- a/tests/baselines/reference/functionCall13.errors.txt +++ b/tests/baselines/reference/functionCall13.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/functionCall13.ts(4,1): error TS2555: Expected at least 1 arguments, but got 0. -tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/functionCall13.ts (2 errors) ==== @@ -12,6 +12,6 @@ tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type '1' !!! related TS6210 tests/cases/compiler/functionCall13.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 1, 3); \ No newline at end of file diff --git a/tests/baselines/reference/functionCall14.errors.txt b/tests/baselines/reference/functionCall14.errors.txt index 2de62978c8481..3b671d0252bd6 100644 --- a/tests/baselines/reference/functionCall14.errors.txt +++ b/tests/baselines/reference/functionCall14.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/functionCall14.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall14.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/functionCall14.ts (1 errors) ==== @@ -8,6 +8,6 @@ tests/cases/compiler/functionCall14.ts(5,5): error TS2345: Argument of type '1' foo(); foo(1, 'bar'); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 1, 3); \ No newline at end of file diff --git a/tests/baselines/reference/functionCall16.errors.txt b/tests/baselines/reference/functionCall16.errors.txt index 220e2017b67d2..70d1a9125668a 100644 --- a/tests/baselines/reference/functionCall16.errors.txt +++ b/tests/baselines/reference/functionCall16.errors.txt @@ -1,13 +1,13 @@ -tests/cases/compiler/functionCall16.ts(2,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall16.ts(2,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/functionCall16.ts(5,1): error TS2555: Expected at least 1 arguments, but got 0. -tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/functionCall16.ts (3 errors) ==== function foo(a:string, b?:string, ...c:number[]){} foo('foo', 1); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo'); foo('foo', 'bar'); foo(); @@ -16,6 +16,6 @@ tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type '1' !!! related TS6210 tests/cases/compiler/functionCall16.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 'bar', 3); \ No newline at end of file diff --git a/tests/baselines/reference/functionCall17.errors.txt b/tests/baselines/reference/functionCall17.errors.txt index 5d1bfe98edd92..0e1d561e54967 100644 --- a/tests/baselines/reference/functionCall17.errors.txt +++ b/tests/baselines/reference/functionCall17.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/functionCall17.ts(2,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall17.ts(2,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/functionCall17.ts(4,1): error TS2555: Expected at least 1 arguments, but got 0. -tests/cases/compiler/functionCall17.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. -tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall17.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/functionCall17.ts (4 errors) ==== function foo(a:string, b?:string, c?:number, ...d:number[]){} foo('foo', 1); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo'); foo(); ~~~~~ @@ -16,9 +16,9 @@ tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type '1' !!! related TS6210 tests/cases/compiler/functionCall17.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 1, 3); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 'bar', 3, 4); \ No newline at end of file diff --git a/tests/baselines/reference/functionCall6.errors.txt b/tests/baselines/reference/functionCall6.errors.txt index af3d4a0be22d5..54ad3cb761a99 100644 --- a/tests/baselines/reference/functionCall6.errors.txt +++ b/tests/baselines/reference/functionCall6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/functionCall6.ts(3,5): error TS2345: Argument of type '2' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall6.ts(3,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/functionCall6.ts(4,12): error TS2554: Expected 1 arguments, but got 2. tests/cases/compiler/functionCall6.ts(5,1): error TS2554: Expected 1 arguments, but got 0. @@ -8,7 +8,7 @@ tests/cases/compiler/functionCall6.ts(5,1): error TS2554: Expected 1 arguments, foo('bar'); foo(2); ~ -!!! error TS2345: Argument of type '2' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo('foo', 'bar'); ~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. diff --git a/tests/baselines/reference/functionCall7.errors.txt b/tests/baselines/reference/functionCall7.errors.txt index 53a3c575ec314..09d09f830d52c 100644 --- a/tests/baselines/reference/functionCall7.errors.txt +++ b/tests/baselines/reference/functionCall7.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/functionCall7.ts(5,10): error TS2554: Expected 1 arguments, but got 2. -tests/cases/compiler/functionCall7.ts(6,5): error TS2345: Argument of type '4' is not assignable to parameter of type 'c1'. +tests/cases/compiler/functionCall7.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'. tests/cases/compiler/functionCall7.ts(7,1): error TS2554: Expected 1 arguments, but got 0. @@ -13,7 +13,7 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2554: Expected 1 arguments, !!! error TS2554: Expected 1 arguments, but got 2. foo(4); ~ -!!! error TS2345: Argument of type '4' is not assignable to parameter of type 'c1'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'. foo(); ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. diff --git a/tests/baselines/reference/functionCall8.errors.txt b/tests/baselines/reference/functionCall8.errors.txt index bb65e243bc1e4..b9e213b600bdb 100644 --- a/tests/baselines/reference/functionCall8.errors.txt +++ b/tests/baselines/reference/functionCall8.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/functionCall8.ts(3,12): error TS2554: Expected 0-1 arguments, but got 2. -tests/cases/compiler/functionCall8.ts(4,5): error TS2345: Argument of type '4' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionCall8.ts(4,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/functionCall8.ts (2 errors) ==== @@ -10,6 +10,6 @@ tests/cases/compiler/functionCall8.ts(4,5): error TS2345: Argument of type '4' i !!! error TS2554: Expected 0-1 arguments, but got 2. foo(4); ~ -!!! error TS2345: Argument of type '4' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. foo(); \ No newline at end of file diff --git a/tests/baselines/reference/functionCall9.errors.txt b/tests/baselines/reference/functionCall9.errors.txt index 3a747cb686c9f..f0c7002f3da7b 100644 --- a/tests/baselines/reference/functionCall9.errors.txt +++ b/tests/baselines/reference/functionCall9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/functionCall9.ts(4,11): error TS2345: Argument of type '"bar"' is not assignable to parameter of type 'number'. +tests/cases/compiler/functionCall9.ts(4,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/compiler/functionCall9.ts(5,15): error TS2554: Expected 0-2 arguments, but got 3. @@ -8,7 +8,7 @@ tests/cases/compiler/functionCall9.ts(5,15): error TS2554: Expected 0-2 argument foo('foo'); foo('foo','bar'); ~~~~~ -!!! error TS2345: Argument of type '"bar"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. foo('foo', 1, 'bar'); ~~~~~ !!! error TS2554: Expected 0-2 arguments, but got 3. diff --git a/tests/baselines/reference/functionCallOnConstrainedTypeVariable.errors.txt b/tests/baselines/reference/functionCallOnConstrainedTypeVariable.errors.txt index a81b13f5c6305..140671c9b504c 100644 --- a/tests/baselines/reference/functionCallOnConstrainedTypeVariable.errors.txt +++ b/tests/baselines/reference/functionCallOnConstrainedTypeVariable.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(11,7): error TS2345: Argument of type '"s"' is not assignable to parameter of type 'never'. -tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(15,7): error TS2345: Argument of type '"s"' is not assignable to parameter of type 'never'. -tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(18,5): error TS2345: Argument of type '""' is not assignable to parameter of type 'never'. +tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(11,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. +tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(15,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. +tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(18,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(19,9): error TS2554: Expected 1 arguments, but got 4. @@ -17,18 +17,18 @@ tests/cases/compiler/functionCallOnConstrainedTypeVariable.ts(19,9): error TS255 function call0(p: A | B) { p.a("s"); // Error ~~~ -!!! error TS2345: Argument of type '"s"' is not assignable to parameter of type 'never'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. } function callN(p: T) { p.a("s"); // Error ~~~ -!!! error TS2345: Argument of type '"s"' is not assignable to parameter of type 'never'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. var a: T["a"] = p.a; a(""); // Error ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'never'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. a("", "", "", ""); // Error ~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 4. diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt index ded464661859f..3914831c26b84 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt +++ b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(5,5): error TS2345: Argument of type '1' is not assignable to parameter of type 'Function'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,16): error TS2554: Expected 1 arguments, but got 2. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,8): error TS2554: Expected 1 arguments, but got 2. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'. @@ -31,7 +31,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain foo(1); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'Function'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'. foo(() => { }, 1); ~ !!! error TS2554: Expected 1 arguments, but got 2. diff --git a/tests/baselines/reference/functionOverloads.errors.txt b/tests/baselines/reference/functionOverloads.errors.txt index 5530f8133846e..bd3bab3388b05 100644 --- a/tests/baselines/reference/functionOverloads.errors.txt +++ b/tests/baselines/reference/functionOverloads.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/functionOverloads.ts(4,13): error TS2345: Argument of type '5' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionOverloads.ts(4,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/functionOverloads.ts (1 errors) ==== @@ -7,4 +7,4 @@ tests/cases/compiler/functionOverloads.ts(4,13): error TS2345: Argument of type function foo(bar?: string): any { return "" }; var x = foo(5); ~ -!!! error TS2345: Argument of type '5' is not assignable to parameter of type 'string'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads2.errors.txt b/tests/baselines/reference/functionOverloads2.errors.txt index 93afc96bfd11f..86bcfc396415a 100644 --- a/tests/baselines/reference/functionOverloads2.errors.txt +++ b/tests/baselines/reference/functionOverloads2.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/functionOverloads2.ts(4,13): error TS2769: No overload matches this call. Overload 1 of 2, '(bar: string): string', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. Overload 2 of 2, '(bar: number): number', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. ==== tests/cases/compiler/functionOverloads2.ts (1 errors) ==== @@ -13,6 +13,6 @@ tests/cases/compiler/functionOverloads2.ts(4,13): error TS2769: No overload matc ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(bar: string): string', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 2, '(bar: number): number', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. \ No newline at end of file +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads27.errors.txt b/tests/baselines/reference/functionOverloads27.errors.txt index 2b21de7134b44..a5d16935f2fbc 100644 --- a/tests/baselines/reference/functionOverloads27.errors.txt +++ b/tests/baselines/reference/functionOverloads27.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/functionOverloads27.ts(4,13): error TS2345: Argument of type '5' is not assignable to parameter of type 'string'. +tests/cases/compiler/functionOverloads27.ts(4,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/functionOverloads27.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/compiler/functionOverloads27.ts(4,13): error TS2345: Argument of typ function foo(bar?:any):any{ return '' } var x = foo(5); ~ -!!! error TS2345: Argument of type '5' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/generatorExplicitReturnType.errors.txt b/tests/baselines/reference/generatorExplicitReturnType.errors.txt index 4841e62bba7df..558ccf56bfd7d 100644 --- a/tests/baselines/reference/generatorExplicitReturnType.errors.txt +++ b/tests/baselines/reference/generatorExplicitReturnType.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/generators/generatorExplicitReturnType.ts(2,5): error TS2322: Type 'undefined' is not assignable to type 'number'. -tests/cases/conformance/generators/generatorExplicitReturnType.ts(3,11): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/generators/generatorExplicitReturnType.ts(3,11): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/generators/generatorExplicitReturnType.ts(4,11): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/generators/generatorExplicitReturnType.ts(5,5): error TS2322: Type '10' is not assignable to type 'boolean'. tests/cases/conformance/generators/generatorExplicitReturnType.ts(16,11): error TS2322: Type 'symbol' is not assignable to type 'number'. @@ -12,7 +12,7 @@ tests/cases/conformance/generators/generatorExplicitReturnType.ts(16,11): error !!! error TS2322: Type 'undefined' is not assignable to type 'number'. yield "a"; // error ~~~ -!!! error TS2322: Type '"a"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. const x: number = yield 1; // error ~ !!! error TS2322: Type 'string' is not assignable to type 'number'. diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt index 6982031c9bab2..805bde82b640c 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(11,26): error TS2345: Argument of type '1' is not assignable to parameter of type 'Date'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(11,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts (1 errors) ==== @@ -14,5 +14,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon var r3 = foo(new Object()); // {} var r4 = foo(1); // error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'Date'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'. var r5 = foo(new Date()); // no error \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt index 5dad15dd775e8..aef8a5ad372f5 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -2,16 +2,16 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun Type 'string' is not assignable to type '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + Type 'number' is not assignable to type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + Type 'number' is not assignable to type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,24): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + Type 'number' is not assignable to type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,23): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -53,22 +53,22 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r10 = foo2(1, (x) => ''); // string var r11 = foo3(1, (x: T) => '', ''); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r11b = foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r12 = foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ !!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt index a46ee6c0f8e48..1db393afbf39e 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(29,18): error TS2345: Argument of type 'I2' is not assignable to parameter of type 'new (a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts(40,18): error TS2345: Argument of type 'I2' is not assignable to parameter of type 'new (a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments2.ts (2 errors) ==== @@ -39,7 +39,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun ~~ !!! error TS2345: Argument of type 'I2' is not assignable to parameter of type 'new (a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'string'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. var r4b = foo2(1, a); // any var r5 = foo2(1, i); // any var r6 = foo2('', i2); // string @@ -54,5 +54,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun ~~ !!! error TS2345: Argument of type 'I2' is not assignable to parameter of type 'new (a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'string'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. var r9 = foo3('', i2, ''); // string \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index e179f079011e8..08330d4a5867e 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -3,8 +3,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. Type 'Date' is not assignable to type 'T'. @@ -12,8 +12,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,43): error TS2322: Type 'F' is not assignable to type 'E'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. Type 'Date' is not assignable to type 'T'. @@ -47,8 +47,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen !!! error TS2345: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. var r10 = r7(1); // error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. } function foo2(a: (x: T) => T, b: (x: T) => T) { @@ -96,8 +96,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen !!! error TS2345: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. var r10 = r7(1); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. } function foo2(a: (x: T) => T, b: (x: U) => U) { diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt index 9e22e42299c89..545a8b47a7981 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type '1' is not assignable to type 'T'. - '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type 'number' is not assignable to type 'T'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(6,37): error TS2322: Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(8,56): error TS2322: Type 'U' is not assignable to type 'V'. @@ -15,8 +15,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC function foo2(x: T = undefined) { return x; } // ok function foo3(x: T = 1) { } // error ~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'T'. -!!! error TS2322: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. +!!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. function foo4(x: T, y: U = x) { } // error ~~~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'U'. diff --git a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt index c8a67a59d2140..25915c23a88b7 100644 --- a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt +++ b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,16): error TS2558: Expected 0 type arguments, but got 1. -tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,17): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(9,17): error TS2558: Expected 0 type arguments, but got 1. @@ -17,8 +17,8 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17 !!! error TS2558: Expected 0 type arguments, but got 1. var r2 = f(1); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r3 = f(null); ~~~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt index b11f0fcfddb2e..440c8d113cb8d 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,15 +1,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,29): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + Type 'number' is not assignable to type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,30): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + Type 'number' is not assignable to type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,31): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + Type 'number' is not assignable to type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -75,22 +75,22 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r10 = c.foo2(1, (x) => ''); // string var r11 = c3.foo3(1, (x: T) => '', ''); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r11b = c3.foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r12 = c3.foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ !!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index 0ab22dcea1452..ac765d8d7c1da 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(6,39): error TS2344: Type 'number' 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/compiler/genericDefaultsErrors.ts(10,5): error TS2558: Expected 2-3 type arguments, but got 1. tests/cases/compiler/genericDefaultsErrors.ts(13,5): error TS2558: Expected 2-3 type arguments, but got 4. -tests/cases/compiler/genericDefaultsErrors.ts(17,13): error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(17,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/compiler/genericDefaultsErrors.ts(19,11): error TS2428: All declarations of 'i00' must have identical type parameters. tests/cases/compiler/genericDefaultsErrors.ts(20,11): error TS2428: All declarations of 'i00' must have identical type parameters. tests/cases/compiler/genericDefaultsErrors.ts(22,11): error TS2428: All declarations of 'i01' must have identical type parameters. @@ -59,7 +59,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,29): error TS2716: Type paramet f12(); // ok f12("a"); // error ~~~ -!!! error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. interface i00 { } // ok ~~~ diff --git a/tests/baselines/reference/genericNewInterface.errors.txt b/tests/baselines/reference/genericNewInterface.errors.txt index 7754d5749fda4..f489b72c1b691 100644 --- a/tests/baselines/reference/genericNewInterface.errors.txt +++ b/tests/baselines/reference/genericNewInterface.errors.txt @@ -1,12 +1,12 @@ -tests/cases/compiler/genericNewInterface.ts(2,21): error TS2345: Argument of type '42' is not assignable to parameter of type 'string'. -tests/cases/compiler/genericNewInterface.ts(10,21): error TS2345: Argument of type '1024' is not assignable to parameter of type 'string'. +tests/cases/compiler/genericNewInterface.ts(2,21): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/genericNewInterface.ts(10,21): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/genericNewInterface.ts (2 errors) ==== function createInstance(ctor: new (s: string) => T): T { return new ctor(42); //should be an error ~~ -!!! error TS2345: Argument of type '42' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. } interface INewable { @@ -16,5 +16,5 @@ tests/cases/compiler/genericNewInterface.ts(10,21): error TS2345: Argument of ty function createInstance2(ctor: INewable): T { return new ctor(1024); //should be an error ~~~~ -!!! error TS2345: Argument of type '1024' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericRestArgs.errors.txt b/tests/baselines/reference/genericRestArgs.errors.txt index 3c75cf392a549..7263869779857 100644 --- a/tests/baselines/reference/genericRestArgs.errors.txt +++ b/tests/baselines/reference/genericRestArgs.errors.txt @@ -1,27 +1,27 @@ -tests/cases/compiler/genericRestArgs.ts(2,26): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. -tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. -tests/cases/compiler/genericRestArgs.ts(10,29): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. -tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type '1' is not assignable to parameter of type 'any[]'. +tests/cases/compiler/genericRestArgs.ts(2,26): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/compiler/genericRestArgs.ts(10,29): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. ==== tests/cases/compiler/genericRestArgs.ts (4 errors) ==== function makeArrayG(...items: T[]): T[] { return items; } var a1Ga = makeArrayG(1, ""); // no error ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. var a1Gb = makeArrayG(1, ""); var a1Gc = makeArrayG(1, ""); var a1Gd = makeArrayG(1, ""); // error ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. function makeArrayGOpt(item1?: T, item2?: T, item3?: T) { return [item1, item2, item3]; } var a2Ga = makeArrayGOpt(1, ""); ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. var a2Gb = makeArrayG(1, ""); var a2Gc = makeArrayG(1, ""); // error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'any[]'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. \ No newline at end of file diff --git a/tests/baselines/reference/genericRestParameters3.errors.txt b/tests/baselines/reference/genericRestParameters3.errors.txt index 9e3e9d97de42d..df6577cb939ea 100644 --- a/tests/baselines/reference/genericRestParameters3.errors.txt +++ b/tests/baselines/reference/genericRestParameters3.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(17,11): error TS2345: Argument of type '[10]' is not assignable to parameter of type '[string] | [number, boolean]'. Type '[10]' is not assignable to type '[string]'. - Type '10' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/rest/genericRestParameters3.ts(18,1): error TS2345: Argument of type '[]' is not assignable to parameter of type '[string] | [number, boolean]'. Type '[]' is missing the following properties from type '[number, boolean]': 0, 1 tests/cases/conformance/types/rest/genericRestParameters3.ts(22,1): error TS2322: Type '(x: string, ...args: [string] | [number, boolean]) => void' is not assignable to type '(...args: [string, string] | [string, number, boolean]) => void'. @@ -16,7 +16,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(24,1): error TS2322 Property '1' is missing in type '[string]' but required in type '[number, boolean]'. tests/cases/conformance/types/rest/genericRestParameters3.ts(25,1): error TS2322: Type '(...args: [string, string] | [string, number, boolean]) => void' is not assignable to type '(x: string, ...args: [string] | [number, boolean]) => void'. tests/cases/conformance/types/rest/genericRestParameters3.ts(35,1): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/types/rest/genericRestParameters3.ts(36,21): error TS2345: Argument of type '100' is not assignable to parameter of type '(...args: CoolArray) => void'. +tests/cases/conformance/types/rest/genericRestParameters3.ts(36,21): error TS2345: Argument of type 'number' is not assignable to parameter of type '(...args: CoolArray) => void'. tests/cases/conformance/types/rest/genericRestParameters3.ts(37,21): error TS2345: Argument of type '(cb: (...args: T) => void) => void' is not assignable to parameter of type '(...args: CoolArray) => void'. Types of parameters 'cb' and 'args' are incompatible. Property '0' is missing in type 'CoolArray' but required in type '[(...args: any[]) => void]'. @@ -55,7 +55,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(59,5): error TS2345 ~~ !!! error TS2345: Argument of type '[10]' is not assignable to parameter of type '[string] | [number, boolean]'. !!! error TS2345: Type '[10]' is not assignable to type '[string]'. -!!! error TS2345: Type '10' is not assignable to type 'string'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. f1("foo"); // Error ~~~~~~~~~ !!! error TS2345: Argument of type '[]' is not assignable to parameter of type '[string] | [number, boolean]'. @@ -98,7 +98,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(59,5): error TS2345 !!! related TS6210 tests/cases/conformance/types/rest/genericRestParameters3.ts:33:39: An argument for 'cb' was not provided. foo>(100); // Error ~~~ -!!! error TS2345: Argument of type '100' is not assignable to parameter of type '(...args: CoolArray) => void'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '(...args: CoolArray) => void'. foo>(foo); // Error ~~~ !!! error TS2345: Argument of type '(cb: (...args: T) => void) => void' is not assignable to parameter of type '(...args: CoolArray) => void'. diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt index c824b71b534e2..f348a0fb97434 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,41): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expected 0 type arguments, but got 1. @@ -13,8 +13,8 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expe x.foo(1); // no error var f = (x: B) => { return x.foo(1); } // error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var f2 = (x: B) => { return x.foo(1); } // error ~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/getSetAccessorContextualTyping.errors.txt b/tests/baselines/reference/getSetAccessorContextualTyping.errors.txt index dc77d530e017a..6b9bc309b4578 100644 --- a/tests/baselines/reference/getSetAccessorContextualTyping.errors.txt +++ b/tests/baselines/reference/getSetAccessorContextualTyping.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyping.ts(8,9): error TS2322: Type '"string"' is not assignable to type 'number'. +tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyping.ts(8,9): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyping.ts (1 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyp get X() { return "string"; // Error; get contextual type by set accessor parameter type annotation ~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '"string"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } set Y(y) { } diff --git a/tests/baselines/reference/globalMergeWithCommonJSAssignmentDeclaration.errors.txt b/tests/baselines/reference/globalMergeWithCommonJSAssignmentDeclaration.errors.txt index bc67e012a8618..7504ac14fd628 100644 --- a/tests/baselines/reference/globalMergeWithCommonJSAssignmentDeclaration.errors.txt +++ b/tests/baselines/reference/globalMergeWithCommonJSAssignmentDeclaration.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/salsa/bug27099.js(1,1): error TS2322: Type '1' is not assignable to type 'string'. +tests/cases/conformance/salsa/bug27099.js(1,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/salsa/bug27099.js (1 errors) ==== window.name = 1; ~~~~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. window.console; // should not have error: Property 'console' does not exist on type 'typeof window'. module.exports = 'anything'; diff --git a/tests/baselines/reference/incompatibleTypes.errors.txt b/tests/baselines/reference/incompatibleTypes.errors.txt index 66d94bea79ce8..741fcf60e6c19 100644 --- a/tests/baselines/reference/incompatibleTypes.errors.txt +++ b/tests/baselines/reference/incompatibleTypes.errors.txt @@ -27,7 +27,7 @@ tests/cases/compiler/incompatibleTypes.ts(49,7): error TS2769: No overload match Object literal may only specify known properties, and 'e' does not exist in type '{ c: { b: string; }; d: string; }'. tests/cases/compiler/incompatibleTypes.ts(66,47): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'. Object literal may only specify known properties, and 'e' does not exist in type '{ a: { a: string; }; b: string; }'. -tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2322: Type '5' is not assignable to type '() => string'. +tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2322: Type 'number' is not assignable to type '() => string'. tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => number' is not assignable to type '() => any'. @@ -141,7 +141,7 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => var i1c1: { (): string; } = 5; ~~~~ -!!! error TS2322: Type '5' is not assignable to type '() => string'. +!!! error TS2322: Type 'number' is not assignable to type '() => string'. var fp1: () =>any = a => 0; ~~~ diff --git a/tests/baselines/reference/indexIntoArraySubclass.errors.txt b/tests/baselines/reference/indexIntoArraySubclass.errors.txt index bbcf259fb33c4..1628e12d22fa7 100644 --- a/tests/baselines/reference/indexIntoArraySubclass.errors.txt +++ b/tests/baselines/reference/indexIntoArraySubclass.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/indexIntoArraySubclass.ts(4,1): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/compiler/indexIntoArraySubclass.ts(4,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/indexIntoArraySubclass.ts (1 errors) ==== @@ -7,4 +7,4 @@ tests/cases/compiler/indexIntoArraySubclass.ts(4,1): error TS2322: Type '0' is n var r = x2[0]; // string r = 0; //error ~ -!!! error TS2322: Type '0' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/inferSetterParamType.errors.txt b/tests/baselines/reference/inferSetterParamType.errors.txt index 7b28c52d48b1b..49ce844310d49 100644 --- a/tests/baselines/reference/inferSetterParamType.errors.txt +++ b/tests/baselines/reference/inferSetterParamType.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/inferSetterParamType.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inferSetterParamType.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inferSetterParamType.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/inferSetterParamType.ts(13,9): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/compiler/inferSetterParamType.ts(13,9): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -26,7 +26,7 @@ tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 0; // should be an error - can't coerce infered return type to match setter annotated type ~~~~~~~~~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. } set bar(n:string) { ~~~ diff --git a/tests/baselines/reference/inferenceShouldFailOnEvolvingArrays.errors.txt b/tests/baselines/reference/inferenceShouldFailOnEvolvingArrays.errors.txt index e8081e02cbd55..c784d54d57744 100644 --- a/tests/baselines/reference/inferenceShouldFailOnEvolvingArrays.errors.txt +++ b/tests/baselines/reference/inferenceShouldFailOnEvolvingArrays.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(7,11): error TS2345: Argument of type '42' is not assignable to parameter of type 'string'. -tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(9,15): error TS2345: Argument of type '42' is not assignable to parameter of type 'string'. +tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(7,11): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(9,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(15,17): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(17,19): error TS2345: Argument of type '42' is not assignable to parameter of type 'string'. +tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(17,19): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(18,22): error TS2322: Type 'number' is not assignable to type 'string'. @@ -14,11 +14,11 @@ tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(18,22): error TS2322 } logLength(42); // error ~~ -!!! error TS2345: Argument of type '42' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. let z; z = logLength(42); // no error; T is inferred as `any` ~~ -!!! error TS2345: Argument of type '42' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. function logFirstLength(arg: { [K in U]: T }[U]): T { console.log(arg[0].length); @@ -30,7 +30,7 @@ tests/cases/compiler/inferenceShouldFailOnEvolvingArrays.ts(18,22): error TS2322 let zz = []; zz.push(logLength(42)); // no error; T is inferred as `any` ~~ -!!! error TS2345: Argument of type '42' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. zz = logFirstLength([42]); // no error; T is inferred as `any[]` ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/inferentialTypingWithObjectLiteralProperties.errors.txt b/tests/baselines/reference/inferentialTypingWithObjectLiteralProperties.errors.txt index 69f215896708f..9dfb41c0faca8 100644 --- a/tests/baselines/reference/inferentialTypingWithObjectLiteralProperties.errors.txt +++ b/tests/baselines/reference/inferentialTypingWithObjectLiteralProperties.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(4,1): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(5,1): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(4,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(5,1): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts (2 errors) ==== @@ -8,8 +8,8 @@ tests/cases/compiler/inferentialTypingWithObjectLiteralProperties.ts(5,1): error } f({ x: [null] }, { x: [1] }).x[0] = "" // ok ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. f({ x: [1] }, { x: [null] }).x[0] = "" // was error TS2011: Cannot convert 'string' to 'number'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/inferringClassMembersFromAssignments.errors.txt b/tests/baselines/reference/inferringClassMembersFromAssignments.errors.txt index 48fa2cdb9d3a7..379d3f018c2c1 100644 --- a/tests/baselines/reference/inferringClassMembersFromAssignments.errors.txt +++ b/tests/baselines/reference/inferringClassMembersFromAssignments.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/salsa/a.js(14,13): error TS7008: Member 'inMethodNullable' implicitly has an 'any' type. -tests/cases/conformance/salsa/a.js(20,9): error TS2322: Type '"string"' is not assignable to type 'number'. -tests/cases/conformance/salsa/a.js(39,9): error TS2322: Type 'false' is not assignable to type 'number'. +tests/cases/conformance/salsa/a.js(20,9): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/salsa/a.js(39,9): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/salsa/a.js(93,13): error TS2334: 'this' cannot be referenced in a static property initializer. tests/cases/conformance/salsa/a.js(96,13): error TS2334: 'this' cannot be referenced in a static property initializer. @@ -29,7 +29,7 @@ tests/cases/conformance/salsa/a.js(96,13): error TS2334: 'this' cannot be refere } this.inMultiple = "string"; ~~~~~~~~~~~~~~~ -!!! error TS2322: Type '"string"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. this.inMultipleMethods = "string"; var action = () => { @@ -50,7 +50,7 @@ tests/cases/conformance/salsa/a.js(96,13): error TS2334: 'this' cannot be refere } this.inMultiple = false; ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. this.inMultipleMethods = false; } set() { diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams.errors.txt b/tests/baselines/reference/inheritedConstructorWithRestParams.errors.txt index 5e9775b81d945..fd63eafbaf71f 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams.errors.txt +++ b/tests/baselines/reference/inheritedConstructorWithRestParams.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/inheritedConstructorWithRestParams.ts(13,17): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. -tests/cases/compiler/inheritedConstructorWithRestParams.ts(14,13): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +tests/cases/compiler/inheritedConstructorWithRestParams.ts(13,17): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/inheritedConstructorWithRestParams.ts(14,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/inheritedConstructorWithRestParams.ts (2 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/inheritedConstructorWithRestParams.ts(14,13): error TS2345: // Errors new Derived("", 3); ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new Derived(3); ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt b/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt index 50b07517ffe92..5c555a08cf9d9 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/inheritedConstructorWithRestParams2.ts(32,13): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +tests/cases/compiler/inheritedConstructorWithRestParams2.ts(32,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/inheritedConstructorWithRestParams2.ts(33,1): error TS2769: No overload matches this call. Overload 1 of 3, '(x: string, ...y: number[]): Derived', gave the following error. - Argument of type '""' is not assignable to parameter of type 'number'. + Argument of type 'string' is not assignable to parameter of type 'number'. Overload 2 of 3, '(x1: string, x2: string, ...y: number[]): Derived', gave the following error. - Argument of type '3' is not assignable to parameter of type 'string'. + Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/inheritedConstructorWithRestParams2.ts(34,1): error TS2769: No overload matches this call. Overload 1 of 3, '(x: string, ...y: number[]): Derived', gave the following error. - Argument of type '""' is not assignable to parameter of type 'number'. + Argument of type 'string' is not assignable to parameter of type 'number'. Overload 2 of 3, '(x1: string, x2: string, ...y: number[]): Derived', gave the following error. - Argument of type '3' is not assignable to parameter of type 'string'. + Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/inheritedConstructorWithRestParams2.ts (3 errors) ==== @@ -45,18 +45,18 @@ tests/cases/compiler/inheritedConstructorWithRestParams2.ts(34,1): error TS2769: // Errors new Derived(3); ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new Derived("", 3, "", 3); ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(x: string, ...y: number[]): Derived', gave the following error. -!!! error TS2769: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 3, '(x1: string, x2: string, ...y: number[]): Derived', gave the following error. -!!! error TS2769: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'. new Derived("", 3, "", ""); ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(x: string, ...y: number[]): Derived', gave the following error. -!!! error TS2769: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 3, '(x1: string, x2: string, ...y: number[]): Derived', gave the following error. -!!! error TS2769: Argument of type '3' is not assignable to parameter of type 'string'. \ No newline at end of file +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/innerTypeCheckOfLambdaArgument.errors.txt b/tests/baselines/reference/innerTypeCheckOfLambdaArgument.errors.txt index 0e0bcde70de10..b5e56d2f4e37a 100644 --- a/tests/baselines/reference/innerTypeCheckOfLambdaArgument.errors.txt +++ b/tests/baselines/reference/innerTypeCheckOfLambdaArgument.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/innerTypeCheckOfLambdaArgument.ts(10,7): error TS2322: Type '10' is not assignable to type 'string'. +tests/cases/compiler/innerTypeCheckOfLambdaArgument.ts(10,7): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/innerTypeCheckOfLambdaArgument.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/compiler/innerTypeCheckOfLambdaArgument.ts(10,7): error TS2322: Type // otherwise, there's a bug in overload resolution / partial typechecking var k: string = 10; ~ -!!! error TS2322: Type '10' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. } ); \ No newline at end of file diff --git a/tests/baselines/reference/intersectionPropertyCheck.errors.txt b/tests/baselines/reference/intersectionPropertyCheck.errors.txt index 7c74c3512eaf1..568c3a82ad844 100644 --- a/tests/baselines/reference/intersectionPropertyCheck.errors.txt +++ b/tests/baselines/reference/intersectionPropertyCheck.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/intersectionPropertyCheck.ts(4,5): error TS2322: Type '{ a: tests/cases/compiler/intersectionPropertyCheck.ts(7,3): error TS2322: Type 'T & { a: boolean; }' is not assignable to type '{ a?: string | undefined; }'. Types of property 'a' are incompatible. Type 'boolean' is not assignable to type 'string | undefined'. -tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'true' is not assignable to type 'string[] | undefined'. +tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'boolean' is not assignable to type 'string[] | undefined'. ==== tests/cases/compiler/intersectionPropertyCheck.ts (4 errors) ==== @@ -40,7 +40,7 @@ tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'tr function test(value: T): Test { return { ...value, hi: true } ~~ -!!! error TS2322: Type 'true' is not assignable to type 'string[] | undefined'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string[] | undefined'. !!! related TS6500 tests/cases/compiler/intersectionPropertyCheck.ts:13:12: The expected type comes from property 'hi' which is declared here on type 'Test' } \ No newline at end of file diff --git a/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt b/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt index fd3fa48c01be2..8e51c41425861 100644 --- a/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt +++ b/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(2,1): error TS2322: Type '1' is not assignable to type 'void'. -tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(3,1): error TS2322: Type 'true' is not assignable to type 'void'. -tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(4,1): error TS2322: Type '""' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(2,1): error TS2322: Type 'number' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(3,1): error TS2322: Type 'boolean' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(4,1): error TS2322: Type 'string' is not assignable to type 'void'. tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(5,1): error TS2322: Type '{}' is not assignable to type 'void'. tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(9,1): error TS2322: Type 'typeof C' is not assignable to type 'void'. tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(10,1): error TS2322: Type 'C' is not assignable to type 'void'. @@ -14,13 +14,13 @@ tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts(22,5): var x: void; x = 1; ~ -!!! error TS2322: Type '1' is not assignable to type 'void'. +!!! error TS2322: Type 'number' is not assignable to type 'void'. x = true; ~ -!!! error TS2322: Type 'true' is not assignable to type 'void'. +!!! error TS2322: Type 'boolean' is not assignable to type 'void'. x = ''; ~ -!!! error TS2322: Type '""' is not assignable to type 'void'. +!!! error TS2322: Type 'string' is not assignable to type 'void'. x = {} ~ !!! error TS2322: Type '{}' is not assignable to type 'void'. diff --git a/tests/baselines/reference/invalidBooleanAssignments.errors.txt b/tests/baselines/reference/invalidBooleanAssignments.errors.txt index 85cbe36149476..5e1b0c495310e 100644 --- a/tests/baselines/reference/invalidBooleanAssignments.errors.txt +++ b/tests/baselines/reference/invalidBooleanAssignments.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(3,5): error TS2322: Type 'true' is not assignable to type 'number'. -tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(4,5): error TS2322: Type 'true' is not assignable to type 'string'. -tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(5,5): error TS2322: Type 'true' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(3,5): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(4,5): error TS2322: Type 'boolean' is not assignable to type 'string'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(5,5): error TS2322: Type 'boolean' is not assignable to type 'void'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(9,5): error TS2322: Type 'true' is not assignable to type 'E'. -tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(12,5): error TS2322: Type 'true' is not assignable to type 'C'. -tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(15,5): error TS2322: Type 'true' is not assignable to type 'I'. -tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(17,5): error TS2322: Type 'true' is not assignable to type '() => string'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(12,5): error TS2322: Type 'boolean' is not assignable to type 'C'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(15,5): error TS2322: Type 'boolean' is not assignable to type 'I'. +tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(17,5): error TS2322: Type 'boolean' is not assignable to type '() => string'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(21,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(24,5): error TS2322: Type 'boolean' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'boolean'. @@ -16,13 +16,13 @@ tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(26 var a: number = x; ~ -!!! error TS2322: Type 'true' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. var b: string = x; ~ -!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. var c: void = x; ~ -!!! error TS2322: Type 'true' is not assignable to type 'void'. +!!! error TS2322: Type 'boolean' is not assignable to type 'void'. var d: typeof undefined = x; enum E { A } @@ -33,16 +33,16 @@ tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(26 class C { foo: string } var f: C = x; ~ -!!! error TS2322: Type 'true' is not assignable to type 'C'. +!!! error TS2322: Type 'boolean' is not assignable to type 'C'. interface I { bar: string } var g: I = x; ~ -!!! error TS2322: Type 'true' is not assignable to type 'I'. +!!! error TS2322: Type 'boolean' is not assignable to type 'I'. var h: { (): string } = x; ~ -!!! error TS2322: Type 'true' is not assignable to type '() => string'. +!!! error TS2322: Type 'boolean' is not assignable to type '() => string'. var h2: { toString(): string } = x; // no error module M { export var a = 1; } diff --git a/tests/baselines/reference/invalidNumberAssignments.errors.txt b/tests/baselines/reference/invalidNumberAssignments.errors.txt index b6a8bccf32886..3326e2af12299 100644 --- a/tests/baselines/reference/invalidNumberAssignments.errors.txt +++ b/tests/baselines/reference/invalidNumberAssignments.errors.txt @@ -3,8 +3,8 @@ tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(4,5) tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(5,5): error TS2322: Type 'number' is not assignable to type 'void'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(9,5): error TS2322: Type 'number' is not assignable to type 'C'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(12,5): error TS2322: Type 'number' is not assignable to type 'I'. -tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(14,5): error TS2322: Type '1' is not assignable to type '{ baz: string; }'. -tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(15,5): error TS2322: Type '1' is not assignable to type '{ 0: number; }'. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. +tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(18,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(21,5): error TS2322: Type 'number' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. @@ -37,10 +37,10 @@ tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(23,1 var g: { baz: string } = 1; ~ -!!! error TS2322: Type '1' is not assignable to type '{ baz: string; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. var g2: { 0: number } = 1; ~~ -!!! error TS2322: Type '1' is not assignable to type '{ 0: number; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. module M { export var x = 1; } M = x; diff --git a/tests/baselines/reference/invalidStringAssignments.errors.txt b/tests/baselines/reference/invalidStringAssignments.errors.txt index 56cc94cb05bd4..9c586858f6a7e 100644 --- a/tests/baselines/reference/invalidStringAssignments.errors.txt +++ b/tests/baselines/reference/invalidStringAssignments.errors.txt @@ -3,8 +3,8 @@ tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(4,5) tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(5,5): error TS2322: Type 'string' is not assignable to type 'void'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(9,5): error TS2322: Type 'string' is not assignable to type 'C'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(12,5): error TS2322: Type 'string' is not assignable to type 'I'. -tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(14,5): error TS2322: Type '1' is not assignable to type '{ baz: string; }'. -tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(15,5): error TS2322: Type '1' is not assignable to type '{ 0: number; }'. +tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. +tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(18,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(21,5): error TS2322: Type 'string' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'string'. @@ -38,10 +38,10 @@ tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(26,5 var g: { baz: string } = 1; ~ -!!! error TS2322: Type '1' is not assignable to type '{ baz: string; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. var g2: { 0: number } = 1; ~~ -!!! error TS2322: Type '1' is not assignable to type '{ 0: number; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. module M { export var x = 1; } M = x; diff --git a/tests/baselines/reference/invalidVoidAssignments.errors.txt b/tests/baselines/reference/invalidVoidAssignments.errors.txt index 62317d016d738..3e3684718275b 100644 --- a/tests/baselines/reference/invalidVoidAssignments.errors.txt +++ b/tests/baselines/reference/invalidVoidAssignments.errors.txt @@ -3,8 +3,8 @@ tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(4,5): er tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(5,5): error TS2322: Type 'void' is not assignable to type 'number'. tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(9,5): error TS2322: Type 'void' is not assignable to type 'C'. tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(12,5): error TS2322: Type 'void' is not assignable to type 'I'. -tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(14,5): error TS2322: Type '1' is not assignable to type '{ baz: string; }'. -tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(15,5): error TS2322: Type '1' is not assignable to type '{ 0: number; }'. +tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. +tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(18,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(21,5): error TS2322: Type 'void' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'void'. @@ -40,10 +40,10 @@ tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(29,1): e var g: { baz: string } = 1; ~ -!!! error TS2322: Type '1' is not assignable to type '{ baz: string; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ baz: string; }'. var g2: { 0: number } = 1; ~~ -!!! error TS2322: Type '1' is not assignable to type '{ 0: number; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }'. module M { export var x = 1; } M = x; diff --git a/tests/baselines/reference/invalidVoidValues.errors.txt b/tests/baselines/reference/invalidVoidValues.errors.txt index 51155152864b3..b9b14cd688380 100644 --- a/tests/baselines/reference/invalidVoidValues.errors.txt +++ b/tests/baselines/reference/invalidVoidValues.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(2,1): error TS2322: Type '1' is not assignable to type 'void'. -tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(3,1): error TS2322: Type '""' is not assignable to type 'void'. -tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(4,1): error TS2322: Type 'true' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(2,1): error TS2322: Type 'number' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(3,1): error TS2322: Type 'string' is not assignable to type 'void'. +tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(4,1): error TS2322: Type 'boolean' is not assignable to type 'void'. tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(7,1): error TS2322: Type 'typeof E' is not assignable to type 'void'. tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(8,1): error TS2322: Type 'E' is not assignable to type 'void'. tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(12,1): error TS2322: Type 'C' is not assignable to type 'void'. @@ -15,13 +15,13 @@ tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(26,5): error var x: void; x = 1; ~ -!!! error TS2322: Type '1' is not assignable to type 'void'. +!!! error TS2322: Type 'number' is not assignable to type 'void'. x = ''; ~ -!!! error TS2322: Type '""' is not assignable to type 'void'. +!!! error TS2322: Type 'string' is not assignable to type 'void'. x = true; ~ -!!! error TS2322: Type 'true' is not assignable to type 'void'. +!!! error TS2322: Type 'boolean' is not assignable to type 'void'. enum E { A } x = E; diff --git a/tests/baselines/reference/invocationExpressionInFunctionParameter.errors.txt b/tests/baselines/reference/invocationExpressionInFunctionParameter.errors.txt index e887d564df4ea..b38ed09f47e3a 100644 --- a/tests/baselines/reference/invocationExpressionInFunctionParameter.errors.txt +++ b/tests/baselines/reference/invocationExpressionInFunctionParameter.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/invocationExpressionInFunctionParameter.ts(3,24): error TS2345: Argument of type '123' is not assignable to parameter of type 'string'. +tests/cases/compiler/invocationExpressionInFunctionParameter.ts(3,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/invocationExpressionInFunctionParameter.ts (1 errors) ==== @@ -6,5 +6,5 @@ tests/cases/compiler/invocationExpressionInFunctionParameter.ts(3,24): error TS2 } function foo3(x = foo1(123)) { //should error, 123 is not string ~~~ -!!! error TS2345: Argument of type '123' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt b/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt index 2ddfa178de239..2d384d3e181e0 100644 --- a/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt +++ b/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/file1.ts(1,14): error TS2322: Type '3' is not assignable to type 'string'. +tests/cases/compiler/file1.ts(1,14): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/file1.ts (1 errors) ==== export const x: string = 3; ~ -!!! error TS2322: Type '3' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern28.errors.txt b/tests/baselines/reference/iterableArrayPattern28.errors.txt index 605c6feb405d6..0778b149183b3 100644 --- a/tests/baselines/reference/iterableArrayPattern28.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern28.errors.txt @@ -10,7 +10,7 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts(2,24): error Types of property '1' are incompatible. Type 'boolean' is not assignable to type 'number'. Overload 2 of 3, '(entries?: readonly (readonly [string, number])[]): Map', gave the following error. - Type 'true' is not assignable to type 'number'. + Type 'boolean' is not assignable to type 'number'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts (1 errors) ==== @@ -29,4 +29,4 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts(2,24): error !!! error TS2769: Types of property '1' are incompatible. !!! error TS2769: Type 'boolean' is not assignable to type 'number'. !!! error TS2769: Overload 2 of 3, '(entries?: readonly (readonly [string, number])[]): Map', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2769: Type 'boolean' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/jsContainerMergeTsDeclaration2.errors.txt b/tests/baselines/reference/jsContainerMergeTsDeclaration2.errors.txt index 7078de12816d4..2720bea3547f1 100644 --- a/tests/baselines/reference/jsContainerMergeTsDeclaration2.errors.txt +++ b/tests/baselines/reference/jsContainerMergeTsDeclaration2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/salsa/b.js(2,1): error TS2322: Type '2' is not assignable to type '() => void'. +tests/cases/conformance/salsa/b.js(2,1): error TS2322: Type 'number' is not assignable to type '() => void'. ==== tests/cases/conformance/salsa/a.d.ts (0 errors) ==== @@ -9,5 +9,5 @@ tests/cases/conformance/salsa/b.js(2,1): error TS2322: Type '2' is not assignabl C.prototype = {}; C.bar = 2; ~~~~~ -!!! error TS2322: Type '2' is not assignable to type '() => void'. +!!! error TS2322: Type 'number' is not assignable to type '() => void'. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileClassPropertyType.errors.txt b/tests/baselines/reference/jsFileClassPropertyType.errors.txt index 72d11da977804..e1f7851764f46 100644 --- a/tests/baselines/reference/jsFileClassPropertyType.errors.txt +++ b/tests/baselines/reference/jsFileClassPropertyType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/bar.ts(1,1): error TS2322: Type '"string"' is not assignable to type 'number'. +tests/cases/compiler/bar.ts(1,1): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/foo.js (0 errors) ==== @@ -11,5 +11,5 @@ tests/cases/compiler/bar.ts(1,1): error TS2322: Type '"string"' is not assignabl ==== tests/cases/compiler/bar.ts (1 errors) ==== (new C()).p = "string"; ~~~~~~~~~~~ -!!! error TS2322: Type '"string"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileClassPropertyType2.errors.txt b/tests/baselines/reference/jsFileClassPropertyType2.errors.txt index e033ed3874e3d..22ccc93037c9c 100644 --- a/tests/baselines/reference/jsFileClassPropertyType2.errors.txt +++ b/tests/baselines/reference/jsFileClassPropertyType2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/bar.ts(1,18): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'. +tests/cases/compiler/bar.ts(1,18): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== tests/cases/compiler/foo.js (0 errors) ==== @@ -12,5 +12,5 @@ tests/cases/compiler/bar.ts(1,18): error TS2345: Argument of type '"string"' is ==== tests/cases/compiler/bar.ts (1 errors) ==== (new C()).p.push("string"); ~~~~~~~~ -!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileClassPropertyType3.errors.txt b/tests/baselines/reference/jsFileClassPropertyType3.errors.txt index 1035d92ea1b58..42755be688f75 100644 --- a/tests/baselines/reference/jsFileClassPropertyType3.errors.txt +++ b/tests/baselines/reference/jsFileClassPropertyType3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/bar.ts(1,1): error TS2322: Type '"string"' is not assignable to type 'number'. +tests/cases/compiler/bar.ts(1,1): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/foo.js (0 errors) ==== @@ -16,5 +16,5 @@ tests/cases/compiler/bar.ts(1,1): error TS2322: Type '"string"' is not assignabl ==== tests/cases/compiler/bar.ts (1 errors) ==== (new C()).p = "string"; // Error ~~~~~~~~~~~ -!!! error TS2322: Type '"string"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/jsPropertyAssignedAfterMethodDeclaration.errors.txt b/tests/baselines/reference/jsPropertyAssignedAfterMethodDeclaration.errors.txt index a2e0dd12d31aa..6b05a0a50b29a 100644 --- a/tests/baselines/reference/jsPropertyAssignedAfterMethodDeclaration.errors.txt +++ b/tests/baselines/reference/jsPropertyAssignedAfterMethodDeclaration.errors.txt @@ -1,4 +1,4 @@ -/a.js(4,9): error TS2322: Type '0' is not assignable to type '() => void'. +/a.js(4,9): error TS2322: Type 'number' is not assignable to type '() => void'. ==== /a.js (1 errors) ==== @@ -7,7 +7,7 @@ // Should not be treated as a declaration. Should be an error. this.a = 0; ~~~~~~ -!!! error TS2322: Type '0' is not assignable to type '() => void'. +!!! error TS2322: Type 'number' is not assignable to type '() => void'. } }; \ No newline at end of file diff --git a/tests/baselines/reference/jsdocRestParameter.errors.txt b/tests/baselines/reference/jsdocRestParameter.errors.txt index ec34bcdcb2050..0bdf821fc999c 100644 --- a/tests/baselines/reference/jsdocRestParameter.errors.txt +++ b/tests/baselines/reference/jsdocRestParameter.errors.txt @@ -1,5 +1,5 @@ /a.js(7,3): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'number'. -/a.js(8,6): error TS2345: Argument of type '"2"' is not assignable to parameter of type 'number'. +/a.js(8,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== /a.js (2 errors) ==== @@ -14,6 +14,6 @@ !!! error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'number'. f(1, "2"); // Error ~~~ -!!! error TS2345: Argument of type '"2"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. f(1, 2); \ No newline at end of file diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction.errors.txt b/tests/baselines/reference/jsdocTemplateConstructorFunction.errors.txt index 1153424c8db61..ec7fffc00acc3 100644 --- a/tests/baselines/reference/jsdocTemplateConstructorFunction.errors.txt +++ b/tests/baselines/reference/jsdocTemplateConstructorFunction.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js(24,1): error TS2322: Type 'false' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js(24,1): error TS2322: Type 'boolean' is not assignable to type 'number'. ==== tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js (1 errors) ==== @@ -27,5 +27,5 @@ tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js(24,1): error z.t = 2 z.u = false ~~~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction2.errors.txt b/tests/baselines/reference/jsdocTemplateConstructorFunction2.errors.txt index 93355d60205f0..91cc8e17c32ba 100644 --- a/tests/baselines/reference/jsdocTemplateConstructorFunction2.errors.txt +++ b/tests/baselines/reference/jsdocTemplateConstructorFunction2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsdoc/templateTagWithNestedTypeLiteral.js(21,1): error TS2322: Type 'false' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/templateTagWithNestedTypeLiteral.js(21,1): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/jsdoc/templateTagWithNestedTypeLiteral.js(28,15): error TS2304: Cannot find name 'T'. @@ -25,7 +25,7 @@ tests/cases/conformance/jsdoc/templateTagWithNestedTypeLiteral.js(28,15): error z.t = 2 z.u = false ~~~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. /** @type {number} */ let answer = z.add(3, { nested: 4 }) diff --git a/tests/baselines/reference/jsdocTypeFromChainedAssignment.errors.txt b/tests/baselines/reference/jsdocTypeFromChainedAssignment.errors.txt index 6ae96fbdae00e..49f491d2bf984 100644 --- a/tests/baselines/reference/jsdocTypeFromChainedAssignment.errors.txt +++ b/tests/baselines/reference/jsdocTypeFromChainedAssignment.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/jsdoc/a.js(12,21): error TS2339: Property 'x' does not exist on type 'typeof A'. -tests/cases/conformance/jsdoc/a.js(15,5): error TS2345: Argument of type '"no"' is not assignable to parameter of type 'number'. -tests/cases/conformance/jsdoc/a.js(16,5): error TS2345: Argument of type '"not really"' is not assignable to parameter of type 'number'. -tests/cases/conformance/jsdoc/a.js(17,5): error TS2345: Argument of type '"still no"' is not assignable to parameter of type 'number'. -tests/cases/conformance/jsdoc/a.js(18,5): error TS2345: Argument of type '"not here either"' is not assignable to parameter of type 'number'. +tests/cases/conformance/jsdoc/a.js(15,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/jsdoc/a.js(16,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/jsdoc/a.js(17,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/jsdoc/a.js(18,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/jsdoc/a.js(19,1): error TS2322: Type '10' is not assignable to type '1'. @@ -25,16 +25,16 @@ tests/cases/conformance/jsdoc/a.js(19,1): error TS2322: Type '10' is not assigna var a = new A() a.y('no') // error ~~~~ -!!! error TS2345: Argument of type '"no"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. a.z('not really') // error ~~~~~~~~~~~~ -!!! error TS2345: Argument of type '"not really"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. A.s('still no') // error ~~~~~~~~~~ -!!! error TS2345: Argument of type '"still no"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. A.t('not here either') // error ~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '"not here either"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. a.first = 10 // error: '10' isn't assignable to '1' ~~~~~~~ !!! error TS2322: Type '10' is not assignable to type '1'. diff --git a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.errors.txt b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.errors.txt index bac759ea1838f..d9a553f7e283a 100644 --- a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.errors.txt +++ b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.errors.txt @@ -1,23 +1,23 @@ -tests/cases/conformance/jsdoc/use.js(2,7): error TS2345: Argument of type '"no"' is not assignable to parameter of type 'number'. -tests/cases/conformance/jsdoc/use.js(3,7): error TS2345: Argument of type '"also no"' is not assignable to parameter of type 'number'. -tests/cases/conformance/jsdoc/use.js(4,7): error TS2345: Argument of type '0' is not assignable to parameter of type 'string'. -tests/cases/conformance/jsdoc/use.js(5,7): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/conformance/jsdoc/use.js(2,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/jsdoc/use.js(3,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/jsdoc/use.js(4,7): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/jsdoc/use.js(5,7): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/conformance/jsdoc/use.js (4 errors) ==== var mod = require('./mod'); mod.f('no') ~~~~ -!!! error TS2345: Argument of type '"no"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. mod.g('also no') ~~~~~~~~~ -!!! error TS2345: Argument of type '"also no"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. mod.h(0) ~ -!!! error TS2345: Argument of type '0' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. mod.i(1) ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/conformance/jsdoc/mod.js (0 errors) ==== /** @param {number} n */ diff --git a/tests/baselines/reference/jsdocTypeTagParameterType.errors.txt b/tests/baselines/reference/jsdocTypeTagParameterType.errors.txt index d03e8211a18ff..4d4b1ee8bafca 100644 --- a/tests/baselines/reference/jsdocTypeTagParameterType.errors.txt +++ b/tests/baselines/reference/jsdocTypeTagParameterType.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/jsdoc/a.js(3,5): error TS2322: Type '1' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/a.js(7,5): error TS2322: Type '1' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/a.js(3,5): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/a.js(7,5): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsdoc/a.js (2 errors) ==== @@ -7,12 +7,12 @@ tests/cases/conformance/jsdoc/a.js(7,5): error TS2322: Type '1' is not assignabl const f = (value) => { value = 1 // should error ~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. }; /** @type {(s: string) => void} */ function g(s) { s = 1 // Should error ~ -!!! error TS2322: Type '1' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt index b00409544decc..88859ee6543ef 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(4,5): error TS2322: Type '"x"' is not assignable to type 'number'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(4,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(6,5): error TS2322: Type '2' is not assignable to type '0 | 1'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(7,5): error TS2322: Type '"x"' is not assignable to type '0 | 1'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(8,5): error TS2322: Type '1' is not assignable to type 'never'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(9,5): error TS2322: Type '2' is not assignable to type 'never'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(10,5): error TS2322: Type '"x"' is not assignable to type 'never'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(8,5): error TS2322: Type 'number' is not assignable to type 'never'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(9,5): error TS2322: Type 'number' is not assignable to type 'never'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(10,5): error TS2322: Type 'string' is not assignable to type 'never'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(14,5): error TS2739: Type '{ [key: string]: number; }' is missing the following properties from type '{ x: number; y: number; }': x, y tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(15,5): error TS2322: Type 'T' is not assignable to type '{ x: number; y: number; }'. Type '{ [key: string]: number; }' is missing the following properties from type '{ x: number; y: number; }': x, y @@ -12,20 +12,20 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(18,5): error TS232 tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(19,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type 'T'. '{ [key: string]: number; }' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{ [key: string]: number; }'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(26,7): error TS2339: Property 'x' does not exist on type 'T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(27,5): error TS2322: Type '1' is not assignable to type 'T[keyof T]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(27,5): error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(31,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type '{ [P in K]: number; }'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(38,5): error TS2322: Type '{ [x: string]: number; }' is not assignable to type '{ [P in K]: number; }'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(50,3): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Item'. No index signature with a parameter of type 'string' was found on type 'Item'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(51,3): error TS2322: Type '123' is not assignable to type 'never'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(52,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(53,3): error TS2322: Type '123' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(51,3): error TS2322: Type 'number' is not assignable to type 'never'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(52,3): error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(53,3): error TS2322: Type 'number' is not assignable to type 'T[K]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(65,7): error TS2339: Property 'foo' does not exist on type 'T'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(66,3): error TS2536: Type 'string' cannot be used to index type 'T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(67,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(68,3): error TS2322: Type '123' is not assignable to type 'T[K]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS2322: Type '123' is not assignable to type 'Type[K]'. - Type '123' is not assignable to type 'never'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(67,3): error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(68,3): error TS2322: Type 'number' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS2322: Type 'number' is not assignable to type 'Type[K]'. + Type 'number' is not assignable to type 'never'. ==== tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts (23 errors) ==== @@ -34,7 +34,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 obj[k0] = 2; obj[k0] = 'x'; // Error ~~~~~~~ -!!! error TS2322: Type '"x"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. obj[k1] = 1; obj[k1] = 2; // Error ~~~~~~~ @@ -44,13 +44,13 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS2322: Type '"x"' is not assignable to type '0 | 1'. obj[k2] = 1; // Error ~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'never'. +!!! error TS2322: Type 'number' is not assignable to type 'never'. obj[k2] = 2; // Error ~~~~~~~ -!!! error TS2322: Type '2' is not assignable to type 'never'. +!!! error TS2322: Type 'number' is not assignable to type 'never'. obj[k2] = 'x'; // Error ~~~~~~~ -!!! error TS2322: Type '"x"' is not assignable to type 'never'. +!!! error TS2322: Type 'string' is not assignable to type 'never'. } function f2(a: { x: number, y: number }, b: { [key: string]: number }, c: T, k: keyof T) { @@ -82,7 +82,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS2339: Property 'x' does not exist on type 'T'. c[k] = 1; // Error, cannot write to index signature through constraint ~~~~ -!!! error TS2322: Type '1' is not assignable to type 'T[keyof T]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. } function f3(a: { [P in K]: number }, b: { [key: string]: number }, k: K) { @@ -115,13 +115,13 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS7053: No index signature with a parameter of type 'string' was found on type 'Item'. obj[k2] = 123; // Error ~~~~~~~ -!!! error TS2322: Type '123' is not assignable to type 'never'. +!!! error TS2322: Type 'number' is not assignable to type 'never'. obj[k3] = 123; // Error ~~~~~~~ -!!! error TS2322: Type '123' is not assignable to type 'T[keyof T]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. obj[k4] = 123; // Error ~~~~~~~ -!!! error TS2322: Type '123' is not assignable to type 'T[K]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[K]'. } type Dict = Record; @@ -141,10 +141,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS2536: Type 'string' cannot be used to index type 'T'. obj[k2] = 123; // Error ~~~~~~~ -!!! error TS2322: Type '123' is not assignable to type 'T[keyof T]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. obj[k3] = 123; // Error ~~~~~~~ -!!! error TS2322: Type '123' is not assignable to type 'T[K]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[K]'. } // Repro from #27895 @@ -186,8 +186,8 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 function get123(): Type[K] { return 123; // Error ~~~~~~~~~~~ -!!! error TS2322: Type '123' is not assignable to type 'Type[K]'. -!!! error TS2322: Type '123' is not assignable to type 'never'. +!!! error TS2322: Type 'number' is not assignable to type 'Type[K]'. +!!! error TS2322: Type 'number' is not assignable to type 'never'. } // Repro from #30920 diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index 1738d6d977369..6bc2e322e17b8 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -69,10 +69,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(114,5): error tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error TS2322: Type 'T[K]' is not assignable to type 'U[J]'. Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(122,5): error TS2322: Type '42' is not assignable to type 'keyof T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error TS2322: Type '"hello"' is not assignable to type 'keyof T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type '42' is not assignable to type 'T[K]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(141,5): error TS2322: Type '"hello"' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(122,5): error TS2322: Type 'number' is not assignable to type 'keyof T'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error TS2322: Type 'string' is not assignable to type 'keyof T'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type 'number' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(141,5): error TS2322: Type 'string' is not assignable to type 'T[K]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error TS2322: Type 'number[]' is not assignable to type 'T[K]'. @@ -306,10 +306,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error function f4(k: keyof T) { k = 42; // error ~ -!!! error TS2322: Type '42' is not assignable to type 'keyof T'. +!!! error TS2322: Type 'number' is not assignable to type 'keyof T'. k = "hello"; // error ~ -!!! error TS2322: Type '"hello"' is not assignable to type 'keyof T'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof T'. } // Repro from #27470 @@ -328,10 +328,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error function test1, K extends keyof T>(t: T, k: K) { t[k] = 42; // Error ~~~~ -!!! error TS2322: Type '42' is not assignable to type 'T[K]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[K]'. t[k] = "hello"; // Error ~~~~ -!!! error TS2322: Type '"hello"' is not assignable to type 'T[K]'. +!!! error TS2322: Type 'string' is not assignable to type 'T[K]'. t[k] = [10, 20]; // Error ~~~~ !!! error TS2322: Type 'number[]' is not assignable to type 'T[K]'. diff --git a/tests/baselines/reference/keyofDoesntContainSymbols.errors.txt b/tests/baselines/reference/keyofDoesntContainSymbols.errors.txt index f87631f9dbae1..42a2d373be64e 100644 --- a/tests/baselines/reference/keyofDoesntContainSymbols.errors.txt +++ b/tests/baselines/reference/keyofDoesntContainSymbols.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/keyofDoesntContainSymbols.ts(11,30): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +tests/cases/compiler/keyofDoesntContainSymbols.ts(11,30): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/compiler/keyofDoesntContainSymbols.ts(14,23): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type '"str" | "num"'. tests/cases/compiler/keyofDoesntContainSymbols.ts(17,23): error TS2345: Argument of type '0' is not assignable to parameter of type '"str" | "num"'. @@ -16,7 +16,7 @@ tests/cases/compiler/keyofDoesntContainSymbols.ts(17,23): error TS2345: Argument // string const valB = set(obj, 'num', ''); ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. // Expect type error // Argument of type '""' is not assignable to parameter of type 'number'. const valC = set(obj, sym, sym); diff --git a/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt b/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt index 92f3d403d02ad..7d6c194eddbc3 100644 --- a/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt +++ b/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/keyofIsLiteralContexualType.ts(5,37): error TS2322: Type '"c"' is not assignable to type 'keyof T'. +tests/cases/compiler/keyofIsLiteralContexualType.ts(5,37): error TS2322: Type 'string' is not assignable to type 'keyof T'. Type '"c"' is not assignable to type '"a" | "b"'. tests/cases/compiler/keyofIsLiteralContexualType.ts(13,11): error TS2339: Property 'b' does not exist on type 'Pick<{ a: number; b: number; c: number; }, "a" | "c">'. @@ -10,7 +10,7 @@ tests/cases/compiler/keyofIsLiteralContexualType.ts(13,11): error TS2339: Proper let a: (keyof T)[] = ["a", "b"]; let b: (keyof T)[] = ["a", "b", "c"]; ~~~ -!!! error TS2322: Type '"c"' is not assignable to type 'keyof T'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof T'. !!! error TS2322: Type '"c"' is not assignable to type '"a" | "b"'. } diff --git a/tests/baselines/reference/maxConstraints.errors.txt b/tests/baselines/reference/maxConstraints.errors.txt index ad8ba7f35393c..4ac4f680decc4 100644 --- a/tests/baselines/reference/maxConstraints.errors.txt +++ b/tests/baselines/reference/maxConstraints.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'Comparable<1 | 2>'. +tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<1 | 2>'. ==== tests/cases/compiler/maxConstraints.ts (1 errors) ==== @@ -11,4 +11,4 @@ tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type '1' var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; var maxResult = max2(1, 2); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'Comparable<1 | 2>'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<1 | 2>'. \ No newline at end of file diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.errors.txt b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.errors.txt index aab5dbc8b831c..ad1f0a57ac466 100644 --- a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.errors.txt +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts(7,1): error TS2322: Type 'false' is not assignable to type 'string'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts(7,1): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts(7,3): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. @@ -11,6 +11,6 @@ tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6We let a = ['c', 'd']; a[Symbol.isConcatSpreadable] = false; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. ~~~~~~ !!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. \ No newline at end of file diff --git a/tests/baselines/reference/neverTypeErrors1.errors.txt b/tests/baselines/reference/neverTypeErrors1.errors.txt index fe1dc42fb2d0e..d5299d0b30080 100644 --- a/tests/baselines/reference/neverTypeErrors1.errors.txt +++ b/tests/baselines/reference/neverTypeErrors1.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/types/never/neverTypeErrors1.ts(3,5): error TS2322: Type '1' is not assignable to type 'never'. -tests/cases/conformance/types/never/neverTypeErrors1.ts(4,5): error TS2322: Type '"abc"' is not assignable to type 'never'. -tests/cases/conformance/types/never/neverTypeErrors1.ts(5,5): error TS2322: Type 'false' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(3,5): error TS2322: Type 'number' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(4,5): error TS2322: Type 'string' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(5,5): error TS2322: Type 'boolean' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(6,5): error TS2322: Type 'undefined' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(7,5): error TS2322: Type 'null' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(8,5): error TS2322: Type '{}' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(9,5): error TS2349: This expression is not callable. Type 'never' has no call signatures. tests/cases/conformance/types/never/neverTypeErrors1.ts(13,5): error TS2322: Type 'undefined' is not assignable to type 'never'. -tests/cases/conformance/types/never/neverTypeErrors1.ts(17,5): error TS2322: Type '1' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(17,5): error TS2322: Type 'number' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(20,16): error TS2534: A function returning 'never' cannot have a reachable end point. tests/cases/conformance/types/never/neverTypeErrors1.ts(23,17): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. tests/cases/conformance/types/never/neverTypeErrors1.ts(24,17): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type 'never'. @@ -18,13 +18,13 @@ tests/cases/conformance/types/never/neverTypeErrors1.ts(24,17): error TS2407: Th let x: never; x = 1; ~ -!!! error TS2322: Type '1' is not assignable to type 'never'. +!!! error TS2322: Type 'number' is not assignable to type 'never'. x = "abc"; ~ -!!! error TS2322: Type '"abc"' is not assignable to type 'never'. +!!! error TS2322: Type 'string' is not assignable to type 'never'. x = false; ~ -!!! error TS2322: Type 'false' is not assignable to type 'never'. +!!! error TS2322: Type 'boolean' is not assignable to type 'never'. x = undefined; ~ !!! error TS2322: Type 'undefined' is not assignable to type 'never'. @@ -49,7 +49,7 @@ tests/cases/conformance/types/never/neverTypeErrors1.ts(24,17): error TS2407: Th function f3(): never { return 1; ~~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'never'. +!!! error TS2322: Type 'number' is not assignable to type 'never'. } function f4(): never { diff --git a/tests/baselines/reference/neverTypeErrors2.errors.txt b/tests/baselines/reference/neverTypeErrors2.errors.txt index 5fb144fa91e09..0cf3b6fbf0033 100644 --- a/tests/baselines/reference/neverTypeErrors2.errors.txt +++ b/tests/baselines/reference/neverTypeErrors2.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/types/never/neverTypeErrors2.ts(3,5): error TS2322: Type '1' is not assignable to type 'never'. -tests/cases/conformance/types/never/neverTypeErrors2.ts(4,5): error TS2322: Type '"abc"' is not assignable to type 'never'. -tests/cases/conformance/types/never/neverTypeErrors2.ts(5,5): error TS2322: Type 'false' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(3,5): error TS2322: Type 'number' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(4,5): error TS2322: Type 'string' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(5,5): error TS2322: Type 'boolean' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(6,5): error TS2322: Type 'undefined' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(7,5): error TS2322: Type 'null' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(8,5): error TS2322: Type '{}' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(9,5): error TS2349: This expression is not callable. Type 'never' has no call signatures. tests/cases/conformance/types/never/neverTypeErrors2.ts(13,5): error TS2322: Type 'undefined' is not assignable to type 'never'. -tests/cases/conformance/types/never/neverTypeErrors2.ts(17,5): error TS2322: Type '1' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(17,5): error TS2322: Type 'number' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(20,16): error TS2534: A function returning 'never' cannot have a reachable end point. tests/cases/conformance/types/never/neverTypeErrors2.ts(23,17): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. tests/cases/conformance/types/never/neverTypeErrors2.ts(24,17): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type 'never'. @@ -18,13 +18,13 @@ tests/cases/conformance/types/never/neverTypeErrors2.ts(24,17): error TS2407: Th let x: never; x = 1; ~ -!!! error TS2322: Type '1' is not assignable to type 'never'. +!!! error TS2322: Type 'number' is not assignable to type 'never'. x = "abc"; ~ -!!! error TS2322: Type '"abc"' is not assignable to type 'never'. +!!! error TS2322: Type 'string' is not assignable to type 'never'. x = false; ~ -!!! error TS2322: Type 'false' is not assignable to type 'never'. +!!! error TS2322: Type 'boolean' is not assignable to type 'never'. x = undefined; ~ !!! error TS2322: Type 'undefined' is not assignable to type 'never'. @@ -49,7 +49,7 @@ tests/cases/conformance/types/never/neverTypeErrors2.ts(24,17): error TS2407: Th function f3(): never { return 1; ~~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'never'. +!!! error TS2322: Type 'number' is not assignable to type 'never'. } function f4(): never { diff --git a/tests/baselines/reference/noEmitOnError.errors.txt b/tests/baselines/reference/noEmitOnError.errors.txt index 6262fa760f016..e41c41f90daec 100644 --- a/tests/baselines/reference/noEmitOnError.errors.txt +++ b/tests/baselines/reference/noEmitOnError.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/noEmitOnError.ts(1,5): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/compiler/noEmitOnError.ts(1,5): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/noEmitOnError.ts (1 errors) ==== var x: number = ""; ~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/noErrorTruncation.errors.txt b/tests/baselines/reference/noErrorTruncation.errors.txt index d5244df81a893..0bc6d295c025f 100644 --- a/tests/baselines/reference/noErrorTruncation.errors.txt +++ b/tests/baselines/reference/noErrorTruncation.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type '42' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. +tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type 'number' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. ==== tests/cases/compiler/noErrorTruncation.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type '42' is not const x: SomeLongOptionA ~ -!!! error TS2322: Type '42' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. +!!! error TS2322: Type 'number' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD diff --git a/tests/baselines/reference/nonPrimitiveAssignError.errors.txt b/tests/baselines/reference/nonPrimitiveAssignError.errors.txt index 76bdf786834c5..e808cf6c4025f 100644 --- a/tests/baselines/reference/nonPrimitiveAssignError.errors.txt +++ b/tests/baselines/reference/nonPrimitiveAssignError.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(5,1): error TS2741: Property 'foo' is missing in type '{}' but required in type '{ foo: string; }'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(13,1): error TS2322: Type 'number' is not assignable to type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(14,1): error TS2322: Type 'true' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(14,1): error TS2322: Type 'boolean' is not assignable to type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(15,1): error TS2322: Type 'string' is not assignable to type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(17,1): error TS2322: Type 'object' is not assignable to type 'number'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(18,1): error TS2322: Type 'object' is not assignable to type 'boolean'. @@ -28,7 +28,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(19,1): err !!! error TS2322: Type 'number' is not assignable to type 'object'. a = b; // expect error ~ -!!! error TS2322: Type 'true' is not assignable to type 'object'. +!!! error TS2322: Type 'boolean' is not assignable to type 'object'. a = s; // expect error ~ !!! error TS2322: Type 'string' is not assignable to type 'object'. diff --git a/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt b/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt index ce257c876809d..5cc7d3664b080 100644 --- a/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt +++ b/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(2,9): error TS2322: Type 'T' is not assignable to type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(9,17): error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(9,17): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(10,17): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(18,7): error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(18,7): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(19,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(25,8): error TS2344: Type 'number' does not satisfy the constraint 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(26,8): error TS2344: Type 'string' does not satisfy the constraint 'object'. @@ -21,7 +21,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(34,14): erro generic(a); generic(123); // expect error ~~~ -!!! error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'. generic(b); // expect error ~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. @@ -34,7 +34,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(34,14): erro bound(a); bound(123); // expect error ~~~ -!!! error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'. bound(b); // expect error ~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. diff --git a/tests/baselines/reference/nonPrimitiveNarrow.errors.txt b/tests/baselines/reference/nonPrimitiveNarrow.errors.txt index 1b3cf55b4b2ac..e2453cbd5195b 100644 --- a/tests/baselines/reference/nonPrimitiveNarrow.errors.txt +++ b/tests/baselines/reference/nonPrimitiveNarrow.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts(9,5): error TS2322: Type '123' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts(9,5): error TS2322: Type 'number' is not assignable to type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts(13,7): error TS2339: Property 'toFixed' does not exist on type 'never'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts(21,6): error TS2339: Property 'toString' does not exist on type 'never'. @@ -14,7 +14,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts(21,6): error TS a.narrowed; // ok a = 123; // error ~ -!!! error TS2322: Type '123' is not assignable to type 'object'. +!!! error TS2322: Type 'number' is not assignable to type 'object'. } if (typeof a === 'number') { diff --git a/tests/baselines/reference/nonPrimitiveUnionIntersection.errors.txt b/tests/baselines/reference/nonPrimitiveUnionIntersection.errors.txt index 38bff6c43198a..d4c970c5064f0 100644 --- a/tests/baselines/reference/nonPrimitiveUnionIntersection.errors.txt +++ b/tests/baselines/reference/nonPrimitiveUnionIntersection.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(1,5): error TS2322: Type '""' is not assignable to type 'never'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(3,5): error TS2322: Type '123' is not assignable to type 'object & {}'. - Type '123' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(1,5): error TS2322: Type 'string' is not assignable to type 'never'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(3,5): error TS2322: Type 'number' is not assignable to type 'object & {}'. + Type 'number' is not assignable to type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(4,1): error TS2322: Type 'string' is not assignable to type 'never'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(8,38): error TS2322: Type '{ bar: string; }' is not assignable to type 'object & { err: string; }'. Object literal may only specify known properties, and 'bar' does not exist in type 'object & { err: string; }'. @@ -9,12 +9,12 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(8,38 ==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts (4 errors) ==== var a: object & string = ""; // error ~ -!!! error TS2322: Type '""' is not assignable to type 'never'. +!!! error TS2322: Type 'string' is not assignable to type 'never'. var b: object | string = ""; // ok var c: object & {} = 123; // error ~ -!!! error TS2322: Type '123' is not assignable to type 'object & {}'. -!!! error TS2322: Type '123' is not assignable to type 'object'. +!!! error TS2322: Type 'number' is not assignable to type 'object & {}'. +!!! error TS2322: Type 'number' is not assignable to type 'object'. a = b; // error ~ !!! error TS2322: Type 'string' is not assignable to type 'never'. diff --git a/tests/baselines/reference/numberToString.errors.txt b/tests/baselines/reference/numberToString.errors.txt index bbd9178862aec..791319da214eb 100644 --- a/tests/baselines/reference/numberToString.errors.txt +++ b/tests/baselines/reference/numberToString.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/numberToString.ts(2,5): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/compiler/numberToString.ts(9,4): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +tests/cases/compiler/numberToString.ts(9,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/numberToString.ts (2 errors) ==== @@ -15,6 +15,6 @@ tests/cases/compiler/numberToString.ts(9,4): error TS2345: Argument of type '3' f1(3); f2(3); // error no coercion to string ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. f2(3+""); // ok + operator promotes \ No newline at end of file diff --git a/tests/baselines/reference/numberVsBigIntOperations.errors.txt b/tests/baselines/reference/numberVsBigIntOperations.errors.txt index ee2635338589d..42e49eb3304b7 100644 --- a/tests/baselines/reference/numberVsBigIntOperations.errors.txt +++ b/tests/baselines/reference/numberVsBigIntOperations.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/numberVsBigIntOperations.ts(3,14): error TS2322: Type '2' is not assignable to type 'bigint'. -tests/cases/compiler/numberVsBigIntOperations.ts(3,26): error TS2322: Type '1n' is not assignable to type 'number'. +tests/cases/compiler/numberVsBigIntOperations.ts(3,14): error TS2322: Type 'number' is not assignable to type 'bigint'. +tests/cases/compiler/numberVsBigIntOperations.ts(3,26): error TS2322: Type 'bigint' is not assignable to type 'number'. tests/cases/compiler/numberVsBigIntOperations.ts(4,15): error TS2365: Operator '+=' cannot be applied to types 'bigint' and '2'. tests/cases/compiler/numberVsBigIntOperations.ts(4,28): error TS2365: Operator '+=' cannot be applied to types 'number' and '1n'. tests/cases/compiler/numberVsBigIntOperations.ts(5,15): error TS2365: Operator '-=' cannot be applied to types 'bigint' and 'number'. @@ -69,9 +69,9 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,7): error TS1155: 'const' de let bigInt = 1n, num = 2; bigInt = 1n; bigInt = 2; num = 1n; num = 2; ~~~~~~ -!!! error TS2322: Type '2' is not assignable to type 'bigint'. +!!! error TS2322: Type 'number' is not assignable to type 'bigint'. ~~~ -!!! error TS2322: Type '1n' is not assignable to type 'number'. +!!! error TS2322: Type 'bigint' is not assignable to type 'number'. bigInt += 1n; bigInt += 2; num += 1n; num += 2; ~~~~~~~~~~~ !!! error TS2365: Operator '+=' cannot be applied to types 'bigint' and '2'. diff --git a/tests/baselines/reference/numericIndexExpressions.errors.txt b/tests/baselines/reference/numericIndexExpressions.errors.txt index da0993ffee3c3..2c3b8d76796fa 100644 --- a/tests/baselines/reference/numericIndexExpressions.errors.txt +++ b/tests/baselines/reference/numericIndexExpressions.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/numericIndexExpressions.ts(10,1): error TS2322: Type '4' is not assignable to type 'string'. -tests/cases/compiler/numericIndexExpressions.ts(11,1): error TS2322: Type '4' is not assignable to type 'string'. -tests/cases/compiler/numericIndexExpressions.ts(14,1): error TS2322: Type '4' is not assignable to type 'string'. -tests/cases/compiler/numericIndexExpressions.ts(15,1): error TS2322: Type '4' is not assignable to type 'string'. +tests/cases/compiler/numericIndexExpressions.ts(10,1): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/numericIndexExpressions.ts(11,1): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/numericIndexExpressions.ts(14,1): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/numericIndexExpressions.ts(15,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/numericIndexExpressions.ts (4 errors) ==== @@ -16,15 +16,15 @@ tests/cases/compiler/numericIndexExpressions.ts(15,1): error TS2322: Type '4' is var x: Numbers1; x[1] = 4; // error ~~~~ -!!! error TS2322: Type '4' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. x['1'] = 4; // error ~~~~~~ -!!! error TS2322: Type '4' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var y: Strings1; y['1'] = 4; // should be error ~~~~~~ -!!! error TS2322: Type '4' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. y[1] = 4; // should be error ~~~~ -!!! error TS2322: Type '4' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/objectCreate-errors.errors.txt b/tests/baselines/reference/objectCreate-errors.errors.txt index 12f62cc4d2cb3..7303795d93c15 100644 --- a/tests/baselines/reference/objectCreate-errors.errors.txt +++ b/tests/baselines/reference/objectCreate-errors.errors.txt @@ -1,23 +1,23 @@ -tests/cases/compiler/objectCreate-errors.ts(1,24): error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'. -tests/cases/compiler/objectCreate-errors.ts(2,24): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'. -tests/cases/compiler/objectCreate-errors.ts(3,24): error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(1,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(2,24): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(3,24): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'. tests/cases/compiler/objectCreate-errors.ts(4,24): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'. -tests/cases/compiler/objectCreate-errors.ts(7,24): error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'. -tests/cases/compiler/objectCreate-errors.ts(8,24): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'. -tests/cases/compiler/objectCreate-errors.ts(9,24): error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(7,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(8,24): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(9,24): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'. tests/cases/compiler/objectCreate-errors.ts(10,24): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'. ==== tests/cases/compiler/objectCreate-errors.ts (8 errors) ==== var e1 = Object.create(1); // Error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'. var e2 = Object.create("string"); // Error ~~~~~~~~ -!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'. var e3 = Object.create(false); // Error ~~~~~ -!!! error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'. var e4 = Object.create(undefined); // Error ~~~~~~~~~ !!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'. @@ -25,13 +25,13 @@ tests/cases/compiler/objectCreate-errors.ts(10,24): error TS2345: Argument of ty var e5 = Object.create(1, {}); // Error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'. var e6 = Object.create("string", {}); // Error ~~~~~~~~ -!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'. var e7 = Object.create(false, {}); // Error ~~~~~ -!!! error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'. var e8 = Object.create(undefined, {}); // Error ~~~~~~~~~ !!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'. \ No newline at end of file diff --git a/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt b/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt index 6948f080aef26..bd9e021494ca6 100644 --- a/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt +++ b/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts(5,24): error TS2345: Argument of type '123' is not assignable to parameter of type 'string'. +tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts(5,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts(6,2): error TS1128: Declaration or statement expected. @@ -9,7 +9,7 @@ tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts(6,2): error } function foo(x = new A(123)) { //should error, 123 is not string ~~~ -!!! error TS2345: Argument of type '123' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. }} ~ !!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/objectLitTargetTypeCallSite.errors.txt b/tests/baselines/reference/objectLitTargetTypeCallSite.errors.txt index 6ced1a767dedb..429a889c24784 100644 --- a/tests/baselines/reference/objectLitTargetTypeCallSite.errors.txt +++ b/tests/baselines/reference/objectLitTargetTypeCallSite.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/objectLitTargetTypeCallSite.ts(5,10): error TS2322: Type 'true' is not assignable to type 'number'. +tests/cases/compiler/objectLitTargetTypeCallSite.ts(5,10): error TS2322: Type 'boolean' is not assignable to type 'number'. ==== tests/cases/compiler/objectLitTargetTypeCallSite.ts (1 errors) ==== @@ -8,5 +8,5 @@ tests/cases/compiler/objectLitTargetTypeCallSite.ts(5,10): error TS2322: Type 't process({a:true,b:"y"}); ~ -!!! error TS2322: Type 'true' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. !!! related TS6500 tests/cases/compiler/objectLitTargetTypeCallSite.ts:1:23: The expected type comes from property 'a' which is declared here on type '{ a: number; b: string; }' \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralErrors.errors.txt b/tests/baselines/reference/objectLiteralErrors.errors.txt index 2a2dc7dd5753c..fa97ae0ddf406 100644 --- a/tests/baselines/reference/objectLiteralErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralErrors.errors.txt @@ -73,7 +73,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,46) tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,46): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(42,16): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(42,47): error TS2380: 'get' and 'set' accessor must have the same type. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,22): error TS2322: Type '4' is not assignable to type 'string'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,22): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,16): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,55): error TS2380: 'get' and 'set' accessor must have the same type. @@ -273,7 +273,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,55) !!! error TS2380: 'get' and 'set' accessor must have the same type. var g2 = { get a() { return 4; }, set a(n: string) { } }; ~~~~~~~~~ -!!! error TS2322: Type '4' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var g3 = { get a(): number { return undefined; }, set a(n: string) { } }; ~ !!! error TS2380: 'get' and 'set' accessor must have the same type. diff --git a/tests/baselines/reference/optionalBindingParameters1.errors.txt b/tests/baselines/reference/optionalBindingParameters1.errors.txt index 9ecf802f043a6..8d804791ccc4e 100644 --- a/tests/baselines/reference/optionalBindingParameters1.errors.txt +++ b/tests/baselines/reference/optionalBindingParameters1.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(1,14): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. -tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(7,6): error TS2322: Type 'false' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(7,6): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(7,16): error TS2322: Type 'string' is not assignable to type 'boolean'. @@ -14,6 +14,6 @@ tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(7,16): e foo([false, 0, ""]); ~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. ~~ !!! error TS2322: Type 'string' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalBindingParameters2.errors.txt b/tests/baselines/reference/optionalBindingParameters2.errors.txt index 80f93ca8b643b..1f218b7778571 100644 --- a/tests/baselines/reference/optionalBindingParameters2.errors.txt +++ b/tests/baselines/reference/optionalBindingParameters2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/destructuring/optionalBindingParameters2.ts(1,14): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. -tests/cases/conformance/es6/destructuring/optionalBindingParameters2.ts(7,7): error TS2322: Type 'false' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/optionalBindingParameters2.ts(7,7): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/optionalBindingParameters2.ts(7,23): error TS2322: Type 'string' is not assignable to type 'boolean'. @@ -14,7 +14,7 @@ tests/cases/conformance/es6/destructuring/optionalBindingParameters2.ts(7,23): e foo({ x: false, y: 0, z: "" }); ~ -!!! error TS2322: Type 'false' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. !!! related TS6500 tests/cases/conformance/es6/destructuring/optionalBindingParameters2.ts:1:30: The expected type comes from property 'x' which is declared here on type '{ x: string; y: number; z: boolean; }' ~ !!! error TS2322: Type 'string' is not assignable to type 'boolean'. diff --git a/tests/baselines/reference/optionalBindingParametersInOverloads1.errors.txt b/tests/baselines/reference/optionalBindingParametersInOverloads1.errors.txt index 5401ef79f2b1b..b999a62c169ff 100644 --- a/tests/baselines/reference/optionalBindingParametersInOverloads1.errors.txt +++ b/tests/baselines/reference/optionalBindingParametersInOverloads1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts(8,6): error TS2322: Type 'false' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts(8,6): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts(8,16): error TS2322: Type 'string' is not assignable to type 'boolean'. @@ -12,6 +12,6 @@ tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1. foo([false, 0, ""]); ~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. ~~ !!! error TS2322: Type 'string' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalBindingParametersInOverloads2.errors.txt b/tests/baselines/reference/optionalBindingParametersInOverloads2.errors.txt index 86913394da667..02accbde7a2cd 100644 --- a/tests/baselines/reference/optionalBindingParametersInOverloads2.errors.txt +++ b/tests/baselines/reference/optionalBindingParametersInOverloads2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads2.ts(8,7): error TS2322: Type 'false' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads2.ts(8,7): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads2.ts(8,23): error TS2322: Type 'string' is not assignable to type 'boolean'. @@ -12,7 +12,7 @@ tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads2. foo({ x: false, y: 0, z: "" }); ~ -!!! error TS2322: Type 'false' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. !!! related TS6500 tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads2.ts:1:30: The expected type comes from property 'x' which is declared here on type '{ x: string; y: number; z: boolean; }' ~ !!! error TS2322: Type 'string' is not assignable to type 'boolean'. diff --git a/tests/baselines/reference/overload1.errors.txt b/tests/baselines/reference/overload1.errors.txt index 0eec1066dc5ab..b5e3e2dc14dc4 100644 --- a/tests/baselines/reference/overload1.errors.txt +++ b/tests/baselines/reference/overload1.errors.txt @@ -5,9 +5,9 @@ tests/cases/compiler/overload1.ts(32,5): error TS2554: Expected 1-2 arguments, b tests/cases/compiler/overload1.ts(33,1): error TS2322: Type 'C' is not assignable to type 'string'. tests/cases/compiler/overload1.ts(34,3): error TS2769: No overload matches this call. Overload 1 of 2, '(s1: string, s2: number): string', gave the following error. - Argument of type '2' is not assignable to parameter of type 'string'. + Argument of type 'number' is not assignable to parameter of type 'string'. Overload 2 of 2, '(s1: number, s2: string): number', gave the following error. - Argument of type '2' is not assignable to parameter of type 'string'. + Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/overload1.ts (6 errors) ==== @@ -59,9 +59,9 @@ tests/cases/compiler/overload1.ts(34,3): error TS2769: No overload matches this ~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(s1: string, s2: number): string', gave the following error. -!!! error TS2769: Argument of type '2' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 2, '(s1: number, s2: string): number', gave the following error. -!!! error TS2769: Argument of type '2' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'. z=x.h("hello",0); // good var v=x.g; diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt b/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt index 457f7f5b3888f..d6471cf70feec 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(1,10): error TS2394: This overload signature is not compatible with its implementation signature. -tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(9,8): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(9,8): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/overloadOnConstNoAnyImplementation.ts (2 errors) ==== @@ -16,7 +16,7 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(9,8): error TS2345: A cb('uh'); cb(1); // error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. } var cb: (number) => number = (x: number) => 1; diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt index a954059a3d630..06b78c0224edf 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(6,5): error TS2394: This overload signature is not compatible with its implementation signature. -tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(12,18): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(12,18): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2345: Argument of type '(x: 'bye') => number' is not assignable to parameter of type '(x: "hi") => number'. Types of parameters 'x' and 'x' are incompatible. Type '"hi"' is not assignable to type '"bye"'. tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(21,9): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'. Types of parameters 'x' and 'x' are incompatible. - Type '"hi"' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts (4 errors) ==== @@ -25,7 +25,7 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(21,9): error TS2345: callback(hm); callback(1); // error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. } } @@ -42,4 +42,4 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(21,9): error TS2345: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'. !!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Type '"hi"' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2345: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt b/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt index 47b132158fb72..de26db811f976 100644 --- a/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt +++ b/tests/baselines/reference/overloadOnConstNoStringImplementation2.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(18,9): error TS23 Type '"hi"' is not assignable to type '"bye"'. tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(20,9): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'. Types of parameters 'x' and 'x' are incompatible. - Type '"hi"' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/overloadOnConstNoStringImplementation2.ts (2 errors) ==== @@ -34,4 +34,4 @@ tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(20,9): error TS23 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: "hi") => number'. !!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Type '"hi"' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2345: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadResolution.errors.txt b/tests/baselines/reference/overloadResolution.errors.txt index 676d7ba878916..efa3442b346e8 100644 --- a/tests/baselines/reference/overloadResolution.errors.txt +++ b/tests/baselines/reference/overloadResolution.errors.txt @@ -3,21 +3,21 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(27,5): e Argument of type '{}' is not assignable to parameter of type 'string'. Overload 2 of 2, '(s: number): number', gave the following error. Argument of type '{}' is not assignable to parameter of type 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(41,11): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(41,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(63,5): error TS2558: Expected 3 type arguments, but got 4. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,21): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,21): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(70,21): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(81,5): error TS2344: Type 'boolean' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(84,5): error TS2769: No overload matches this call. Overload 1 of 2, '(n: string, m: any): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. Overload 2 of 2, '(n: number, m: any): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(85,11): error TS2769: No overload matches this call. Overload 1 of 2, '(n: any, m: number): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. Overload 2 of 2, '(n: any, m: string): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): error TS2339: Property 'toFixed' does not exist on type 'string'. @@ -71,7 +71,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): // Generic and non - generic overload where non - generic overload is the only candidate when called with type arguments fn2('', 0); // Error ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments fn2('', 0); // OK @@ -104,10 +104,10 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): fn4('', 3); fn4(3, ''); // Error ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. fn4('', 3); // Error ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. fn4(3, ''); // Generic overloads with constraints called without type arguments but with types that satisfy the constraints @@ -126,16 +126,16 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(n: string, m: any): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 2, '(n: number, m: any): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. fn4(null, true); // Error ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(n: any, m: number): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 2, '(n: any, m: string): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. // Non - generic overloads where contextual typing of function arguments has errors function fn5(f: (n: string) => void): string; diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt b/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt index 7f40cb4846db4..c6f117e0f0ef5 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt @@ -6,14 +6,14 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstru tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(60,9): error TS2558: Expected 3 type arguments, but got 1. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(61,9): error TS2558: Expected 3 type arguments, but got 2. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(65,9): error TS2558: Expected 3 type arguments, but got 4. -tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(73,25): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(73,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(74,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(75,9): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(79,9): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(80,9): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(79,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(80,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(84,9): error TS2344: Type 'boolean' does not satisfy the constraint 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(87,9): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(88,15): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(87,9): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(88,15): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(96,18): error TS2339: Property 'toFixed' does not exist on type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(98,18): error TS2339: Property 'blah' does not exist on type 'string'. @@ -105,7 +105,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstru new fn4('', 3); new fn4(3, ''); // Error ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new fn4('', 3); // Error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'string'. @@ -117,10 +117,10 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstru new fn4('', 3); new fn4(3, ''); // Error ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new fn4(3, undefined); // Error ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new fn4('', null); // Generic overloads with constraints called with type arguments that do not satisfy the constraints @@ -131,10 +131,10 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstru // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints new fn4(true, null); // Error ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. new fn4(null, true); // Error ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. // Non - generic overloads where contextual typing of function arguments has errors class fn5 { diff --git a/tests/baselines/reference/overloadResolutionConstructors.errors.txt b/tests/baselines/reference/overloadResolutionConstructors.errors.txt index 11c5207534127..463ed8e00aa1b 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionConstructors.errors.txt @@ -3,21 +3,21 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors Argument of type '{}' is not assignable to parameter of type 'string'. Overload 2 of 2, '(s: number): number', gave the following error. Argument of type '{}' is not assignable to parameter of type 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(43,15): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(43,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(67,9): error TS2558: Expected 3 type arguments, but got 4. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,25): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,25): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(77,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(78,25): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(88,9): error TS2344: Type 'boolean' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(91,9): error TS2769: No overload matches this call. Overload 1 of 2, '(n: string, m: any): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. Overload 2 of 2, '(n: number, m: any): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(92,15): error TS2769: No overload matches this call. Overload 1 of 2, '(n: any, m: number): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. Overload 2 of 2, '(n: any, m: string): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,26): error TS2339: Property 'toFixed' does not exist on type 'string'. @@ -73,7 +73,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors // Generic and non - generic overload where non - generic overload is the only candidate when called with type arguments new fn2('', 0); // Error ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments new fn2('', 0); // OK @@ -111,10 +111,10 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors new fn4('', 3); new fn4(3, ''); // Error ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new fn4('', 3); // Error ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. new fn4(3, ''); // Generic overloads with constraints called without type arguments but with types that satisfy the constraints @@ -133,16 +133,16 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(n: string, m: any): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 2, '(n: number, m: any): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. new fn4(null, true); // Error ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(n: any, m: number): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 2, '(n: any, m: string): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. // Non - generic overloads where contextual typing of function arguments has errors interface fn5 { diff --git a/tests/baselines/reference/overloadResolutionTest1.errors.txt b/tests/baselines/reference/overloadResolutionTest1.errors.txt index cff94bda5ead1..e4a352fe71bde 100644 --- a/tests/baselines/reference/overloadResolutionTest1.errors.txt +++ b/tests/baselines/reference/overloadResolutionTest1.errors.txt @@ -10,9 +10,9 @@ tests/cases/compiler/overloadResolutionTest1.ts(18,16): error TS2769: No overloa Type 'string' is not assignable to type 'boolean'. tests/cases/compiler/overloadResolutionTest1.ts(24,15): error TS2769: No overload matches this call. Overload 1 of 2, '(bar: { a: number; }): number', gave the following error. - Type 'true' is not assignable to type 'number'. + Type 'boolean' is not assignable to type 'number'. Overload 2 of 2, '(bar: { a: string; }): string', gave the following error. - Type 'true' is not assignable to type 'string'. + Type 'boolean' is not assignable to type 'string'. ==== tests/cases/compiler/overloadResolutionTest1.ts (3 errors) ==== @@ -59,8 +59,8 @@ tests/cases/compiler/overloadResolutionTest1.ts(24,15): error TS2769: No overloa ~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(bar: { a: number; }): number', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'number'. +!!! error TS2769: Type 'boolean' is not assignable to type 'number'. !!! error TS2769: Overload 2 of 2, '(bar: { a: string; }): string', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'string'. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. !!! related TS6500 tests/cases/compiler/overloadResolutionTest1.ts:21:20: The expected type comes from property 'a' which is declared here on type '{ a: number; }' !!! related TS6500 tests/cases/compiler/overloadResolutionTest1.ts:22:20: The expected type comes from property 'a' which is declared here on type '{ a: string; }' \ No newline at end of file diff --git a/tests/baselines/reference/paramTagOnFunctionUsingArguments.errors.txt b/tests/baselines/reference/paramTagOnFunctionUsingArguments.errors.txt index bcbeb125338ce..efb1a30c7ac1a 100644 --- a/tests/baselines/reference/paramTagOnFunctionUsingArguments.errors.txt +++ b/tests/baselines/reference/paramTagOnFunctionUsingArguments.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsdoc/a.js(2,20): error TS8029: JSDoc '@param' tag has name 'first', but there is no parameter with that name. It would match 'arguments' if it had an array type. -tests/cases/conformance/jsdoc/a.js(19,9): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/conformance/jsdoc/a.js(19,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/conformance/jsdoc/decls.d.ts (0 errors) ==== @@ -27,5 +27,5 @@ tests/cases/conformance/jsdoc/a.js(19,9): error TS2345: Argument of type '1' is correct(1,2,3) // oh no ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt b/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt index 16eb82ecb34db..6f45030a6504b 100644 --- a/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt +++ b/tests/baselines/reference/parseClassDeclarationInStrictModeByDefaultInES6.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(4,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(5,17): error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode. tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. -tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS2322: Type '"hello"' is not assignable to type 'IArguments'. +tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS2322: Type 'string' is not assignable to type 'IArguments'. ==== tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts (4 errors) ==== @@ -18,6 +18,6 @@ tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeBy ~~~~~~~~~ !!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode. ~~~~~~~~~ -!!! error TS2322: Type '"hello"' is not assignable to type 'IArguments'. +!!! error TS2322: Type 'string' is not assignable to type 'IArguments'. } } \ No newline at end of file diff --git a/tests/baselines/reference/primitiveConstraints2.errors.txt b/tests/baselines/reference/primitiveConstraints2.errors.txt index 822846540f726..e571ee734179c 100644 --- a/tests/baselines/reference/primitiveConstraints2.errors.txt +++ b/tests/baselines/reference/primitiveConstraints2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/primitiveConstraints2.ts(8,11): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +tests/cases/compiler/primitiveConstraints2.ts(8,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/compiler/primitiveConstraints2.ts(9,8): error TS2344: Type 'string' does not satisfy the constraint 'number'. @@ -12,7 +12,7 @@ tests/cases/compiler/primitiveConstraints2.ts(9,8): error TS2344: Type 'string' var x = new C(); x.bar2(2, ""); // should error ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. x.bar2(2, ""); // should error ~~~~~~ !!! error TS2344: Type 'string' does not satisfy the constraint 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/privateNameFieldsESNext.errors.txt b/tests/baselines/reference/privateNameFieldsESNext.errors.txt index dcf0fc0319059..b87e9d592f250 100644 --- a/tests/baselines/reference/privateNameFieldsESNext.errors.txt +++ b/tests/baselines/reference/privateNameFieldsESNext.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/members/privateNames/privateNameFieldsESNext.ts(8,9): error TS2322: Type '"hello"' is not assignable to type 'number'. +tests/cases/conformance/classes/members/privateNames/privateNameFieldsESNext.ts(8,9): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/classes/members/privateNames/privateNameFieldsESNext.ts(11,5): error TS18019: 'static' modifier cannot be used with a private identifier tests/cases/conformance/classes/members/privateNames/privateNameFieldsESNext.ts(12,5): error TS18019: 'static' modifier cannot be used with a private identifier @@ -13,7 +13,7 @@ tests/cases/conformance/classes/members/privateNames/privateNameFieldsESNext.ts( console.log(this.#a); this.#a = "hello"; ~~~~~~~ -!!! error TS2322: Type '"hello"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. console.log(this.#b); } static #m = "test"; diff --git a/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.errors.txt b/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.errors.txt index 6c8b7319c9f28..4efd5d2049c74 100644 --- a/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.errors.txt +++ b/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.errors.txt @@ -1,4 +1,4 @@ -importHigher/root.ts(6,1): error TS2322: Type '"10"' is not assignable to type 'number'. +importHigher/root.ts(6,1): error TS2322: Type 'string' is not assignable to type 'number'. ==== importHigher/tsconfig.json (0 errors) ==== @@ -46,5 +46,5 @@ importHigher/root.ts(6,1): error TS2322: Type '"10"' is not assignable to type ' m1.f2.a = 10; m1.f2.person.age = "10"; // Error: Should be number (if direct import of m2 made the m3 module visible). ~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '"10"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.errors.txt b/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.errors.txt index 6c8b7319c9f28..4efd5d2049c74 100644 --- a/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.errors.txt +++ b/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.errors.txt @@ -1,4 +1,4 @@ -importHigher/root.ts(6,1): error TS2322: Type '"10"' is not assignable to type 'number'. +importHigher/root.ts(6,1): error TS2322: Type 'string' is not assignable to type 'number'. ==== importHigher/tsconfig.json (0 errors) ==== @@ -46,5 +46,5 @@ importHigher/root.ts(6,1): error TS2322: Type '"10"' is not assignable to type ' m1.f2.a = 10; m1.f2.person.age = "10"; // Error: Should be number (if direct import of m2 made the m3 module visible). ~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '"10"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt index 6ce02e5e232e0..ca38a9a5bcfc8 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt +++ b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt @@ -1,4 +1,4 @@ -maxDepthExceeded/root.ts(3,1): error TS2322: Type '"10"' is not assignable to type 'number'. +maxDepthExceeded/root.ts(3,1): error TS2322: Type 'string' is not assignable to type 'number'. maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a read-only property. @@ -33,7 +33,7 @@ maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it i m1.f1("test"); m1.f2.a = "10"; // Error: Should be number ~~~~~~~ -!!! error TS2322: Type '"10"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. m1.rel = 42; // Error: Should be boolean ~~~ !!! error TS2540: Cannot assign to 'rel' because it is a read-only property. diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt index 6ce02e5e232e0..ca38a9a5bcfc8 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt +++ b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt @@ -1,4 +1,4 @@ -maxDepthExceeded/root.ts(3,1): error TS2322: Type '"10"' is not assignable to type 'number'. +maxDepthExceeded/root.ts(3,1): error TS2322: Type 'string' is not assignable to type 'number'. maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a read-only property. @@ -33,7 +33,7 @@ maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it i m1.f1("test"); m1.f2.a = "10"; // Error: Should be number ~~~~~~~ -!!! error TS2322: Type '"10"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. m1.rel = 42; // Error: Should be boolean ~~~ !!! error TS2540: Cannot assign to 'rel' because it is a read-only property. diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.errors.txt b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.errors.txt index a0edfa3a5103d..0e8caa5830463 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.errors.txt +++ b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.errors.txt @@ -1,4 +1,4 @@ -maxDepthIncreased/root.ts(7,1): error TS2322: Type '"10"' is not assignable to type 'number'. +maxDepthIncreased/root.ts(7,1): error TS2322: Type 'string' is not assignable to type 'number'. ==== maxDepthIncreased/tsconfig.json (0 errors) ==== @@ -48,7 +48,7 @@ maxDepthIncreased/root.ts(7,1): error TS2322: Type '"10"' is not assignable to t m1.f2.person.age = "10"; // Should error if loaded the .js files correctly ~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '"10"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. let r2 = 3 + m4.foo; // Should be OK if correctly using the @types .d.ts file \ No newline at end of file diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.errors.txt b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.errors.txt index a0edfa3a5103d..0e8caa5830463 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.errors.txt +++ b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.errors.txt @@ -1,4 +1,4 @@ -maxDepthIncreased/root.ts(7,1): error TS2322: Type '"10"' is not assignable to type 'number'. +maxDepthIncreased/root.ts(7,1): error TS2322: Type 'string' is not assignable to type 'number'. ==== maxDepthIncreased/tsconfig.json (0 errors) ==== @@ -48,7 +48,7 @@ maxDepthIncreased/root.ts(7,1): error TS2322: Type '"10"' is not assignable to t m1.f2.person.age = "10"; // Should error if loaded the .js files correctly ~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '"10"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. let r2 = 3 + m4.foo; // Should be OK if correctly using the @types .d.ts file \ No newline at end of file diff --git a/tests/baselines/reference/qualify.errors.txt b/tests/baselines/reference/qualify.errors.txt index 87d2ad62657cd..b773de475bb28 100644 --- a/tests/baselines/reference/qualify.errors.txt +++ b/tests/baselines/reference/qualify.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/qualify.ts(21,13): error TS2322: Type '3' is not assignable to type 'I'. -tests/cases/compiler/qualify.ts(30,13): error TS2322: Type '3' is not assignable to type 'I2'. +tests/cases/compiler/qualify.ts(21,13): error TS2322: Type 'number' is not assignable to type 'I'. +tests/cases/compiler/qualify.ts(30,13): error TS2322: Type 'number' is not assignable to type 'I2'. tests/cases/compiler/qualify.ts(45,13): error TS2741: Property 'zeep' is missing in type 'I4' but required in type 'I3'. tests/cases/compiler/qualify.ts(46,13): error TS2740: Type 'I4' is missing the following properties from type 'I3[]': length, pop, push, concat, and 16 more. tests/cases/compiler/qualify.ts(47,13): error TS2322: Type 'I4' is not assignable to type '() => I3'. @@ -33,7 +33,7 @@ tests/cases/compiler/qualify.ts(58,5): error TS2741: Property 'p' is missing in export module U { var z:I=3; ~ -!!! error TS2322: Type '3' is not assignable to type 'I'. +!!! error TS2322: Type 'number' is not assignable to type 'I'. export interface I2 { q; } @@ -44,7 +44,7 @@ tests/cases/compiler/qualify.ts(58,5): error TS2741: Property 'p' is missing in export module U2 { var z:T.U.I2=3; ~ -!!! error TS2322: Type '3' is not assignable to type 'I2'. +!!! error TS2322: Type 'number' is not assignable to type 'I2'. } } diff --git a/tests/baselines/reference/recursiveFunctionTypes.errors.txt b/tests/baselines/reference/recursiveFunctionTypes.errors.txt index b2d21243089ef..2cdc58bdd05a4 100644 --- a/tests/baselines/reference/recursiveFunctionTypes.errors.txt +++ b/tests/baselines/reference/recursiveFunctionTypes.errors.txt @@ -1,29 +1,29 @@ -tests/cases/compiler/recursiveFunctionTypes.ts(1,28): error TS2322: Type '1' is not assignable to type '() => typeof fn'. +tests/cases/compiler/recursiveFunctionTypes.ts(1,28): error TS2322: Type 'number' is not assignable to type '() => typeof fn'. tests/cases/compiler/recursiveFunctionTypes.ts(3,5): error TS2322: Type '() => typeof fn' is not assignable to type 'number'. tests/cases/compiler/recursiveFunctionTypes.ts(4,5): error TS2322: Type '() => typeof fn' is not assignable to type '() => number'. Type '() => typeof fn' is not assignable to type 'number'. tests/cases/compiler/recursiveFunctionTypes.ts(11,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/compiler/recursiveFunctionTypes.ts(12,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/compiler/recursiveFunctionTypes.ts(17,5): error TS2322: Type '() => I' is not assignable to type 'number'. -tests/cases/compiler/recursiveFunctionTypes.ts(22,5): error TS2345: Argument of type '3' is not assignable to parameter of type '(t: typeof g) => void'. -tests/cases/compiler/recursiveFunctionTypes.ts(25,1): error TS2322: Type '3' is not assignable to type '() => any'. +tests/cases/compiler/recursiveFunctionTypes.ts(22,5): error TS2345: Argument of type 'number' is not assignable to parameter of type '(t: typeof g) => void'. +tests/cases/compiler/recursiveFunctionTypes.ts(25,1): error TS2322: Type 'number' is not assignable to type '() => any'. tests/cases/compiler/recursiveFunctionTypes.ts(30,10): error TS2394: This overload signature is not compatible with its implementation signature. tests/cases/compiler/recursiveFunctionTypes.ts(33,8): error TS2554: Expected 0-1 arguments, but got 2. -tests/cases/compiler/recursiveFunctionTypes.ts(34,4): error TS2345: Argument of type '""' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'. +tests/cases/compiler/recursiveFunctionTypes.ts(34,4): error TS2345: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'. tests/cases/compiler/recursiveFunctionTypes.ts(42,8): error TS2554: Expected 0-1 arguments, but got 2. tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2769: No overload matches this call. Overload 1 of 4, '(a: { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }): () => number', gave the following error. - Argument of type '""' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. + Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. Overload 2 of 4, '(a: number): number', gave the following error. - Argument of type '""' is not assignable to parameter of type 'number'. + Argument of type 'string' is not assignable to parameter of type 'number'. Overload 3 of 4, '(a?: { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }): { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }', gave the following error. - Argument of type '""' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. + Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. ==== tests/cases/compiler/recursiveFunctionTypes.ts (13 errors) ==== function fn(): typeof fn { return 1; } ~~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type '() => typeof fn'. +!!! error TS2322: Type 'number' is not assignable to type '() => typeof fn'. var x: number = fn; // error ~ @@ -57,12 +57,12 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2769: No overload } C.g(3); // error ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type '(t: typeof g) => void'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '(t: typeof g) => void'. var f4: () => typeof f4; f4 = 3; // error ~~ -!!! error TS2322: Type '3' is not assignable to type '() => any'. +!!! error TS2322: Type 'number' is not assignable to type '() => any'. function f5() { return f5; } @@ -78,7 +78,7 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2769: No overload !!! error TS2554: Expected 0-1 arguments, but got 2. f6(""); // ok (function takes an any param) ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'. f6(); // ok declare function f7(): typeof f7; @@ -93,9 +93,9 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2769: No overload ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 4, '(a: { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }): () => number', gave the following error. -!!! error TS2769: Argument of type '""' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. +!!! error TS2769: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. !!! error TS2769: Overload 2 of 4, '(a: number): number', gave the following error. -!!! error TS2769: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'string' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 3 of 4, '(a?: { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }): { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }', gave the following error. -!!! error TS2769: Argument of type '""' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. +!!! error TS2769: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'. f7(); // ok \ No newline at end of file diff --git a/tests/baselines/reference/recursiveTupleTypeInference.errors.txt b/tests/baselines/reference/recursiveTupleTypeInference.errors.txt index 6bf76030c8d6b..53ed377d2b7ab 100644 --- a/tests/baselines/reference/recursiveTupleTypeInference.errors.txt +++ b/tests/baselines/reference/recursiveTupleTypeInference.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/recursiveTupleTypeInference.ts(23,5): error TS2345: Argument of type '{ b: A; }' is not assignable to parameter of type 'G<{ b: unknown; }>'. Types of property 'b' are incompatible. Type 'A' is not assignable to type '[[[[[[[[[[[[any, "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"]'. - Type '"number"' is not assignable to type '[[[[[[[[[[[[any, "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"]'. + Type 'string' is not assignable to type '[[[[[[[[[[[[any, "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"]'. ==== tests/cases/compiler/recursiveTupleTypeInference.ts (1 errors) ==== @@ -32,5 +32,5 @@ tests/cases/compiler/recursiveTupleTypeInference.ts(23,5): error TS2345: Argumen !!! error TS2345: Argument of type '{ b: A; }' is not assignable to parameter of type 'G<{ b: unknown; }>'. !!! error TS2345: Types of property 'b' are incompatible. !!! error TS2345: Type 'A' is not assignable to type '[[[[[[[[[[[[any, "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"]'. -!!! error TS2345: Type '"number"' is not assignable to type '[[[[[[[[[[[[any, "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"]'. +!!! error TS2345: Type 'string' is not assignable to type '[[[[[[[[[[[[any, "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"], "null"]'. \ No newline at end of file diff --git a/tests/baselines/reference/recursiveTypeReferences1.errors.txt b/tests/baselines/reference/recursiveTypeReferences1.errors.txt index b3ab2e9b8663e..eeb8557b95646 100644 --- a/tests/baselines/reference/recursiveTypeReferences1.errors.txt +++ b/tests/baselines/reference/recursiveTypeReferences1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts(45,7): error TS2322: Type '42' is not assignable to type 'Box2'. +tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts(45,7): error TS2322: Type 'number' is not assignable to type 'Box2'. tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts(60,7): error TS2322: Type 'number' is not assignable to type 'string | RecArray'. tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts(66,8): error TS2322: Type 'number' is not assignable to type 'string | string[]'. tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeReferences1.ts(72,8): error TS2322: Type 'number' is not assignable to type 'string | (string | string[])[]'. @@ -60,7 +60,7 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeRefe const b20: Box2 = 42; // Error ~~~ -!!! error TS2322: Type '42' is not assignable to type 'Box2'. +!!! error TS2322: Type 'number' is not assignable to type 'Box2'. const b21: Box2 = { value: 42 }; const b22: Box2 = { value: { value: { value: 42 }}}; diff --git a/tests/baselines/reference/restParameterWithBindingPattern3.errors.txt b/tests/baselines/reference/restParameterWithBindingPattern3.errors.txt index 96f066ca194ad..0cf51f2c6453d 100644 --- a/tests/baselines/reference/restParameterWithBindingPattern3.errors.txt +++ b/tests/baselines/reference/restParameterWithBindingPattern3.errors.txt @@ -1,19 +1,19 @@ -tests/cases/compiler/restParameterWithBindingPattern3.ts(1,16): error TS2322: Type '1' is not assignable to type 'string'. -tests/cases/compiler/restParameterWithBindingPattern3.ts(1,23): error TS2322: Type 'true' is not assignable to type 'string'. +tests/cases/compiler/restParameterWithBindingPattern3.ts(1,16): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/restParameterWithBindingPattern3.ts(1,23): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/compiler/restParameterWithBindingPattern3.ts(3,23): error TS1186: A rest element cannot have an initializer. tests/cases/compiler/restParameterWithBindingPattern3.ts(5,30): error TS2493: Tuple type '[boolean, string, number]' of length '3' has no element at index '3'. tests/cases/compiler/restParameterWithBindingPattern3.ts(7,23): error TS2493: Tuple type '[boolean, string, number]' of length '3' has no element at index '3'. tests/cases/compiler/restParameterWithBindingPattern3.ts(9,19): error TS2322: Type '1' is not assignable to type 'boolean'. -tests/cases/compiler/restParameterWithBindingPattern3.ts(9,29): error TS2322: Type 'true' is not assignable to type 'string'. +tests/cases/compiler/restParameterWithBindingPattern3.ts(9,29): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/compiler/restParameterWithBindingPattern3.ts(9,48): error TS2566: A rest element cannot have a property name. ==== tests/cases/compiler/restParameterWithBindingPattern3.ts (8 errors) ==== function a(...[a = 1, b = true]: string[]) { } ~ -!!! error TS2322: Type '1' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. ~ -!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. function b(...[...foo = []]: string[]) { } ~ @@ -31,6 +31,6 @@ tests/cases/compiler/restParameterWithBindingPattern3.ts(9,48): error TS2566: A ~ !!! error TS2322: Type '1' is not assignable to type 'boolean'. ~ -!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. ~~~~ !!! error TS2566: A rest element cannot have a property name. \ No newline at end of file diff --git a/tests/baselines/reference/returnInConstructor1.errors.txt b/tests/baselines/reference/returnInConstructor1.errors.txt index 4bb776dc4a5f8..787e39dc71c98 100644 --- a/tests/baselines/reference/returnInConstructor1.errors.txt +++ b/tests/baselines/reference/returnInConstructor1.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2322: Type '1' is not assignable to type 'B'. +tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2322: Type 'number' is not assignable to type 'B'. tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. -tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2322: Type '"test"' is not assignable to type 'D'. +tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2322: Type 'string' is not assignable to type 'D'. tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/compiler/returnInConstructor1.ts(39,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/compiler/returnInConstructor1.ts(39,18): error TS2322: Type 'number' is not assignable to type 'string'. @@ -23,7 +23,7 @@ tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of constructor() { return 1; // error ~~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'B'. +!!! error TS2322: Type 'number' is not assignable to type 'B'. ~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } @@ -41,7 +41,7 @@ tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of constructor() { return "test"; // error ~~~~~~~~~~~~~~ -!!! error TS2322: Type '"test"' is not assignable to type 'D'. +!!! error TS2322: Type 'string' is not assignable to type 'D'. ~~~~~~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } diff --git a/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring.errors.txt b/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring.errors.txt index c22071d4b758f..cb22c03a20b60 100644 --- a/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring.errors.txt +++ b/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring.errors.txt @@ -1,13 +1,11 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(14,9): error TS2339: Property 's1' does not exist on type '{}'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(20,9): error TS2339: Property 's1' does not exist on type '{}'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(38,9): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(44,12): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(70,5): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(75,8): error TS2322: Type '5' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(38,9): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(44,12): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(70,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(75,8): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(80,5): error TS2322: Type '5' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(80,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(80,20): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,8): error TS2322: Type '5' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,8): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,19): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. Types of property 'x' are incompatible. @@ -17,7 +15,7 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,12): err tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): error TS1312: '=' can only be used in an object literal property inside a destructuring assignment. -==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts (15 errors) ==== +==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts (13 errors) ==== (function() { var s0; for ({ s0 = 5 } of [{ s0: 1 }]) { @@ -61,7 +59,7 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): err var s3: string; for ({ s3 = 5 } of [{ s3: "" }]) { ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. } }); @@ -69,7 +67,7 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): err var s3: string; for ({ s3:s3 = 5 } of [{ s3: "" }]) { ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. } }); @@ -97,15 +95,13 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): err let y1: string; ({ y1 = 5 } = {}) ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. }); (function() { let y1: string; ({ y1:y1 = 5 } = {}) ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. - ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. }); @@ -113,7 +109,7 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): err let y2: string, y3: { x: string }; ({ y2 = 5, y3 = { x: 1 } } = {}) ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. ~ !!! error TS2322: Type 'number' is not assignable to type 'string'. !!! related TS6500 tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts:79:24: The expected type comes from property 'x' which is declared here on type '{ x: string; }' @@ -123,8 +119,6 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): err let y2: string, y3: { x: string }; ({ y2:y2 = 5, y3:y3 = { x: 1 } } = {}) ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. - ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. ~~ !!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. diff --git a/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring_ES6.errors.txt b/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring_ES6.errors.txt index 48ce3922c475b..fb368df29c380 100644 --- a/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring_ES6.errors.txt +++ b/tests/baselines/reference/shorthandPropertyAssignmentsInDestructuring_ES6.errors.txt @@ -1,13 +1,11 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(14,9): error TS2339: Property 's1' does not exist on type '{}'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(20,9): error TS2339: Property 's1' does not exist on type '{}'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(38,9): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(44,12): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(70,5): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(75,8): error TS2322: Type '5' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(38,9): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(44,12): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(70,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(75,8): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(80,5): error TS2322: Type '5' is not assignable to type 'string'. +tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(80,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(80,20): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,8): error TS2322: Type '5' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,8): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,19): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. Types of property 'x' are incompatible. @@ -17,7 +15,7 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,12): tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14): error TS1312: '=' can only be used in an object literal property inside a destructuring assignment. -==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts (15 errors) ==== +==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts (13 errors) ==== (function() { var s0; for ({ s0 = 5 } of [{ s0: 1 }]) { @@ -61,7 +59,7 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14): var s3: string; for ({ s3 = 5 } of [{ s3: "" }]) { ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. } }); @@ -69,7 +67,7 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14): var s3: string; for ({ s3:s3 = 5 } of [{ s3: "" }]) { ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. } }); @@ -97,15 +95,13 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14): let y1: string; ({ y1 = 5 } = {}) ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. }); (function() { let y1: string; ({ y1:y1 = 5 } = {}) ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. - ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. }); @@ -113,7 +109,7 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14): let y2: string, y3: { x: string }; ({ y2 = 5, y3 = { x: 1 } } = {}) ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. ~ !!! error TS2322: Type 'number' is not assignable to type 'string'. !!! related TS6500 tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts:79:24: The expected type comes from property 'x' which is declared here on type '{ x: string; }' @@ -123,8 +119,6 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14): let y2: string, y3: { x: string }; ({ y2:y2 = 5, y3:y3 = { x: 1 } } = {}) ~~ -!!! error TS2322: Type '5' is not assignable to type 'string'. - ~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. ~~ !!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'. diff --git a/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt b/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt index 412599e79a646..6d3973b369fbd 100644 --- a/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt +++ b/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt @@ -4,14 +4,14 @@ tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(7,1): error TS2 Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'string'. Overload 2 of 2, '(a: string, cb: (x: number) => number): any', gave the following error. - Argument of type '1' is not assignable to parameter of type 'string'. + Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,1): error TS2769: No overload matches this call. Overload 1 of 2, '(a: number, cb: (x: number) => number): any', gave the following error. Argument of type '(x: 'hm') => number' is not assignable to parameter of type '(x: number) => number'. Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type '"hm"'. Overload 2 of 2, '(a: string, cb: (x: number) => number): any', gave the following error. - Argument of type '1' is not assignable to parameter of type 'string'. + Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts (2 errors) ==== @@ -29,7 +29,7 @@ tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,1): error TS2 !!! error TS2769: Types of parameters 'x' and 'x' are incompatible. !!! error TS2769: Type 'number' is not assignable to type 'string'. !!! error TS2769: Overload 2 of 2, '(a: string, cb: (x: number) => number): any', gave the following error. -!!! error TS2769: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'. x3(1, (x: 'hm') => 1); ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. @@ -38,4 +38,4 @@ tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,1): error TS2 !!! error TS2769: Types of parameters 'x' and 'x' are incompatible. !!! error TS2769: Type 'number' is not assignable to type '"hm"'. !!! error TS2769: Overload 2 of 2, '(a: string, cb: (x: number) => number): any', gave the following error. -!!! error TS2769: Argument of type '1' is not assignable to parameter of type 'string'. \ No newline at end of file +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index cd30931bcfe4a..7996f2807cf17 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -1,13 +1,13 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(11,11): error TS2769: No overload matches this call. Overload 1 of 6, '(this: (this: undefined, arg0: 10, arg1: string) => string, thisArg: undefined, arg0: 10, arg1: string): () => string', gave the following error. - Argument of type '20' is not assignable to parameter of type 'string'. + Argument of type 'number' is not assignable to parameter of type 'string'. Overload 2 of 6, '(this: (this: undefined, ...args: (10 | 20)[]) => string, thisArg: undefined, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. The 'this' context of type '(a: number, b: string) => string' is not assignable to method's 'this' of type '(this: undefined, ...args: (10 | 20)[]) => string'. Types of parameters 'b' and 'args' are incompatible. - Type '10 | 20' is not assignable to type 'string'. - Type '10' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(17,15): error TS2554: Expected 3 arguments, but got 2. -tests/cases/conformance/functions/strictBindCallApply1.ts(18,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(18,35): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(19,44): error TS2554: Expected 3 arguments, but got 4. tests/cases/conformance/functions/strictBindCallApply1.ts(22,32): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. Property '1' is missing in type '[number]' but required in type '[number, string]'. @@ -17,12 +17,12 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(24,32): error TS2345: Type '3' is not assignable to type '2'. tests/cases/conformance/functions/strictBindCallApply1.ts(41,11): error TS2769: No overload matches this call. Overload 1 of 6, '(this: (this: C, arg0: 10, arg1: string) => string, thisArg: C, arg0: 10, arg1: string): () => string', gave the following error. - Argument of type '20' is not assignable to parameter of type 'string'. + Argument of type 'number' is not assignable to parameter of type 'string'. Overload 2 of 6, '(this: (this: C, ...args: (10 | 20)[]) => string, thisArg: C, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. The 'this' context of type '(this: C, a: number, b: string) => string' is not assignable to method's 'this' of type '(this: C, ...args: (10 | 20)[]) => string'. Types of parameters 'b' and 'args' are incompatible. - Type '10 | 20' is not assignable to type 'string'. - Type '10' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(42,11): error TS2769: No overload matches this call. Overload 1 of 6, '(this: (this: C, a: number, b: string) => string, thisArg: C): (a: number, b: string) => string', gave the following error. Argument of type 'undefined' is not assignable to parameter of type 'C'. @@ -32,7 +32,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(42,11): error TS2769: Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/functions/strictBindCallApply1.ts(48,17): error TS2554: Expected 3 arguments, but got 2. -tests/cases/conformance/functions/strictBindCallApply1.ts(49,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(49,29): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(50,38): error TS2554: Expected 3 arguments, but got 4. tests/cases/conformance/functions/strictBindCallApply1.ts(51,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. tests/cases/conformance/functions/strictBindCallApply1.ts(54,26): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. @@ -41,14 +41,14 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(56,26): error TS2345: tests/cases/conformance/functions/strictBindCallApply1.ts(57,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. tests/cases/conformance/functions/strictBindCallApply1.ts(62,11): error TS2769: No overload matches this call. Overload 1 of 6, '(this: new (arg0: 10, arg1: string) => C, thisArg: any, arg0: 10, arg1: string): new () => C', gave the following error. - Argument of type '20' is not assignable to parameter of type 'string'. + Argument of type 'number' is not assignable to parameter of type 'string'. Overload 2 of 6, '(this: new (...args: (10 | 20)[]) => C, thisArg: any, ...args: (10 | 20)[]): new (...args: (10 | 20)[]) => C', gave the following error. The 'this' context of type 'typeof C' is not assignable to method's 'this' of type 'new (...args: (10 | 20)[]) => C'. Types of parameters 'b' and 'args' are incompatible. - Type '10 | 20' is not assignable to type 'string'. - Type '10' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(65,3): error TS2554: Expected 3 arguments, but got 2. -tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(67,24): error TS2554: Expected 3 arguments, but got 4. tests/cases/conformance/functions/strictBindCallApply1.ts(70,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. tests/cases/conformance/functions/strictBindCallApply1.ts(71,17): error TS2322: Type 'number' is not assignable to type 'string'. @@ -70,12 +70,12 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 6, '(this: (this: undefined, arg0: 10, arg1: string) => string, thisArg: undefined, arg0: 10, arg1: string): () => string', gave the following error. -!!! error TS2769: Argument of type '20' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 6, '(this: (this: undefined, ...args: (10 | 20)[]) => string, thisArg: undefined, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. !!! error TS2769: The 'this' context of type '(a: number, b: string) => string' is not assignable to method's 'this' of type '(this: undefined, ...args: (10 | 20)[]) => string'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. -!!! error TS2769: Type '10' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. let f04 = overloaded.bind(undefined); // typeof overloaded let f05 = generic.bind(undefined); // typeof generic @@ -86,7 +86,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2554: Expected 3 arguments, but got 2. let c02 = foo.call(undefined, 10, 20); // Error ~~ -!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. let c03 = foo.call(undefined, 10, "hello", 30); // Error ~~ !!! error TS2554: Expected 3 arguments, but got 4. @@ -124,12 +124,12 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 6, '(this: (this: C, arg0: 10, arg1: string) => string, thisArg: C, arg0: 10, arg1: string): () => string', gave the following error. -!!! error TS2769: Argument of type '20' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 6, '(this: (this: C, ...args: (10 | 20)[]) => string, thisArg: C, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. !!! error TS2769: The 'this' context of type '(this: C, a: number, b: string) => string' is not assignable to method's 'this' of type '(this: C, ...args: (10 | 20)[]) => string'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. -!!! error TS2769: Type '10' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. let f14 = c.foo.bind(undefined); // Error ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. @@ -150,7 +150,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2554: Expected 3 arguments, but got 2. let c12 = c.foo.call(c, 10, 20); // Error ~~ -!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. let c13 = c.foo.call(c, 10, "hello", 30); // Error ~~ !!! error TS2554: Expected 3 arguments, but got 4. @@ -179,12 +179,12 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 6, '(this: new (arg0: 10, arg1: string) => C, thisArg: any, arg0: 10, arg1: string): new () => C', gave the following error. -!!! error TS2769: Argument of type '20' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 6, '(this: new (...args: (10 | 20)[]) => C, thisArg: any, ...args: (10 | 20)[]): new (...args: (10 | 20)[]) => C', gave the following error. !!! error TS2769: The 'this' context of type 'typeof C' is not assignable to method's 'this' of type 'new (...args: (10 | 20)[]) => C'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. -!!! error TS2769: Type '10' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. C.call(c, 10, "hello"); C.call(c, 10); // Error @@ -192,7 +192,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2554: Expected 3 arguments, but got 2. C.call(c, 10, 20); // Error ~~ -!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. C.call(c, 10, "hello", 30); // Error ~~ !!! error TS2554: Expected 3 arguments, but got 4. diff --git a/tests/baselines/reference/stringLiteralsWithEqualityChecks03.errors.txt b/tests/baselines/reference/stringLiteralsWithEqualityChecks03.errors.txt index cbefbbac978bd..f182c6721cf54 100644 --- a/tests/baselines/reference/stringLiteralsWithEqualityChecks03.errors.txt +++ b/tests/baselines/reference/stringLiteralsWithEqualityChecks03.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(16,5): error TS2367: This condition will always return 'false' since the types '"foo"' and '"bar"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(19,5): error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. -tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(20,5): error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. +tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(20,5): error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(25,5): error TS2367: This condition will always return 'true' since the types '"foo"' and '"bar"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(28,5): error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. -tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5): error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. +tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5): error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap. ==== tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts (6 errors) ==== @@ -32,7 +32,7 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5 !!! error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. b = "bar" === y; ~~~~~~~~~~~ -!!! error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. +!!! error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap. b = x !== y; b = "foo" !== y @@ -47,5 +47,5 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5 !!! error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. b = "bar" !== y; ~~~~~~~~~~~ -!!! error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. +!!! error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap. \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralsWithEqualityChecks04.errors.txt b/tests/baselines/reference/stringLiteralsWithEqualityChecks04.errors.txt index 293abe0b5c565..3b8e39c3eb4a6 100644 --- a/tests/baselines/reference/stringLiteralsWithEqualityChecks04.errors.txt +++ b/tests/baselines/reference/stringLiteralsWithEqualityChecks04.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(16,5): error TS2367: This condition will always return 'false' since the types '"foo"' and '"bar"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(19,5): error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. -tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(20,5): error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. +tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(20,5): error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(25,5): error TS2367: This condition will always return 'true' since the types '"foo"' and '"bar"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(28,5): error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. -tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5): error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. +tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5): error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap. ==== tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts (6 errors) ==== @@ -32,7 +32,7 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5 !!! error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. b = "bar" == y; ~~~~~~~~~~ -!!! error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. +!!! error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap. b = x != y; b = "foo" != y @@ -47,5 +47,5 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5 !!! error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. b = "bar" != y; ~~~~~~~~~~ -!!! error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. +!!! error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap. \ No newline at end of file diff --git a/tests/baselines/reference/stringPropertyAccessWithError.errors.txt b/tests/baselines/reference/stringPropertyAccessWithError.errors.txt index 7cff28ee85de1..fef1613bc5fd6 100644 --- a/tests/baselines/reference/stringPropertyAccessWithError.errors.txt +++ b/tests/baselines/reference/stringPropertyAccessWithError.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/primitives/string/stringPropertyAccessWithError.ts(2,21): error TS2345: Argument of type '"invalid"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/primitives/string/stringPropertyAccessWithError.ts(2,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== tests/cases/conformance/types/primitives/string/stringPropertyAccessWithError.ts (1 errors) ==== var x = ''; var d = x['charAt']('invalid'); // error ~~~~~~~~~ -!!! error TS2345: Argument of type '"invalid"' is not assignable to parameter of type 'number'. \ No newline at end of file +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/superCallArgsMustMatch.errors.txt b/tests/baselines/reference/superCallArgsMustMatch.errors.txt index f5724a710d17e..06758b44fe696 100644 --- a/tests/baselines/reference/superCallArgsMustMatch.errors.txt +++ b/tests/baselines/reference/superCallArgsMustMatch.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/superCallArgsMustMatch.ts(17,15): error TS2345: Argument of type '"hi"' is not assignable to parameter of type 'number'. +tests/cases/compiler/superCallArgsMustMatch.ts(17,15): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ==== tests/cases/compiler/superCallArgsMustMatch.ts (1 errors) ==== @@ -20,7 +20,7 @@ tests/cases/compiler/superCallArgsMustMatch.ts(17,15): error TS2345: Argument of // which is instantiated with 'number' in the extends clause super("hi"); ~~~~ -!!! error TS2345: Argument of type '"hi"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. var x: number = this.foo; diff --git a/tests/baselines/reference/superCallAssignResult.errors.txt b/tests/baselines/reference/superCallAssignResult.errors.txt index 524866f28f180..bc9e2a0dc55d7 100644 --- a/tests/baselines/reference/superCallAssignResult.errors.txt +++ b/tests/baselines/reference/superCallAssignResult.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/superCallAssignResult.ts(8,9): error TS2322: Type '5' is not assignable to type 'void'. +tests/cases/compiler/superCallAssignResult.ts(8,9): error TS2322: Type 'number' is not assignable to type 'void'. ==== tests/cases/compiler/superCallAssignResult.ts (1 errors) ==== @@ -11,6 +11,6 @@ tests/cases/compiler/superCallAssignResult.ts(8,9): error TS2322: Type '5' is no var x = super(5); // Should be of type void, not E. x = 5; ~ -!!! error TS2322: Type '5' is not assignable to type 'void'. +!!! error TS2322: Type 'number' is not assignable to type 'void'. } } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty46.errors.txt b/tests/baselines/reference/symbolProperty46.errors.txt index 3756f2c52713e..68f86afc31549 100644 --- a/tests/baselines/reference/symbolProperty46.errors.txt +++ b/tests/baselines/reference/symbolProperty46.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/Symbols/symbolProperty46.ts(10,1): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/conformance/es6/Symbols/symbolProperty46.ts(10,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/es6/Symbols/symbolProperty46.ts (1 errors) ==== @@ -13,5 +13,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty46.ts(10,1): error TS2322: Typ (new C)[Symbol.hasInstance] = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. (new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty47.errors.txt b/tests/baselines/reference/symbolProperty47.errors.txt index 143d2405d0bea..3d2f39986397d 100644 --- a/tests/baselines/reference/symbolProperty47.errors.txt +++ b/tests/baselines/reference/symbolProperty47.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/Symbols/symbolProperty47.ts(3,9): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/conformance/es6/Symbols/symbolProperty47.ts(11,1): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(3,9): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty47.ts (2 errors) ==== @@ -7,7 +7,7 @@ tests/cases/conformance/es6/Symbols/symbolProperty47.ts(11,1): error TS2322: Typ get [Symbol.hasInstance]() { return ""; ~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } // Should take a string set [Symbol.hasInstance](x: number) { @@ -17,4 +17,4 @@ tests/cases/conformance/es6/Symbols/symbolProperty47.ts(11,1): error TS2322: Typ (new C)[Symbol.hasInstance] = 0; (new C)[Symbol.hasInstance] = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt index 433d4f9832ab2..d3ff842f8694e 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt @@ -19,9 +19,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(14,23): error TS2554: Expected 1-3 arguments, but got 4. tests/cases/conformance/es6/templates/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. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,24): error TS2554: Expected 1-3 arguments, but got 4. @@ -74,9 +74,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~~~ !!! 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 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. var y = foo `${1}${"2"}`; // {} var z = 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 ac2daf306547b..87a25723093fe 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt @@ -19,9 +19,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(14,23): error TS2554: Expected 1-3 arguments, but got 4. tests/cases/conformance/es6/templates/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. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(21,24): error TS2554: Expected 1-3 arguments, but got 4. @@ -74,9 +74,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~~~ !!! 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 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. var y = foo `${1}${"2"}`; // {} var z = foo `${1}${2}${3}`; // any (with error) ~ diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt index 8b08710d51d38..02076e2f86d3d 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt @@ -7,14 +7,14 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(44,1): error TS2554: Expected 2-4 arguments, but got 1. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(62,9): error TS2769: No overload matches this call. Overload 1 of 3, '(strs: TemplateStringsArray, n: string, m: any): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. Overload 2 of 3, '(strs: TemplateStringsArray, n: number, m: any): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,18): error TS2769: No overload matches this call. Overload 1 of 3, '(strs: TemplateStringsArray, n: any, m: number): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. Overload 2 of 3, '(strs: TemplateStringsArray, n: any, m: string): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(69,18): error TS2339: Property 'toFixed' does not exist on type 'string'. @@ -95,16 +95,16 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(strs: TemplateStringsArray, n: string, m: any): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 3, '(strs: TemplateStringsArray, n: number, m: any): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. fn4 `${ null }${ true }`; ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(strs: TemplateStringsArray, n: any, m: number): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 3, '(strs: TemplateStringsArray, n: any, m: string): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. // Non - generic overloads where contextual typing of function arguments has errors function fn5(strs: TemplateStringsArray, f: (n: string) => void): string; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.errors.txt index 3d0389b850201..ce1d826a7ca02 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.errors.txt @@ -7,14 +7,14 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(44,1): error TS2554: Expected 2-4 arguments, but got 1. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(62,9): error TS2769: No overload matches this call. Overload 1 of 3, '(strs: TemplateStringsArray, n: string, m: any): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. Overload 2 of 3, '(strs: TemplateStringsArray, n: number, m: any): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(63,18): error TS2769: No overload matches this call. Overload 1 of 3, '(strs: TemplateStringsArray, n: any, m: number): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. Overload 2 of 3, '(strs: TemplateStringsArray, n: any, m: string): any', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(69,18): error TS2551: Property 'toFixed' does not exist on type 'string'. Did you mean 'fixed'? @@ -95,16 +95,16 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(strs: TemplateStringsArray, n: string, m: any): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. !!! error TS2769: Overload 2 of 3, '(strs: TemplateStringsArray, n: number, m: any): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. fn4 `${ null }${ true }`; ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(strs: TemplateStringsArray, n: any, m: number): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 3, '(strs: TemplateStringsArray, n: any, m: string): any', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. // Non - generic overloads where contextual typing of function arguments has errors function fn5(strs: TemplateStringsArray, f: (n: string) => void): string; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt index ebd8383c0248f..78878f0676c3b 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(4,31): error TS2322: Type '"bad"' is not assignable to type 'number'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(4,31): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts (1 errors) ==== @@ -7,4 +7,4 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFuncti foo `${function (x: number) { x = "bad"; } }`; ~ -!!! error TS2322: Type '"bad"' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.errors.txt index 57f84840310de..ea424a00add33 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts(4,31): error TS2322: Type '"bad"' is not assignable to type 'number'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts(4,31): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts (1 errors) ==== @@ -7,4 +7,4 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFuncti foo `${function (x: number) { x = "bad"; } }`; ~ -!!! error TS2322: Type '"bad"' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplatesWithIncompleteTemplateExpressions3.errors.txt b/tests/baselines/reference/taggedTemplatesWithIncompleteTemplateExpressions3.errors.txt index f9ec9ba0ca391..ebe01c214001d 100644 --- a/tests/baselines/reference/taggedTemplatesWithIncompleteTemplateExpressions3.errors.txt +++ b/tests/baselines/reference/taggedTemplatesWithIncompleteTemplateExpressions3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions3.ts(5,18): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions3.ts(5,18): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions3.ts(5,23): error TS1109: Expression expected. @@ -9,6 +9,6 @@ tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions3.ts(5,23): // Incomplete call, not enough parameters. f `123qdawdrqw${ 1 }${ ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplatesWithIncompleteTemplateExpressions6.errors.txt b/tests/baselines/reference/taggedTemplatesWithIncompleteTemplateExpressions6.errors.txt index 15bcddb003370..d408020f97c04 100644 --- a/tests/baselines/reference/taggedTemplatesWithIncompleteTemplateExpressions6.errors.txt +++ b/tests/baselines/reference/taggedTemplatesWithIncompleteTemplateExpressions6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions6.ts(5,18): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions6.ts(5,18): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions6.ts(5,23): error TS1109: Expression expected. @@ -9,6 +9,6 @@ tests/cases/compiler/taggedTemplatesWithIncompleteTemplateExpressions6.ts(5,23): // Incomplete call, not enough parameters, at EOF. f `123qdawdrqw${ 1 }${ ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplatesWithTypeArguments2.errors.txt b/tests/baselines/reference/taggedTemplatesWithTypeArguments2.errors.txt index 1c64f402c48cc..1ee7243beaa47 100644 --- a/tests/baselines/reference/taggedTemplatesWithTypeArguments2.errors.txt +++ b/tests/baselines/reference/taggedTemplatesWithTypeArguments2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(13,30): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(13,30): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(15,11): error TS2347: Untyped function calls may not accept type arguments. tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(17,11): error TS2347: Untyped function calls may not accept type arguments. -tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(17,30): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(17,30): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(35,5): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(36,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(36,14): error TS2754: 'super' may not use type arguments. @@ -23,7 +23,7 @@ tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(36,34 const b = new tag `${"hello"} ${"world"}`(100, 200); ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. const c = new tag `${100} ${200}`("hello", "world"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -33,7 +33,7 @@ tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(36,34 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2347: Untyped function calls may not accept type arguments. ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. /** * Testing ASI. This should never parse as diff --git a/tests/baselines/reference/targetTypeBaseCalls.errors.txt b/tests/baselines/reference/targetTypeBaseCalls.errors.txt index 0ff253d138985..37a00c9798d91 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.errors.txt +++ b/tests/baselines/reference/targetTypeBaseCalls.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/targetTypeBaseCalls.ts(9,19): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/compiler/targetTypeBaseCalls.ts(13,23): error TS2322: Type '5' is not assignable to type 'string'. -tests/cases/compiler/targetTypeBaseCalls.ts(17,61): error TS2322: Type '5' is not assignable to type 'string'. +tests/cases/compiler/targetTypeBaseCalls.ts(9,19): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/targetTypeBaseCalls.ts(13,23): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/targetTypeBaseCalls.ts(17,61): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/targetTypeBaseCalls.ts (3 errors) ==== @@ -14,17 +14,17 @@ tests/cases/compiler/targetTypeBaseCalls.ts(17,61): error TS2322: Type '5' is no foo(function(s) { s = 5 }); // Error, can’t assign number to string ~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. new Foo(function(s) { s = 5 }); // error, if types are applied correctly ~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. class Bar extends Foo { constructor() { super(function(s) { s = 5 }) } } // error, if types are applied correctly ~ -!!! error TS2322: Type '5' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt index 402b32846998f..66c4c6e6b9982 100644 --- a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt +++ b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(1,27): error TS2322: Type '"bad"' is not assignable to type 'number'. +tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(1,27): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts (1 errors) ==== `${function (x: number) { x = "bad"; } }`; ~ -!!! error TS2322: Type '"bad"' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.errors.txt b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.errors.txt index f225154aab5f9..8c40523264701 100644 --- a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.errors.txt +++ b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts(1,27): error TS2322: Type '"bad"' is not assignable to type 'number'. +tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts(1,27): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.ts (1 errors) ==== `${function (x: number) { x = "bad"; } }`; ~ -!!! error TS2322: Type '"bad"' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt index 437ec2b15b27b..6c726e5e6f917 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt @@ -11,7 +11,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(62,97): er tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(63,110): error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(65,4): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(66,6): error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(66,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(67,10): error TS2554: Expected 1 arguments, but got 2. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(68,1): error TS2684: The 'this' context of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. Types of property 'y' are incompatible. @@ -19,16 +19,16 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(68,1): err tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(69,1): error TS2684: The 'this' context of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. Property 'y' is missing in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' but required in type '{ y: number; }'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(72,3): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(73,13): error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(73,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(74,17): error TS2554: Expected 1 arguments, but got 2. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(75,3): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(76,16): error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(76,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(77,20): error TS2554: Expected 1 arguments, but got 2. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(78,3): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(79,16): error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(79,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(80,20): error TS2554: Expected 1 arguments, but got 2. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(81,3): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(82,20): error TS2345: Argument of type '"wrong type 3"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(82,20): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(83,24): error TS2554: Expected 1 arguments, but got 2. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(86,5): error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'. The 'this' types of each signature are incompatible. @@ -187,7 +187,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:61:46: An argument for 'x' was not provided. ok.f('wrong type'); ~~~~~~~~~~~~ -!!! error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ok.f(13, 'too many arguments'); ~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. @@ -209,7 +209,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:9:24: An argument for 'm' was not provided. c.explicitC('wrong type'); ~~~~~~~~~~~~ -!!! error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. c.explicitC(13, 'too many arguments'); ~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. @@ -219,7 +219,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:3:30: An argument for 'm' was not provided. c.explicitThis('wrong type 2'); ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. c.explicitThis(14, 'too many arguments 2'); ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. @@ -229,7 +229,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:6:18: An argument for 'm' was not provided. c.implicitThis('wrong type 2'); ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. c.implicitThis(14, 'too many arguments 2'); ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. @@ -239,7 +239,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:12:41: An argument for 'm' was not provided. c.explicitProperty('wrong type 3'); ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '"wrong type 3"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. c.explicitProperty(15, 'too many arguments 3'); ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. diff --git a/tests/baselines/reference/ts-expect-error.errors.txt b/tests/baselines/reference/ts-expect-error.errors.txt index 7ffda9dbf1f9e..47f05a8973c4e 100644 --- a/tests/baselines/reference/ts-expect-error.errors.txt +++ b/tests/baselines/reference/ts-expect-error.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/directives/ts-expect-error.ts(4,1): error TS2578: Unused '@ts-expect-error' directive. tests/cases/conformance/directives/ts-expect-error.ts(10,1): error TS2578: Unused '@ts-expect-error' directive. -tests/cases/conformance/directives/ts-expect-error.ts(13,5): error TS2322: Type '"nope"' is not assignable to type 'number'. +tests/cases/conformance/directives/ts-expect-error.ts(13,5): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/directives/ts-expect-error.ts (3 errors) ==== @@ -22,7 +22,7 @@ tests/cases/conformance/directives/ts-expect-error.ts(13,5): error TS2322: Type var invalidPlain: number = 'nope'; ~~~~~~~~~~~~ -!!! error TS2322: Type '"nope"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var validPlain: string = 'nope'; \ No newline at end of file diff --git a/tests/baselines/reference/ts-ignore.errors.txt b/tests/baselines/reference/ts-ignore.errors.txt index d2e7aea2253ea..0d48c9a32a65c 100644 --- a/tests/baselines/reference/ts-ignore.errors.txt +++ b/tests/baselines/reference/ts-ignore.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/directives/ts-ignore.ts(13,5): error TS2322: Type '"nope"' is not assignable to type 'number'. +tests/cases/conformance/directives/ts-ignore.ts(13,5): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/directives/ts-ignore.ts (1 errors) ==== @@ -16,7 +16,7 @@ tests/cases/conformance/directives/ts-ignore.ts(13,5): error TS2322: Type '"nope var invalidPlain: number = 'nope'; ~~~~~~~~~~~~ -!!! error TS2322: Type '"nope"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var validPlain: string = 'nope'; \ No newline at end of file diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js index 2941e287b8264..c4cf7aea6bdc4 100644 --- a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js @@ -431,7 +431,7 @@ Output:: [12:01:18 AM] File change detected. Starting incremental compilation... -sample1/logic/index.ts:8:5 - error TS2322: Type '10' is not assignable to type 'string'. +sample1/logic/index.ts:8:5 - error TS2322: Type 'number' is not assignable to type 'string'. 8 let y: string = 10;    ~ @@ -493,13 +493,13 @@ Output:: [12:01:23 AM] File change detected. Starting incremental compilation... -sample1/core/index.ts:5:5 - error TS2322: Type '10' is not assignable to type 'string'. +sample1/core/index.ts:5:5 - error TS2322: Type 'number' is not assignable to type 'string'. 5 let x: string = 10;    ~ -sample1/logic/index.ts:8:5 - error TS2322: Type '10' is not assignable to type 'string'. +sample1/logic/index.ts:8:5 - error TS2322: Type 'number' is not assignable to type 'string'. 8 let y: string = 10;    ~ diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js index 6a7e8c1582df9..f836aad9bfcf8 100644 --- a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js @@ -432,7 +432,7 @@ Output:: [12:01:18 AM] File change detected. Starting incremental compilation... -sample1/logic/index.ts:8:5 - error TS2322: Type '10' is not assignable to type 'string'. +sample1/logic/index.ts:8:5 - error TS2322: Type 'number' is not assignable to type 'string'. 8 let y: string = 10;    ~ @@ -493,13 +493,13 @@ Output:: [12:01:23 AM] File change detected. Starting incremental compilation... -sample1/core/index.ts:5:5 - error TS2322: Type '10' is not assignable to type 'string'. +sample1/core/index.ts:5:5 - error TS2322: Type 'number' is not assignable to type 'string'. 5 let x: string = 10;    ~ -sample1/logic/index.ts:8:5 - error TS2322: Type '10' is not assignable to type 'string'. +sample1/logic/index.ts:8:5 - error TS2322: Type 'number' is not assignable to type 'string'. 8 let y: string = 10;    ~ diff --git a/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-incremental.js b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-incremental.js index 25580721de05f..38683519ba85b 100644 --- a/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-incremental.js +++ b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-incremental.js @@ -78,7 +78,7 @@ define(["require", "exports"], function (require, exports) { "length": 1, "code": 2322, "category": 1, - "messageText": "Type '20' is not assignable to type 'string'." + "messageText": "Type 'number' is not assignable to type 'string'." } ] ] @@ -89,7 +89,7 @@ define(["require", "exports"], function (require, exports) { Output:: -file2.ts:1:14 - error TS2322: Type '20' is not assignable to type 'string'. +file2.ts:1:14 - error TS2322: Type 'number' is not assignable to type 'string'. 1 export const y: string = 20;    ~ @@ -173,7 +173,7 @@ define(["require", "exports"], function (require, exports) { "length": 1, "code": 2322, "category": 1, - "messageText": "Type '20' is not assignable to type 'string'." + "messageText": "Type 'number' is not assignable to type 'string'." } ] ] @@ -184,7 +184,7 @@ define(["require", "exports"], function (require, exports) { Output:: -file2.ts:1:14 - error TS2322: Type '20' is not assignable to type 'string'. +file2.ts:1:14 - error TS2322: Type 'number' is not assignable to type 'string'. 1 export const y: string = 20;    ~ diff --git a/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-watch.js b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-watch.js index 542aa22177b0e..6b5182eb320b7 100644 --- a/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-watch.js +++ b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-watch.js @@ -79,7 +79,7 @@ define(["require", "exports"], function (require, exports) { "length": 1, "code": 2322, "category": 1, - "messageText": "Type '20' is not assignable to type 'string'." + "messageText": "Type 'number' is not assignable to type 'string'." } ] ] @@ -94,7 +94,7 @@ Output:: [12:00:23 AM] Starting compilation in watch mode... -file2.ts:1:14 - error TS2322: Type '20' is not assignable to type 'string'. +file2.ts:1:14 - error TS2322: Type 'number' is not assignable to type 'string'. 1 export const y: string = 20;    ~ @@ -190,7 +190,7 @@ define(["require", "exports"], function (require, exports) { "length": 1, "code": 2322, "category": 1, - "messageText": "Type '20' is not assignable to type 'string'." + "messageText": "Type 'number' is not assignable to type 'string'." } ] ] @@ -205,7 +205,7 @@ Output:: [12:00:34 AM] Starting compilation in watch mode... -file2.ts:1:14 - error TS2322: Type '20' is not assignable to type 'string'. +file2.ts:1:14 - error TS2322: Type 'number' is not assignable to type 'string'. 1 export const y: string = 20;    ~ diff --git a/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-incremental.js b/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-incremental.js index 078b23bbf88af..f18ae0b753a34 100644 --- a/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-incremental.js +++ b/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-incremental.js @@ -67,7 +67,7 @@ var y = 20; "length": 1, "code": 2322, "category": 1, - "messageText": "Type '20' is not assignable to type 'string'." + "messageText": "Type 'number' is not assignable to type 'string'." } ] ] @@ -78,7 +78,7 @@ var y = 20; Output:: -file2.ts:1:7 - error TS2322: Type '20' is not assignable to type 'string'. +file2.ts:1:7 - error TS2322: Type 'number' is not assignable to type 'string'. 1 const y: string = 20;    ~ @@ -157,7 +157,7 @@ var z = 10; "length": 1, "code": 2322, "category": 1, - "messageText": "Type '20' is not assignable to type 'string'." + "messageText": "Type 'number' is not assignable to type 'string'." } ] ] @@ -168,7 +168,7 @@ var z = 10; Output:: -file2.ts:1:7 - error TS2322: Type '20' is not assignable to type 'string'. +file2.ts:1:7 - error TS2322: Type 'number' is not assignable to type 'string'. 1 const y: string = 20;    ~ diff --git a/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-watch.js b/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-watch.js index 914e5b447f80c..a89fd0ac73be0 100644 --- a/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-watch.js +++ b/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-watch.js @@ -68,7 +68,7 @@ var y = 20; "length": 1, "code": 2322, "category": 1, - "messageText": "Type '20' is not assignable to type 'string'." + "messageText": "Type 'number' is not assignable to type 'string'." } ] ] @@ -83,7 +83,7 @@ Output:: [12:00:23 AM] Starting compilation in watch mode... -file2.ts:1:7 - error TS2322: Type '20' is not assignable to type 'string'. +file2.ts:1:7 - error TS2322: Type 'number' is not assignable to type 'string'. 1 const y: string = 20;    ~ @@ -174,7 +174,7 @@ var z = 10; "length": 1, "code": 2322, "category": 1, - "messageText": "Type '20' is not assignable to type 'string'." + "messageText": "Type 'number' is not assignable to type 'string'." } ] ] @@ -189,7 +189,7 @@ Output:: [12:00:34 AM] Starting compilation in watch mode... -file2.ts:1:7 - error TS2322: Type '20' is not assignable to type 'string'. +file2.ts:1:7 - error TS2322: Type 'number' is not assignable to type 'string'. 1 const y: string = 20;    ~ diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-correctly-when-declaration-emit-is-disabled-in-compiler-options.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-correctly-when-declaration-emit-is-disabled-in-compiler-options.js index d177992f2ef61..d62fc0c146401 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-correctly-when-declaration-emit-is-disabled-in-compiler-options.js +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-correctly-when-declaration-emit-is-disabled-in-compiler-options.js @@ -81,7 +81,7 @@ Output:: [12:00:28 AM] File change detected. Starting incremental compilation... -a.ts:2:6 - error TS2345: Argument of type '4' is not assignable to parameter of type 'string'. +a.ts:2:6 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. 2 test(4, 5);    ~ @@ -185,7 +185,7 @@ Output:: [12:00:38 AM] File change detected. Starting incremental compilation... -a.ts:2:9 - error TS2345: Argument of type '5' is not assignable to parameter of type 'string'. +a.ts:2:9 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. 2 test(4, 5);    ~ diff --git a/tests/baselines/reference/tsxAttributeResolution14.errors.txt b/tests/baselines/reference/tsxAttributeResolution14.errors.txt index 71b5e329f4868..84fa778968886 100644 --- a/tests/baselines/reference/tsxAttributeResolution14.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution14.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(13,28): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'true' is not assignable to type 'string | number'. +tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'boolean' is not assignable to type 'string | number'. ==== tests/cases/conformance/jsx/react.d.ts (0 errors) ==== @@ -31,7 +31,7 @@ tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'true' is not as // ok // error ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'true' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. !!! related TS6501 tests/cases/conformance/jsx/file.tsx:3:3: The expected type comes from this index signature. ) diff --git a/tests/baselines/reference/tsxAttributeResolution6.errors.txt b/tests/baselines/reference/tsxAttributeResolution6.errors.txt index c7d13ad918ca0..c8d8a3d55a839 100644 --- a/tests/baselines/reference/tsxAttributeResolution6.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(10,8): error TS2322: Type 'true' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(10,8): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(11,8): error TS2322: Type 'string' is not assignable to type 'boolean'. tests/cases/conformance/jsx/file.tsx(12,2): error TS2741: Property 'n' is missing in type '{}' but required in type '{ n: boolean; }'. @@ -15,7 +15,7 @@ tests/cases/conformance/jsx/file.tsx(12,2): error TS2741: Property 'n' is missin // Error ; ~ -!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:25: The expected type comes from property 's' which is declared here on type '{ n?: boolean; s?: string; }' ; ~ diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt index a5f36e5ed0844..3732b0f2aaee8 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/jsx/file.tsx(20,10): error TS2739: Type '{}' is missing the following properties from type 'PoisonedProp': x, y tests/cases/conformance/jsx/file.tsx(21,10): error TS2739: Type '{}' is missing the following properties from type 'PoisonedProp': x, y -tests/cases/conformance/jsx/file.tsx(22,19): error TS2322: Type 'true' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(22,19): error TS2322: Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(22,21): error TS2322: Type 'true' is not assignable to type '"2"'. tests/cases/conformance/jsx/file.tsx(23,10): error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'. Types of property 'x' are incompatible. @@ -37,7 +37,7 @@ tests/cases/conformance/jsx/file.tsx(24,40): error TS2322: Type '{ X: string; x: !!! error TS2739: Type '{}' is missing the following properties from type 'PoisonedProp': x, y let z = ; ~ -!!! error TS2322: Type 'true' is not assignable to type 'string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & PoisonedProp & { children?: ReactNode; }' ~ !!! error TS2322: Type 'true' is not assignable to type '"2"'. diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt index fc2edafc314ab..2513a3ba14c1c 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt @@ -16,7 +16,7 @@ tests/cases/conformance/jsx/file.tsx(14,31): error TS2769: No overload matches t Type '{ yy1: true; yy: number; }' is not assignable to type 'IntrinsicAttributes'. Property 'yy1' does not exist on type 'IntrinsicAttributes'. Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. - Type 'true' is not assignable to type 'string'. + Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(16,31): error TS2769: No overload matches this call. Overload 1 of 2, '(): Element', gave the following error. Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes'. @@ -33,7 +33,7 @@ tests/cases/conformance/jsx/file.tsx(17,13): error TS2769: No overload matches t Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/jsx/file.tsx(25,12): error TS2769: No overload matches this call. Overload 1 of 2, '(j: { "extra-data": string; }): Element', gave the following error. - Type 'true' is not assignable to type 'string'. + Type 'boolean' is not assignable to type 'string'. Overload 2 of 2, '(n: { yy: string; direction?: number; }): Element', gave the following error. Property 'yy' is missing in type '{ "extra-data": true; }' but required in type '{ yy: string; direction?: number; }'. tests/cases/conformance/jsx/file.tsx(26,12): error TS2769: No overload matches this call. @@ -44,9 +44,9 @@ tests/cases/conformance/jsx/file.tsx(26,12): error TS2769: No overload matches t Type 'string' is not assignable to type 'number'. tests/cases/conformance/jsx/file.tsx(33,12): error TS2769: No overload matches this call. Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. - Type 'true' is not assignable to type 'string'. + Type 'boolean' is not assignable to type 'string'. Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. - Type 'true' is not assignable to type 'string'. + Type 'boolean' is not assignable to type 'string'. Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error. Type 'string' is not assignable to type 'boolean'. tests/cases/conformance/jsx/file.tsx(34,12): error TS2769: No overload matches this call. @@ -113,7 +113,7 @@ tests/cases/conformance/jsx/file.tsx(36,12): error TS2769: No overload matches t !!! error TS2769: Type '{ yy1: true; yy: number; }' is not assignable to type 'IntrinsicAttributes'. !!! error TS2769: Property 'yy1' does not exist on type 'IntrinsicAttributes'. !!! error TS2769: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'string'. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:43: The expected type comes from property 'yy1' which is declared here on type 'IntrinsicAttributes & { yy: number; yy1: string; }' const c3 = ; // This is OK because all attribute are spread const c4 = ; // extra property; @@ -145,7 +145,7 @@ tests/cases/conformance/jsx/file.tsx(36,12): error TS2769: No overload matches t ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(j: { "extra-data": string; }): Element', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'string'. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. !!! error TS2769: Overload 2 of 2, '(n: { yy: string; direction?: number; }): Element', gave the following error. !!! error TS2769: Property 'yy' is missing in type '{ "extra-data": true; }' but required in type '{ yy: string; direction?: number; }'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:21:38: The expected type comes from property 'extra-data' which is declared here on type 'IntrinsicAttributes & { "extra-data": string; }' @@ -169,9 +169,9 @@ tests/cases/conformance/jsx/file.tsx(36,12): error TS2769: No overload matches t ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'string'. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. !!! error TS2769: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'string'. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. !!! error TS2769: Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error. !!! error TS2769: Type 'string' is not assignable to type 'boolean'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:28:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1?: string; y2?: number; }' diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt index 043763757f662..87a28a1ebd5a0 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt @@ -17,18 +17,18 @@ tests/cases/conformance/jsx/file.tsx(54,51): error TS2769: No overload matches t Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(55,68): error TS2769: No overload matches this call. Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. - Type 'true' is not assignable to type 'string'. + Type 'boolean' is not assignable to type 'string'. Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. - Type 'true' is not assignable to type 'string'. + Type 'boolean' is not assignable to type 'string'. Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. - Type 'true' is not assignable to type 'string'. + Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(56,12): error TS2769: No overload matches this call. Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. Property 'onClick' is missing in type '{ "data-format": true; }' but required in type 'ButtonProps'. Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. Property 'to' is missing in type '{ "data-format": true; }' but required in type 'LinkProps'. Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. - Type 'true' is not assignable to type 'string'. + Type 'boolean' is not assignable to type 'string'. ==== tests/cases/conformance/jsx/file.tsx (4 errors) ==== @@ -112,11 +112,11 @@ tests/cases/conformance/jsx/file.tsx(56,12): error TS2769: No overload matches t ~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'string'. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. !!! error TS2769: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'string'. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. !!! error TS2769: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'string'. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'className' which is declared here on type 'IntrinsicAttributes & ButtonProps' !!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'className' which is declared here on type 'IntrinsicAttributes & LinkProps' !!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'className' which is declared here on type 'IntrinsicAttributes & HyphenProps' @@ -128,7 +128,7 @@ tests/cases/conformance/jsx/file.tsx(56,12): error TS2769: No overload matches t !!! error TS2769: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. !!! error TS2769: Property 'to' is missing in type '{ "data-format": true; }' but required in type 'LinkProps'. !!! error TS2769: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. -!!! error TS2769: Type 'true' is not assignable to type 'string'. +!!! error TS2769: Type 'boolean' is not assignable to type 'string'. !!! related TS2728 tests/cases/conformance/jsx/file.tsx:9:5: 'onClick' is declared here. !!! related TS2728 tests/cases/conformance/jsx/file.tsx:13:5: 'to' is declared here. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:17:5: The expected type comes from property 'data-format' which is declared here on type 'IntrinsicAttributes & HyphenProps' \ No newline at end of file diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt index 7a6a6fbdcbacc..d31c2afc5607a 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(8,43): error TS2322: Type '10' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(8,43): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/jsx/file.tsx(13,15): error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes & { prop: unknown; "ignore-prop": string; }'. Type 'T' is not assignable to type '{ prop: unknown; "ignore-prop": string; }'. tests/cases/conformance/jsx/file.tsx(20,19): error TS2322: Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'. @@ -17,7 +17,7 @@ tests/cases/conformance/jsx/file.tsx(31,52): error TS2322: Type '(val: string) = function Bar(arg: T) { let a1 = ; ~~~~~~~~~~~ -!!! error TS2322: Type '10' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:53: The expected type comes from property 'ignore-prop' which is declared here on type 'IntrinsicAttributes & { prop: number; "ignore-prop": string; }' } diff --git a/tests/baselines/reference/tsxUnionElementType1.errors.txt b/tests/baselines/reference/tsxUnionElementType1.errors.txt index 1a5b6041baf41..f24ab4b787019 100644 --- a/tests/baselines/reference/tsxUnionElementType1.errors.txt +++ b/tests/baselines/reference/tsxUnionElementType1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(12,10): error TS2322: Type 'true' is not assignable to type 'never'. +tests/cases/conformance/jsx/file.tsx(12,10): error TS2322: Type 'boolean' is not assignable to type 'never'. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -15,4 +15,4 @@ tests/cases/conformance/jsx/file.tsx(12,10): error TS2322: Type 'true' is not as var SFCComp = SFC1 || SFC2; ~ -!!! error TS2322: Type 'true' is not assignable to type 'never'. \ No newline at end of file +!!! error TS2322: Type 'boolean' is not assignable to type 'never'. \ No newline at end of file diff --git a/tests/baselines/reference/tsxUnionElementType4.errors.txt b/tests/baselines/reference/tsxUnionElementType4.errors.txt index 40463bcbb7970..03cb6c62a526e 100644 --- a/tests/baselines/reference/tsxUnionElementType4.errors.txt +++ b/tests/baselines/reference/tsxUnionElementType4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(32,17): error TS2322: Type 'true' is not assignable to type 'never'. +tests/cases/conformance/jsx/file.tsx(32,17): error TS2322: Type 'boolean' is not assignable to type 'never'. tests/cases/conformance/jsx/file.tsx(33,21): error TS2322: Type '{ x: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. Property 'x' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. tests/cases/conformance/jsx/file.tsx(34,22): error TS2322: Type '{ prop: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { children?: ReactNode; }'. @@ -39,7 +39,7 @@ tests/cases/conformance/jsx/file.tsx(34,22): error TS2322: Type '{ prop: true; } // Error let a = ; ~ -!!! error TS2322: Type 'true' is not assignable to type 'never'. +!!! error TS2322: Type 'boolean' is not assignable to type 'never'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:36: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & { x: number; } & { children?: ReactNode; } & { x: string; } & { children?: ReactNode; }' let b = ~ diff --git a/tests/baselines/reference/typeArgInference2WithError.errors.txt b/tests/baselines/reference/typeArgInference2WithError.errors.txt index 796f49f343863..26259abf37b51 100644 --- a/tests/baselines/reference/typeArgInference2WithError.errors.txt +++ b/tests/baselines/reference/typeArgInference2WithError.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeArgInference2WithError.ts(7,14): error TS2345: Argument of type '"abc"' is not assignable to parameter of type 'Item'. +tests/cases/compiler/typeArgInference2WithError.ts(7,14): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Item'. ==== tests/cases/compiler/typeArgInference2WithError.ts (1 errors) ==== @@ -10,4 +10,4 @@ tests/cases/compiler/typeArgInference2WithError.ts(7,14): error TS2345: Argument var z7 = foo("abc", 5); // Error ~~~~~ -!!! error TS2345: Argument of type '"abc"' is not assignable to parameter of type 'Item'. \ No newline at end of file +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Item'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt b/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt index 6f27916eda0b7..1131b6e1a68cd 100644 --- a/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt +++ b/tests/baselines/reference/typeArgumentConstraintResolution1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/typeArgumentConstraintResolution1.ts(4,12): error TS2345: Argument of type '""' is not assignable to parameter of type 'Date'. -tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,12): error TS2345: Argument of type '""' is not assignable to parameter of type 'Date'. +tests/cases/compiler/typeArgumentConstraintResolution1.ts(4,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. +tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. ==== tests/cases/compiler/typeArgumentConstraintResolution1.ts (2 errors) ==== @@ -8,7 +8,7 @@ tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,12): error TS2345: function foo1(test: any) { } foo1(""); // should error ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'Date'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. @@ -17,5 +17,5 @@ tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,12): error TS2345: function foo2(test: any): any { return null; } foo2(""); // Type Date does not satisfy the constraint 'Number' for type parameter 'T extends Number' ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'Date'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt index c94caf60d7556..10efad436c4fb 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(25,35): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(25,35): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(61,39): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'string'. @@ -42,7 +42,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct new someGenerics1(3, 4); new someGenerics1(3, 4); // Error ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. new someGenerics1(3, 4); // Generic call with argument of function type whose parameter is of type parameter type diff --git a/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt b/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt index 47d5e82994c93..36a17e166a527 100644 --- a/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(3,31): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(3,31): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(7,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'string'. @@ -15,7 +15,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts function someGenerics1(n: T, m: number) { } someGenerics1(3, 4); // Error ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. // 2 parameter generic call with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(n: T, f: (x: U) => void) { } diff --git a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt index aaa5cad857cc3..c415f5d9a493d 100644 --- a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt +++ b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(2,15): error TS2558: Expected 0 type arguments, but got 1. -tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): error TS2558: Expected 0 type arguments, but got 1. @@ -11,8 +11,8 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): erro !!! error TS2558: Expected 0 type arguments, but got 1. var r2 = f(1); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r3 = f(null); ~~~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt b/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt index 24a79443689e0..ef3806514ca34 100644 --- a/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt +++ b/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeAssertionToGenericFunctionType.ts(5,13): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/typeAssertionToGenericFunctionType.ts(5,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/typeAssertionToGenericFunctionType.ts(6,3): error TS2554: Expected 1 arguments, but got 0. @@ -9,7 +9,7 @@ tests/cases/compiler/typeAssertionToGenericFunctionType.ts(6,3): error TS2554: E } x.a(1); // bug was that this caused 'Could not find symbol T' on return type T in the type assertion on x.a's definition ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. x.b(); // error ~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. diff --git a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.errors.txt b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.errors.txt index 8df09b665131d..e8c9bd6fc2025 100644 --- a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.errors.txt +++ b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeCheckingInsideFunctionExpressionInArray.ts(2,7): error TS2322: Type '10' is not assignable to type 'string'. +tests/cases/compiler/typeCheckingInsideFunctionExpressionInArray.ts(2,7): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/typeCheckingInsideFunctionExpressionInArray.ts(3,5): error TS2322: Type 'Object' is not assignable to type 'string'. tests/cases/compiler/typeCheckingInsideFunctionExpressionInArray.ts(4,15): error TS2339: Property 'NonexistantMethod' does not exist on type 'number[]'. tests/cases/compiler/typeCheckingInsideFunctionExpressionInArray.ts(5,5): error TS2304: Cannot find name 'derp'. @@ -8,7 +8,7 @@ tests/cases/compiler/typeCheckingInsideFunctionExpressionInArray.ts(5,5): error var functions = [function () { var k: string = 10; ~ -!!! error TS2322: Type '10' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. k = new Object(); ~ !!! error TS2322: Type 'Object' is not assignable to type 'string'. diff --git a/tests/baselines/reference/typeFromJSConstructor.errors.txt b/tests/baselines/reference/typeFromJSConstructor.errors.txt index ffcf5393f516d..9124b5044d267 100644 --- a/tests/baselines/reference/typeFromJSConstructor.errors.txt +++ b/tests/baselines/reference/typeFromJSConstructor.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/salsa/a.js(10,5): error TS7008: Member 'twices' implicitly has an 'any[]' type. -tests/cases/conformance/salsa/a.js(14,5): error TS2322: Type '"hi"' is not assignable to type 'number'. -tests/cases/conformance/salsa/a.js(21,5): error TS2322: Type 'false' is not assignable to type 'number'. +tests/cases/conformance/salsa/a.js(14,5): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/salsa/a.js(21,5): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/salsa/a.js(24,5): error TS2322: Type 'null' is not assignable to type 'string | undefined'. -tests/cases/conformance/salsa/a.js(25,5): error TS2322: Type 'false' is not assignable to type 'string | undefined'. +tests/cases/conformance/salsa/a.js(25,5): error TS2322: Type 'boolean' is not assignable to type 'string | undefined'. tests/cases/conformance/salsa/a.js(26,5): error TS2531: Object is possibly 'null'. @@ -24,7 +24,7 @@ tests/cases/conformance/salsa/a.js(26,5): error TS2531: Object is possibly 'null Installer.prototype.first = function () { this.arg = 'hi' // error ~~~~~~~~ -!!! error TS2322: Type '"hi"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. this.unknown = 'hi' // ok this.newProperty = 1 // ok: number | boolean this.twice = undefined // ok @@ -33,7 +33,7 @@ tests/cases/conformance/salsa/a.js(26,5): error TS2531: Object is possibly 'null Installer.prototype.second = function () { this.arg = false // error ~~~~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. this.unknown = false // ok this.newProperty = false // ok this.twice = null // error @@ -41,7 +41,7 @@ tests/cases/conformance/salsa/a.js(26,5): error TS2531: Object is possibly 'null !!! error TS2322: Type 'null' is not assignable to type 'string | undefined'. this.twice = false // error ~~~~~~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'string | undefined'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | undefined'. this.twices.push(1) // error: Object is possibly null ~~~~~~~~~~~ !!! error TS2531: Object is possibly 'null'. diff --git a/tests/baselines/reference/typeFromJSInitializer.errors.txt b/tests/baselines/reference/typeFromJSInitializer.errors.txt index 08d66a2a9f388..91ab058fac35d 100644 --- a/tests/baselines/reference/typeFromJSInitializer.errors.txt +++ b/tests/baselines/reference/typeFromJSInitializer.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/salsa/a.js(4,5): error TS7008: Member 'unknowable' impli tests/cases/conformance/salsa/a.js(5,5): error TS7008: Member 'empty' implicitly has an 'any[]' type. tests/cases/conformance/salsa/a.js(25,12): error TS7006: Parameter 'a' implicitly has an 'any' type. tests/cases/conformance/salsa/a.js(25,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. -tests/cases/conformance/salsa/a.js(37,5): error TS2322: Type '"error"' is not assignable to type 'number | undefined'. +tests/cases/conformance/salsa/a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number | undefined'. ==== tests/cases/conformance/salsa/a.js (6 errors) ==== @@ -55,7 +55,7 @@ tests/cases/conformance/salsa/a.js(37,5): error TS2322: Type '"error"' is not as b = undefined b = 'error' ~ -!!! error TS2322: Type '"error"' is not assignable to type 'number | undefined'. +!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. // l should be any[] l.push(1) diff --git a/tests/baselines/reference/typeFromPropertyAssignment22.errors.txt b/tests/baselines/reference/typeFromPropertyAssignment22.errors.txt index e688c37e30e04..96c63b7e561ca 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment22.errors.txt +++ b/tests/baselines/reference/typeFromPropertyAssignment22.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/salsa/npm-install.js(7,9): error TS2322: Type '"hi"' is not assignable to type 'number'. +tests/cases/conformance/salsa/npm-install.js(7,9): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/salsa/npm-install.js (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/salsa/npm-install.js(7,9): error TS2322: Type '"hi"' is (args) => { this.args = 'hi' ~~~~~~~~~ -!!! error TS2322: Type '"hi"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. this.newProperty = 1 } } diff --git a/tests/baselines/reference/typeFromPropertyAssignment31.errors.txt b/tests/baselines/reference/typeFromPropertyAssignment31.errors.txt index 6055e89ffec3f..60de71e5592a5 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment31.errors.txt +++ b/tests/baselines/reference/typeFromPropertyAssignment31.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/salsa/typeFromPropertyAssignment31.ts(13,1): error TS2322: Type 'false' is not assignable to type 'number'. -tests/cases/conformance/salsa/typeFromPropertyAssignment31.ts(25,1): error TS2322: Type 'false' is not assignable to type 'number'. +tests/cases/conformance/salsa/typeFromPropertyAssignment31.ts(13,1): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/salsa/typeFromPropertyAssignment31.ts(25,1): error TS2322: Type 'boolean' is not assignable to type 'number'. ==== tests/cases/conformance/salsa/typeFromPropertyAssignment31.ts (2 errors) ==== @@ -17,7 +17,7 @@ tests/cases/conformance/salsa/typeFromPropertyAssignment31.ts(25,1): error TS232 ExpandoMerge.p6 = 66666; // ok ExpandoMerge.p8 = false; // type error ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. namespace ExpandoMerge { export var p3 = 333; export var p4 = 4; @@ -31,6 +31,6 @@ tests/cases/conformance/salsa/typeFromPropertyAssignment31.ts(25,1): error TS232 ExpandoMerge.p7 = 777777; // ok ExpandoMerge.p9 = false; // type error ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. var n = ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001); \ No newline at end of file diff --git a/tests/baselines/reference/typeFromPropertyAssignment32.errors.txt b/tests/baselines/reference/typeFromPropertyAssignment32.errors.txt index bd8d4b003d87d..b2a0abe1e0f26 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment32.errors.txt +++ b/tests/baselines/reference/typeFromPropertyAssignment32.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/salsa/expando.ts(12,1): error TS2322: Type 'false' is not assignable to type 'number'. -tests/cases/conformance/salsa/expando.ts(13,1): error TS2322: Type 'false' is not assignable to type 'number'. +tests/cases/conformance/salsa/expando.ts(12,1): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/salsa/expando.ts(13,1): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/salsa/ns.ts(1,11): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. tests/cases/conformance/salsa/ns.ts(10,11): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. @@ -18,10 +18,10 @@ tests/cases/conformance/salsa/ns.ts(10,11): error TS2433: A namespace declaratio ExpandoMerge.p7 = 777777; ExpandoMerge.p8 = false; // type error ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. ExpandoMerge.p9 = false; // type error ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. var n = ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001); ==== tests/cases/conformance/salsa/ns.ts (2 errors) ==== diff --git a/tests/baselines/reference/typeFromPropertyAssignment33.errors.txt b/tests/baselines/reference/typeFromPropertyAssignment33.errors.txt index a4617c3d26aeb..4fd19d788425a 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment33.errors.txt +++ b/tests/baselines/reference/typeFromPropertyAssignment33.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/salsa/expando.ts(12,1): error TS2322: Type 'false' is not assignable to type 'number'. -tests/cases/conformance/salsa/expando.ts(13,1): error TS2322: Type 'false' is not assignable to type 'number'. +tests/cases/conformance/salsa/expando.ts(12,1): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/salsa/expando.ts(13,1): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/salsa/ns.ts(1,11): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. tests/cases/conformance/salsa/ns.ts(10,11): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. @@ -37,10 +37,10 @@ tests/cases/conformance/salsa/ns.ts(10,11): error TS2433: A namespace declaratio ExpandoMerge.p7 = 777777; ExpandoMerge.p8 = false; // type error ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. ExpandoMerge.p9 = false; // type error ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'false' is not assignable to type 'number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. var n = ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001); \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt index 2f3e7eb1862ed..59b105eede5e9 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt @@ -40,7 +40,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,22) tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,25): error TS1005: ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,27): error TS1005: ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(103,25): error TS1228: A type predicate is only allowed in return type position for functions and methods. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(104,9): error TS2322: Type 'true' is not assignable to type 'D'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(104,9): error TS2322: Type 'boolean' is not assignable to type 'D'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(104,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(106,20): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(109,20): error TS1228: A type predicate is only allowed in return type position for functions and methods. @@ -255,7 +255,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54 !!! error TS1228: A type predicate is only allowed in return type position for functions and methods. return true; ~~~~~~~~~~~~ -!!! error TS2322: Type 'true' is not assignable to type 'D'. +!!! error TS2322: Type 'boolean' is not assignable to type 'D'. ~~~~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt index a15eed1a8683e..ab4d3f61fcd73 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(12,10): error TS2339: Property 'bar' does not exist on type 'A'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(18,10): error TS2339: Property 'bar' does not exist on type 'A'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(33,5): error TS2322: Type '"str"' is not assignable to type 'number'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(33,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(34,10): error TS2339: Property 'bar' does not exist on type 'B'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(41,10): error TS2339: Property 'bar' does not exist on type 'B'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2339: Property 'bar2' does not exist on type 'C1'. @@ -65,7 +65,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru obj3.foo = 1; obj3.foo = "str"; ~~~~~~~~ -!!! error TS2322: Type '"str"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. obj3.bar = "str"; ~~~ !!! error TS2339: Property 'bar' does not exist on type 'B'. diff --git a/tests/baselines/reference/typeName1.errors.txt b/tests/baselines/reference/typeName1.errors.txt index 6d65f1d83c325..28c88a45ca0d6 100644 --- a/tests/baselines/reference/typeName1.errors.txt +++ b/tests/baselines/reference/typeName1.errors.txt @@ -1,19 +1,19 @@ -tests/cases/compiler/typeName1.ts(9,5): error TS2322: Type '3' is not assignable to type '{ f(s: string): number; f(n: number): string; }'. -tests/cases/compiler/typeName1.ts(10,5): error TS2322: Type '3' is not assignable to type '{ f(s: string): number; }'. -tests/cases/compiler/typeName1.ts(11,5): error TS2322: Type '3' is not assignable to type '{ (s: string): number; (n: number): string; }'. -tests/cases/compiler/typeName1.ts(12,5): error TS2322: Type '3' is not assignable to type '{ x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. -tests/cases/compiler/typeName1.ts(13,5): error TS2322: Type '3' is not assignable to type '{ (s: string): number; (n: number): string; x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. -tests/cases/compiler/typeName1.ts(14,5): error TS2322: Type '3' is not assignable to type '{ z: number; f: { (n: number): string; (s: string): number; }; }'. -tests/cases/compiler/typeName1.ts(15,5): error TS2322: Type '3' is not assignable to type '(s: string) => boolean'. -tests/cases/compiler/typeName1.ts(16,5): error TS2322: Type '3' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'. +tests/cases/compiler/typeName1.ts(9,5): error TS2322: Type 'number' is not assignable to type '{ f(s: string): number; f(n: number): string; }'. +tests/cases/compiler/typeName1.ts(10,5): error TS2322: Type 'number' is not assignable to type '{ f(s: string): number; }'. +tests/cases/compiler/typeName1.ts(11,5): error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; }'. +tests/cases/compiler/typeName1.ts(12,5): error TS2322: Type 'number' is not assignable to type '{ x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. +tests/cases/compiler/typeName1.ts(13,5): error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. +tests/cases/compiler/typeName1.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ z: number; f: { (n: number): string; (s: string): number; }; }'. +tests/cases/compiler/typeName1.ts(15,5): error TS2322: Type 'number' is not assignable to type '(s: string) => boolean'. +tests/cases/compiler/typeName1.ts(16,5): error TS2322: Type 'number' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'. tests/cases/compiler/typeName1.ts(16,10): error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'. -tests/cases/compiler/typeName1.ts(17,5): error TS2322: Type '3' is not assignable to type 'I'. -tests/cases/compiler/typeName1.ts(18,5): error TS2322: Type '3' is not assignable to type 'I[][][][]'. -tests/cases/compiler/typeName1.ts(19,5): error TS2322: Type '3' is not assignable to type '{ z: I; x: boolean; }[][]'. -tests/cases/compiler/typeName1.ts(20,5): error TS2322: Type '3' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }; }[][]'. +tests/cases/compiler/typeName1.ts(17,5): error TS2322: Type 'number' is not assignable to type 'I'. +tests/cases/compiler/typeName1.ts(18,5): error TS2322: Type 'number' is not assignable to type 'I[][][][]'. +tests/cases/compiler/typeName1.ts(19,5): error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; }[][]'. +tests/cases/compiler/typeName1.ts(20,5): error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }; }[][]'. tests/cases/compiler/typeName1.ts(20,50): error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'. -tests/cases/compiler/typeName1.ts(21,5): error TS2322: Type '3' is not assignable to type '{ (): {}; new (): number; new (n: number): number; x: string; w: { y: number; }; }'. -tests/cases/compiler/typeName1.ts(22,5): error TS2322: Type '3' is not assignable to type '{ (): string; f(x: number): boolean; p: any; q: any; }'. +tests/cases/compiler/typeName1.ts(21,5): error TS2322: Type 'number' is not assignable to type '{ (): {}; new (): number; new (n: number): number; x: string; w: { y: number; }; }'. +tests/cases/compiler/typeName1.ts(22,5): error TS2322: Type 'number' is not assignable to type '{ (): string; f(x: number): boolean; p: any; q: any; }'. tests/cases/compiler/typeName1.ts(23,5): error TS2322: Type 'typeof C' is not assignable to type 'number'. @@ -28,50 +28,50 @@ tests/cases/compiler/typeName1.ts(23,5): error TS2322: Type 'typeof C' is not as var x1:{ f(s:string):number;f(n:number):string; }=3; ~~ -!!! error TS2322: Type '3' is not assignable to type '{ f(s: string): number; f(n: number): string; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ f(s: string): number; f(n: number): string; }'. var x2:{ f(s:string):number; } =3; ~~ -!!! error TS2322: Type '3' is not assignable to type '{ f(s: string): number; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ f(s: string): number; }'. var x3:{ (s:string):number;(n:number):string; }=3; ~~ -!!! error TS2322: Type '3' is not assignable to type '{ (s: string): number; (n: number): string; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; }'. var x4:{ x;y;z:number;f(n:number):string;f(s:string):number; }=3; ~~ -!!! error TS2322: Type '3' is not assignable to type '{ x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. var x5:{ (s:string):number;(n:number):string;x;y;z:number;f(n:number):string;f(s:string):number; }=3; ~~ -!!! error TS2322: Type '3' is not assignable to type '{ (s: string): number; (n: number): string; x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'. var x6:{ z:number;f:{(n:number):string;(s:string):number;}; }=3; ~~ -!!! error TS2322: Type '3' is not assignable to type '{ z: number; f: { (n: number): string; (s: string): number; }; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ z: number; f: { (n: number): string; (s: string): number; }; }'. var x7:(s:string)=>boolean=3; ~~ -!!! error TS2322: Type '3' is not assignable to type '(s: string) => boolean'. +!!! error TS2322: Type 'number' is not assignable to type '(s: string) => boolean'. var x8:{ z:I;[s:string]:{ x; y; };[n:number]:{x; y;};():boolean; }=3; ~~ -!!! error TS2322: Type '3' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'. ~ !!! error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'. var x9:I=3; ~~ -!!! error TS2322: Type '3' is not assignable to type 'I'. +!!! error TS2322: Type 'number' is not assignable to type 'I'. var x10:I[][][][]=3; ~~~ -!!! error TS2322: Type '3' is not assignable to type 'I[][][][]'. +!!! error TS2322: Type 'number' is not assignable to type 'I[][][][]'. var x11:{z:I;x:boolean;}[][]=3; ~~~ -!!! error TS2322: Type '3' is not assignable to type '{ z: I; x: boolean; }[][]'. +!!! error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; }[][]'. var x12:{z:I;x:boolean;y:(s:string)=>boolean;w:{ z:I;[s:string]:{ x; y; };[n:number]:{x; y;};():boolean; };}[][]=3; ~~~ -!!! error TS2322: Type '3' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }; }[][]'. +!!! error TS2322: Type 'number' is not assignable to type '{ z: I; x: boolean; y: (s: string) => boolean; w: { (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }; }[][]'. ~ !!! error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'. var x13:{ new(): number; new(n:number):number; x: string; w: {y: number;}; (): {}; } = 3; ~~~ -!!! error TS2322: Type '3' is not assignable to type '{ (): {}; new (): number; new (n: number): number; x: string; w: { y: number; }; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ (): {}; new (): number; new (n: number): number; x: string; w: { y: number; }; }'. var x14:{ f(x:number):boolean; p; q; ():string; }=3; ~~~ -!!! error TS2322: Type '3' is not assignable to type '{ (): string; f(x: number): boolean; p: any; q: any; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ (): string; f(x: number): boolean; p: any; q: any; }'. var x15:number=C; ~~~ !!! error TS2322: Type 'typeof C' is not assignable to type 'number'. diff --git a/tests/baselines/reference/typeOfOnTypeArg.errors.txt b/tests/baselines/reference/typeOfOnTypeArg.errors.txt index 58412a5417f05..46b48983f218a 100644 --- a/tests/baselines/reference/typeOfOnTypeArg.errors.txt +++ b/tests/baselines/reference/typeOfOnTypeArg.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeOfOnTypeArg.ts(7,6): error TS2345: Argument of type '32' is not assignable to parameter of type '{ '': number; }'. +tests/cases/compiler/typeOfOnTypeArg.ts(7,6): error TS2345: Argument of type 'number' is not assignable to parameter of type '{ '': number; }'. ==== tests/cases/compiler/typeOfOnTypeArg.ts (1 errors) ==== @@ -10,5 +10,5 @@ tests/cases/compiler/typeOfOnTypeArg.ts(7,6): error TS2345: Argument of type '32 fill(32); ~~ -!!! error TS2345: Argument of type '32' is not assignable to parameter of type '{ '': number; }'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '{ '': number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/typeOfOperator1.errors.txt b/tests/baselines/reference/typeOfOperator1.errors.txt index 137b58c0365a8..6349e2b4eec38 100644 --- a/tests/baselines/reference/typeOfOperator1.errors.txt +++ b/tests/baselines/reference/typeOfOperator1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' is not assignable to type 'number'. - Type '"string"' is not assignable to type 'number'. +tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type 'string' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/typeOfOperator1.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type '"string" | "nu var y: string = typeof x; var z: number = typeof x; ~ -!!! error TS2322: Type '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' is not assignable to type 'number'. -!!! error TS2322: Type '"string"' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.errors.txt b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.errors.txt index 8f286e3986314..75b93935f37f7 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.errors.txt +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(6,8): error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(6,8): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(7,8): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(13,17): error TS2345: Argument of type 'NumberVariant' is not assignable to parameter of type 'number'. tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(16,11): error TS2322: Type 'string' is not assignable to type 'number'. @@ -16,7 +16,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTy foo(1, ''); ~~ -!!! error TS2345: Argument of type '""' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. foo(1, {}); ~~ !!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. diff --git a/tests/baselines/reference/typeTagModuleExports.errors.txt b/tests/baselines/reference/typeTagModuleExports.errors.txt index 1ef675996ab68..8fe27a4121470 100644 --- a/tests/baselines/reference/typeTagModuleExports.errors.txt +++ b/tests/baselines/reference/typeTagModuleExports.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/jsdoc/bug27327.js(2,1): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/bug27327.js(2,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsdoc/bug27327.js (1 errors) ==== /** @type {string} */ module.exports = 0; ~~~~~~~~~~~~~~ -!!! error TS2322: Type '0' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/typeTagPrototypeAssignment.errors.txt b/tests/baselines/reference/typeTagPrototypeAssignment.errors.txt index f80916b793e8b..ac38ad89232b6 100644 --- a/tests/baselines/reference/typeTagPrototypeAssignment.errors.txt +++ b/tests/baselines/reference/typeTagPrototypeAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsdoc/bug27327.js(4,1): error TS2322: Type '12' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/bug27327.js(4,1): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/jsdoc/bug27327.js (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/conformance/jsdoc/bug27327.js(4,1): error TS2322: Type '12' is not a /** @type {string} */ C.prototype = 12 ~~~~~~~~~~~ -!!! error TS2322: Type '12' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ 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 3d588abf1ee84..6c76d41809a98 100644 --- a/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt +++ b/tests/baselines/reference/types.asyncGenerators.es2018.2.errors.txt @@ -30,13 +30,13 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( Type 'AsyncGenerator' is not assignable to type 'AsyncIterator'. tests/cases/conformance/types/asyncGenerators/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'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(38,11): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(38,11): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(41,12): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(44,12): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(47,11): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(47,11): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(50,12): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(53,12): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(56,11): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(56,11): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(59,12): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(62,12): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(64,42): error TS2741: Property '[Symbol.iterator]' is missing in type 'AsyncGenerator' but required in type 'IterableIterator'. @@ -132,7 +132,7 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( async function * explicitReturnType1(): AsyncIterableIterator { yield "a"; ~~~ -!!! error TS2322: Type '"a"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } async function * explicitReturnType2(): AsyncIterableIterator { yield* ["a", "b"]; @@ -147,7 +147,7 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( async function * explicitReturnType4(): AsyncIterable { yield "a"; ~~~ -!!! error TS2322: Type '"a"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } async function * explicitReturnType5(): AsyncIterable { yield* ["a", "b"]; @@ -162,7 +162,7 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts( async function * explicitReturnType7(): AsyncIterator { yield "a"; ~~~ -!!! error TS2322: Type '"a"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } async function * explicitReturnType8(): AsyncIterator { yield* ["a", "b"]; diff --git a/tests/baselines/reference/unionTypeCallSignatures.errors.txt b/tests/baselines/reference/unionTypeCallSignatures.errors.txt index 77ff1ae61ad2e..73e334d04469f 100644 --- a/tests/baselines/reference/unionTypeCallSignatures.errors.txt +++ b/tests/baselines/reference/unionTypeCallSignatures.errors.txt @@ -1,38 +1,38 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(9,1): error TS2322: Type 'number | Date' is not assignable to type 'string | boolean'. Type 'number' is not assignable to type 'string | boolean'. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(9,43): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(9,43): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(10,29): error TS2769: No overload matches this call. Overload 1 of 2, '(a: number): number | Date', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. Overload 2 of 2, '(a: string): string | boolean', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(15,29): error TS2769: No overload matches this call. Overload 1 of 2, '(a: number): number | Date', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. Overload 2 of 2, '(a: string): string | boolean', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(16,1): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(19,32): error TS2345: Argument of type '10' is not assignable to parameter of type 'never'. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(20,32): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'never'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(19,32): error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(20,32): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(21,1): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(24,1): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(26,36): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(26,36): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(29,1): error TS2554: Expected 2 arguments, but got 0. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(30,1): error TS2554: Expected 2 arguments, but got 1. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(36,49): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(36,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(37,12): error TS2554: Expected 1-2 arguments, but got 0. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(40,12): error TS2554: Expected 2 arguments, but got 1. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(42,49): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(42,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(43,12): error TS2554: Expected 2 arguments, but got 0. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(48,49): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(48,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(49,12): error TS2554: Expected 1-2 arguments, but got 0. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(55,45): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(55,45): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(56,12): error TS2555: Expected at least 1 arguments, but got 0. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(59,12): error TS2554: Expected 2 arguments, but got 1. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(61,49): error TS2554: Expected 2 arguments, but got 3. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(62,45): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(62,45): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(63,12): error TS2554: Expected 2 arguments, but got 0. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(69,45): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(69,45): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2555: Expected at least 1 arguments, but got 0. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2554: Expected 2 arguments, but got 1. @@ -51,14 +51,14 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 !!! error TS2322: Type 'number | Date' is not assignable to type 'string | boolean'. !!! error TS2322: Type 'number' is not assignable to type 'string | boolean'. ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. unionOfDifferentReturnType1(true); // error in type of parameter ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(a: number): number | Date', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 2, '(a: string): string | boolean', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. var unionOfDifferentReturnType1: { (a: number): number; (a: string): string; } | { (a: number): Date; (a: string): boolean; }; numOrDate = unionOfDifferentReturnType1(10); @@ -67,9 +67,9 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(a: number): number | Date', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 2, '(a: string): string | boolean', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. unionOfDifferentReturnType1(); // error missing parameter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. @@ -78,10 +78,10 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 var unionOfDifferentParameterTypes: { (a: number): number; } | { (a: string): Date; }; unionOfDifferentParameterTypes(10);// error - no call signatures ~~ -!!! error TS2345: Argument of type '10' is not assignable to parameter of type 'never'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. unionOfDifferentParameterTypes("hello");// error - no call signatures ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'never'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. unionOfDifferentParameterTypes();// error - no call signatures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. @@ -95,7 +95,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 unionOfDifferentNumberOfSignatures(10); // error - no call signatures unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; unionWithDifferentParameterCount();// needs more args @@ -113,7 +113,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 strOrNum = unionWithOptionalParameter1('hello', 10); strOrNum = unionWithOptionalParameter1('hello', "hello"); // error in parameter type ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = unionWithOptionalParameter1(); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. @@ -127,7 +127,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature strOrNum = unionWithOptionalParameter2('hello', "hello"); // error no call signature ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = unionWithOptionalParameter2(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 0. @@ -138,7 +138,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 strOrNum = unionWithOptionalParameter3('hello', 10); // ok strOrNum = unionWithOptionalParameter3('hello', "hello"); // wrong argument type ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = unionWithOptionalParameter3(); // needs more args ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. @@ -150,7 +150,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 strOrNum = unionWithRestParameter1('hello', 10, 11); strOrNum = unionWithRestParameter1('hello', "hello"); // error in parameter type ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = unionWithRestParameter1(); // error ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. @@ -167,7 +167,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 !!! error TS2554: Expected 2 arguments, but got 3. strOrNum = unionWithRestParameter2('hello', "hello"); // error no call signature ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = unionWithRestParameter2(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 0. @@ -179,7 +179,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature strOrNum = unionWithRestParameter3('hello', "hello"); // wrong argument type ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = unionWithRestParameter3(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. diff --git a/tests/baselines/reference/unionTypeConstructSignatures.errors.txt b/tests/baselines/reference/unionTypeConstructSignatures.errors.txt index 686f95e9fd4d8..6ae542f0f2ff6 100644 --- a/tests/baselines/reference/unionTypeConstructSignatures.errors.txt +++ b/tests/baselines/reference/unionTypeConstructSignatures.errors.txt @@ -1,38 +1,38 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(9,1): error TS2322: Type 'number | Date' is not assignable to type 'string | boolean'. Type 'number' is not assignable to type 'string | boolean'. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(9,47): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(9,47): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(10,33): error TS2769: No overload matches this call. Overload 1 of 2, '(a: number): number | Date', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. Overload 2 of 2, '(a: string): string | boolean', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(15,33): error TS2769: No overload matches this call. Overload 1 of 2, '(a: number): number | Date', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'number'. + Argument of type 'boolean' is not assignable to parameter of type 'number'. Overload 2 of 2, '(a: string): string | boolean', gave the following error. - Argument of type 'true' is not assignable to parameter of type 'string'. + Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(16,1): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(19,36): error TS2345: Argument of type '10' is not assignable to parameter of type 'never'. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(20,36): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'never'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(19,36): error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(20,36): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(21,1): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(24,1): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(26,40): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(26,40): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(29,1): error TS2554: Expected 2 arguments, but got 0. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(30,1): error TS2554: Expected 2 arguments, but got 1. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(36,53): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(36,53): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(37,12): error TS2554: Expected 1-2 arguments, but got 0. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(40,12): error TS2554: Expected 2 arguments, but got 1. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(42,53): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(42,53): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(43,12): error TS2554: Expected 2 arguments, but got 0. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(48,53): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(48,53): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(49,12): error TS2554: Expected 1-2 arguments, but got 0. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(55,49): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(55,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(56,12): error TS2555: Expected at least 1 arguments, but got 0. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(59,12): error TS2554: Expected 2 arguments, but got 1. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(61,53): error TS2554: Expected 2 arguments, but got 3. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(62,49): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(62,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(63,12): error TS2554: Expected 2 arguments, but got 0. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(69,49): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(69,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): error TS2555: Expected at least 1 arguments, but got 0. @@ -50,14 +50,14 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro !!! error TS2322: Type 'number | Date' is not assignable to type 'string | boolean'. !!! error TS2322: Type 'number' is not assignable to type 'string | boolean'. ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. new unionOfDifferentReturnType1(true); // error in type of parameter ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(a: number): number | Date', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 2, '(a: string): string | boolean', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. var unionOfDifferentReturnType1: { new (a: number): number; new (a: string): string; } | { new (a: number): Date; new (a: string): boolean; }; numOrDate = new unionOfDifferentReturnType1(10); @@ -66,9 +66,9 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro ~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(a: number): number | Date', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'number'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'number'. !!! error TS2769: Overload 2 of 2, '(a: string): string | boolean', gave the following error. -!!! error TS2769: Argument of type 'true' is not assignable to parameter of type 'string'. +!!! error TS2769: Argument of type 'boolean' is not assignable to parameter of type 'string'. new unionOfDifferentReturnType1(); // error missing parameter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. @@ -77,10 +77,10 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro var unionOfDifferentParameterTypes: { new (a: number): number; } | { new (a: string): Date; }; new unionOfDifferentParameterTypes(10);// error - no call signatures ~~ -!!! error TS2345: Argument of type '10' is not assignable to parameter of type 'never'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. new unionOfDifferentParameterTypes("hello");// error - no call signatures ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'never'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. new unionOfDifferentParameterTypes();// error - no call signatures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. @@ -94,7 +94,7 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro new unionOfDifferentNumberOfSignatures(10); // error - no call signatures new unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. var unionWithDifferentParameterCount: { new (a: string): string; } | { new (a: string, b: number): number; }; new unionWithDifferentParameterCount();// needs more args @@ -112,7 +112,7 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro strOrNum = new unionWithOptionalParameter1('hello', 10); strOrNum = new unionWithOptionalParameter1('hello', "hello"); // error in parameter type ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = new unionWithOptionalParameter1(); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. @@ -126,7 +126,7 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro strOrNum = new unionWithOptionalParameter2('hello', 10); // error no call signature strOrNum = new unionWithOptionalParameter2('hello', "hello"); // error no call signature ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = new unionWithOptionalParameter2(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 0. @@ -137,7 +137,7 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro strOrNum = new unionWithOptionalParameter3('hello', 10); // ok strOrNum = new unionWithOptionalParameter3('hello', "hello"); // wrong type ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = new unionWithOptionalParameter3(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. @@ -149,7 +149,7 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro strOrNum = new unionWithRestParameter1('hello', 10, 11); strOrNum = new unionWithRestParameter1('hello', "hello"); // error in parameter type ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = new unionWithRestParameter1(); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. @@ -166,7 +166,7 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro !!! error TS2554: Expected 2 arguments, but got 3. strOrNum = new unionWithRestParameter2('hello', "hello"); // error no call signature ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = new unionWithRestParameter2(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 0. @@ -178,7 +178,7 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro strOrNum = new unionWithRestParameter3('hello', 10, 11); // ok strOrNum = new unionWithRestParameter3('hello', "hello"); // wrong type ~~~~~~~ -!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = new unionWithRestParameter3(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. diff --git a/tests/baselines/reference/unionTypeInference.errors.txt b/tests/baselines/reference/unionTypeInference.errors.txt index b39b8fcd15cfe..34da5d5ca9981 100644 --- a/tests/baselines/reference/unionTypeInference.errors.txt +++ b/tests/baselines/reference/unionTypeInference.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts(13,24): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts(31,15): error TS2345: Argument of type '42' is not assignable to parameter of type 'never'. +tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts(13,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts(31,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. ==== tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts (2 errors) ==== @@ -17,7 +17,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference const a6 = f1(true, false); // boolean const a7 = f1("hello", 1); // Error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. declare function f2(value: [string, T]): T; @@ -37,7 +37,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference const d2 = f4(s); const d3 = f4(42); // Error ~~ -!!! error TS2345: Argument of type '42' is not assignable to parameter of type 'never'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. export interface Foo { then(f: (x: T) => U | Foo, g: U): Foo; diff --git a/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt b/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt index 8ad20f2106083..9d80ccfe8d540 100644 --- a/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt +++ b/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(11,3): error tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(14,4): error TS2540: Cannot assign to 'foo' because it is a read-only property. tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(24,1): error TS7053: Element implicitly has an 'any' type because expression of type '1' can't be used to index type 'Both'. Property '1' does not exist on type 'Both'. -tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(25,1): error TS2322: Type '"not ok"' is not assignable to type 'number'. +tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(25,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(26,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'Both'. Property '[sym]' does not exist on type 'Both'. @@ -43,7 +43,7 @@ tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(26,1): error !!! error TS7053: Property '1' does not exist on type 'Both'. both[0] = 'not ok' ~~~~~~~ -!!! error TS2322: Type '"not ok"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. both[sym] = 'not ok' ~~~~~~~~~ !!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'Both'. diff --git a/tests/baselines/reference/uniqueSymbolsErrors.errors.txt b/tests/baselines/reference/uniqueSymbolsErrors.errors.txt index 3feba130bd60d..6a9452330fa85 100644 --- a/tests/baselines/reference/uniqueSymbolsErrors.errors.txt +++ b/tests/baselines/reference/uniqueSymbolsErrors.errors.txt @@ -58,7 +58,7 @@ tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,29): error tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,45): error TS1335: 'unique symbol' types are not allowed here. tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,36): error TS1335: 'unique symbol' types are not allowed here. tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,52): error TS1335: 'unique symbol' types are not allowed here. -tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(87,7): error TS2322: Type 'unique symbol' is not assignable to type 'string'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(87,7): error TS2322: Type 'typeof shouldNotBeAssignable' is not assignable to type 'string'. ==== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts (61 errors) ==== @@ -270,4 +270,4 @@ tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(87,7): error T // https://github.com/Microsoft/TypeScript/issues/21584 const shouldNotBeAssignable: string = Symbol(); ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'unique symbol' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'typeof shouldNotBeAssignable' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/unknownType1.errors.txt b/tests/baselines/reference/unknownType1.errors.txt index 6799941a44484..60856e8ce182b 100644 --- a/tests/baselines/reference/unknownType1.errors.txt +++ b/tests/baselines/reference/unknownType1.errors.txt @@ -20,7 +20,7 @@ tests/cases/conformance/types/unknown/unknownType1.ts(120,9): error TS2322: Type Type 'unknown' is not assignable to type 'object'. tests/cases/conformance/types/unknown/unknownType1.ts(128,5): error TS2322: Type 'number[]' is not assignable to type '{ [x: string]: unknown; }'. Index signature is missing in type 'number[]'. -tests/cases/conformance/types/unknown/unknownType1.ts(129,5): error TS2322: Type '123' is not assignable to type '{ [x: string]: unknown; }'. +tests/cases/conformance/types/unknown/unknownType1.ts(129,5): error TS2322: Type 'number' is not assignable to type '{ [x: string]: unknown; }'. tests/cases/conformance/types/unknown/unknownType1.ts(143,29): error TS2698: Spread types may only be created from object types. tests/cases/conformance/types/unknown/unknownType1.ts(144,29): error TS2698: Spread types may only be created from object types. tests/cases/conformance/types/unknown/unknownType1.ts(150,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. @@ -204,7 +204,7 @@ tests/cases/conformance/types/unknown/unknownType1.ts(181,5): error TS2322: Type !!! error TS2322: Index signature is missing in type 'number[]'. x = 123; // Error ~ -!!! error TS2322: Type '123' is not assignable to type '{ [x: string]: unknown; }'. +!!! error TS2322: Type 'number' is not assignable to type '{ [x: string]: unknown; }'. } // Locals of type unknown always considered initialized diff --git a/tests/baselines/reference/vararg.errors.txt b/tests/baselines/reference/vararg.errors.txt index 2e64f957134f8..0f30aa853633b 100644 --- a/tests/baselines/reference/vararg.errors.txt +++ b/tests/baselines/reference/vararg.errors.txt @@ -3,8 +3,8 @@ tests/cases/compiler/vararg.ts(17,13): error TS2304: Cannot find name 'builder'. tests/cases/compiler/vararg.ts(19,17): error TS2304: Cannot find name 'builder'. tests/cases/compiler/vararg.ts(21,20): error TS2304: Cannot find name 'builder'. tests/cases/compiler/vararg.ts(28,13): error TS2345: Argument of type 'C' is not assignable to parameter of type 'string'. -tests/cases/compiler/vararg.ts(29,13): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. -tests/cases/compiler/vararg.ts(32,17): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +tests/cases/compiler/vararg.ts(29,13): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/vararg.ts(32,17): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. tests/cases/compiler/vararg.ts(33,17): error TS2345: Argument of type 'C' is not assignable to parameter of type 'string'. @@ -49,12 +49,12 @@ tests/cases/compiler/vararg.ts(33,17): error TS2345: Argument of type 'C' is not !!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'string'. result+=x.f(3,"hello",3); // bad second param ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. result+=x.f("hello",3,3,3,3,3); // ok result+=x.f("hello"); // ok varargs length 0 result+=x.fonly(3); // ok conversion ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. result+=x.fonly(x); // bad param ~ !!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'string'. diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index 1c3efb3a624aa..67b375570f9b7 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -2,8 +2,8 @@ tests/cases/compiler/widenedTypes.ts(1,1): error TS2358: The left-hand side of a tests/cases/compiler/widenedTypes.ts(4,1): error TS2531: Object is possibly 'null'. tests/cases/compiler/widenedTypes.ts(5,7): error TS2531: Object is possibly 'null'. tests/cases/compiler/widenedTypes.ts(9,14): error TS2695: Left side of comma operator is unused and has no side effects. -tests/cases/compiler/widenedTypes.ts(10,1): error TS2322: Type '""' is not assignable to type 'number'. -tests/cases/compiler/widenedTypes.ts(17,1): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/compiler/widenedTypes.ts(10,1): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/widenedTypes.ts(17,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/widenedTypes.ts(22,22): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/widenedTypes.ts(23,39): error TS2322: Type 'number' is not assignable to type 'string'. @@ -28,7 +28,7 @@ tests/cases/compiler/widenedTypes.ts(23,39): error TS2322: Type 'number' is not !!! error TS2695: Left side of comma operator is unused and has no side effects. t[3] = ""; ~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var x: typeof undefined = 3; x = 3; @@ -37,7 +37,7 @@ tests/cases/compiler/widenedTypes.ts(23,39): error TS2322: Type 'number' is not var u = [3, (y = null)]; u[3] = ""; ~~~~ -!!! error TS2322: Type '""' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var ob: { x: typeof undefined } = { x: "" }; diff --git a/tests/baselines/reference/wrappedRecursiveGenericType.errors.txt b/tests/baselines/reference/wrappedRecursiveGenericType.errors.txt index ad3353f64cc67..da97e05713bbc 100644 --- a/tests/baselines/reference/wrappedRecursiveGenericType.errors.txt +++ b/tests/baselines/reference/wrappedRecursiveGenericType.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/wrappedRecursiveGenericType.ts(13,1): error TS2322: Type '5' is not assignable to type 'X'. -tests/cases/compiler/wrappedRecursiveGenericType.ts(14,1): error TS2322: Type '5' is not assignable to type 'X'. +tests/cases/compiler/wrappedRecursiveGenericType.ts(13,1): error TS2322: Type 'number' is not assignable to type 'X'. +tests/cases/compiler/wrappedRecursiveGenericType.ts(14,1): error TS2322: Type 'number' is not assignable to type 'X'. ==== tests/cases/compiler/wrappedRecursiveGenericType.ts (2 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/wrappedRecursiveGenericType.ts(14,1): error TS2322: Type '5 x.a.val = 5; // val -> number x.a.b.val = 5; // val -> X (This should be an error) ~~~~~~~~~ -!!! error TS2322: Type '5' is not assignable to type 'X'. +!!! error TS2322: Type 'number' is not assignable to type 'X'. x.a.b.a.val = 5; // val -> X (This should be an error) ~~~~~~~~~~~ -!!! error TS2322: Type '5' is not assignable to type 'X'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'X'. \ No newline at end of file From af4ea605f214aac0e526dbba9e2a5086e50dde39 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 19 Apr 2020 17:18:02 -0400 Subject: [PATCH 02/14] Fixed a couple of tsserver unit tests --- src/testRunner/unittests/tsserver/openFile.ts | 2 +- src/testRunner/unittests/tsserver/projectReferenceErrors.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/testRunner/unittests/tsserver/openFile.ts b/src/testRunner/unittests/tsserver/openFile.ts index 1bc7f10cf9ffd..52949ab821a64 100644 --- a/src/testRunner/unittests/tsserver/openFile.ts +++ b/src/testRunner/unittests/tsserver/openFile.ts @@ -175,7 +175,7 @@ bar();` file, syntax: [], semantic: [ - createDiagnostic(locationOfY.start, locationOfY.end, Diagnostics.Type_0_is_not_assignable_to_type_1, ["10", "string"]), + createDiagnostic(locationOfY.start, locationOfY.end, Diagnostics.Type_0_is_not_assignable_to_type_1, ["number", "string"]), ], suggestion: [] }, diff --git a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts index 9444ccb7a9d4f..0fb2f8d883f9b 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts @@ -166,7 +166,7 @@ fnErr(); { line: 6, offset: 12 }, { line: 6, offset: 13 }, Diagnostics.Type_0_is_not_assignable_to_type_1, - ["10", "string"], + ["number", "string"], "error", ) ], @@ -235,7 +235,7 @@ fnErr(); { line: 6, offset: 5 }, { line: 6, offset: 6 }, Diagnostics.Type_0_is_not_assignable_to_type_1, - ["10", "string"], + ["number", "string"], "error", ) ], From 769a2f2cfc234cc4c83cd36532fb0cbcb14df113 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 19 Apr 2020 20:25:24 -0400 Subject: [PATCH 03/14] Eased up on some of the more aggressive reporting changes --- src/compiler/checker.ts | 10 ++++++---- src/testRunner/unittests/tsserver/openFile.ts | 2 +- .../unittests/tsserver/projectReferenceErrors.ts | 4 ++-- ...ccessKeyofReliesOnKeyofNeverUpperBound.errors.txt | 8 ++++---- .../baselines/reference/conditionalTypes1.errors.txt | 12 ++++++------ ...ructorImplementationWithDefaultValues2.errors.txt | 4 ++-- .../reference/derivedGenericClassWithAny.errors.txt | 8 ++++---- .../genericCallWithFunctionTypedArguments.errors.txt | 12 ++++++------ ...ericCallWithGenericSignatureArguments2.errors.txt | 8 ++++---- ...cCallWithObjectTypeArgsAndInitializers.errors.txt | 4 ++-- ...ackInvokedInsideItsContainingFunction1.errors.txt | 4 ++-- ...cClassWithFunctionTypedMemberArguments.errors.txt | 12 ++++++------ .../genericWithOpenTypeParameters1.errors.txt | 4 ++-- .../stringLiteralsWithEqualityChecks03.errors.txt | 8 ++++---- .../stringLiteralsWithEqualityChecks04.errors.txt | 8 ++++---- ...gumentsOnFunctionsWithNoTypeParameters.errors.txt | 4 ++-- 16 files changed, 57 insertions(+), 55 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4fee6c27924b6..e7b6cb16aa55f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4073,9 +4073,6 @@ namespace ts { leftStr = getTypeNameForErrorDisplay(left); rightStr = getTypeNameForErrorDisplay(right); } - else if (isLiteralType(left) && !isLiteralType(right)) { - leftStr = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(left)) - } return [leftStr, rightStr]; } @@ -15458,6 +15455,7 @@ namespace ts { function reportRelationError(message: DiagnosticMessage | undefined, source: Type, target: Type) { if (incompatibleStack.length) reportIncompatibleStack(); const [sourceType, targetType] = getTypeNamesForErrorDisplay(source, target); + let generalizedSourceType = sourceType; if (target.flags & TypeFlags.TypeParameter) { const constraint = getBaseConstraintOfType(target); @@ -15491,7 +15489,11 @@ namespace ts { } } - reportError(message, sourceType, targetType); + if (isLiteralType(source) && !isLiteralType(target)) { + generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source)) + } + + reportError(message, generalizedSourceType, targetType); } function tryElaborateErrorsForPrimitivesAndObjects(source: Type, target: Type) { diff --git a/src/testRunner/unittests/tsserver/openFile.ts b/src/testRunner/unittests/tsserver/openFile.ts index 52949ab821a64..1bc7f10cf9ffd 100644 --- a/src/testRunner/unittests/tsserver/openFile.ts +++ b/src/testRunner/unittests/tsserver/openFile.ts @@ -175,7 +175,7 @@ bar();` file, syntax: [], semantic: [ - createDiagnostic(locationOfY.start, locationOfY.end, Diagnostics.Type_0_is_not_assignable_to_type_1, ["number", "string"]), + createDiagnostic(locationOfY.start, locationOfY.end, Diagnostics.Type_0_is_not_assignable_to_type_1, ["10", "string"]), ], suggestion: [] }, diff --git a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts index 0fb2f8d883f9b..9444ccb7a9d4f 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts @@ -166,7 +166,7 @@ fnErr(); { line: 6, offset: 12 }, { line: 6, offset: 13 }, Diagnostics.Type_0_is_not_assignable_to_type_1, - ["number", "string"], + ["10", "string"], "error", ) ], @@ -235,7 +235,7 @@ fnErr(); { line: 6, offset: 5 }, { line: 6, offset: 6 }, Diagnostics.Type_0_is_not_assignable_to_type_1, - ["number", "string"], + ["10", "string"], "error", ) ], diff --git a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt index 4edd2a5a09be0..5276e42c4de8a 100644 --- a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt +++ b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt @@ -10,12 +10,12 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t Type 'string' is not assignable to type 'ChannelOfType["type"]'. Type 'string' is not assignable to type 'T & "text"'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. + '"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 'T & "text"'. Type 'string' is not assignable to type 'T & "text"'. Type 'string' is not assignable to type 'T & "text"'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. + '"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"'. @@ -68,12 +68,12 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t !!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"]'. !!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. +!!! 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 'T & "text"'. !!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '"text" | "email"'. +!!! 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"'. diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index 16a81ba69c6fe..e15d0ba769c90 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -44,11 +44,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2 Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. Type 'number' is not assignable to type 'T'. - 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type 'string | number' is not assignable to type 'T'. - 'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf'. Type 'string | number' is not assignable to type 'ZeroOf'. Type 'string' is not assignable to type 'ZeroOf'. @@ -284,11 +284,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS !!! error TS2322: Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. !!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. !!! error TS2322: Type 'number' is not assignable to type 'T'. -!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type 'string | number' is not assignable to type 'T'. -!!! error TS2322: 'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. y = x; // Error ~ !!! error TS2322: Type 'T' is not assignable to type 'ZeroOf'. diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt index 3d22f3fb320be..2cceb88175a09 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,27): error TS2322: Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(17,17): error TS2322: Type 'Date' is not assignable to type 'T'. @@ -22,7 +22,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co constructor(x: T = 1, public y: U = x) { // error ~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'T'. -!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. ~~~~~~~~~~~~~~~ !!! 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'. diff --git a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt index 3e717a6d59a34..4abd4a4cd09d6 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt @@ -3,9 +3,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. + '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. + '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E' is not assignable to type 'C'. Types of property 'x' are incompatible. Type 'string' is not assignable to type 'number'. @@ -52,12 +52,12 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. foo(): T { return ''; // error ~~~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. } } diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt index aef8a5ad372f5..53ef67b340d62 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -3,15 +3,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,24): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,23): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -54,7 +54,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r10 = foo2(1, (x) => ''); // string var r11 = foo3(1, (x: T) => '', ''); // error @@ -62,13 +62,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r11b = foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r12 = foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ !!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index 08330d4a5867e..2e6ced0af8696 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. Type 'Date' is not assignable to type 'T'. @@ -13,7 +13,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. Type 'Date' is not assignable to type 'T'. @@ -48,7 +48,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r10 = r7(1); // error ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. } function foo2(a: (x: T) => T, b: (x: T) => T) { @@ -97,7 +97,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r10 = r7(1); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. } function foo2(a: (x: T) => T, b: (x: U) => U) { diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt index 545a8b47a7981..b37937c9edbb1 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type 'number' is not assignable to type 'T'. - 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(6,37): error TS2322: Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(8,56): error TS2322: Type 'U' is not assignable to type 'V'. @@ -16,7 +16,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC function foo3(x: T = 1) { } // error ~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'T'. -!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. +!!! error TS2322: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. function foo4(x: T, y: U = x) { } // error ~~~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'U'. diff --git a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt index 25915c23a88b7..1f179fb32675a 100644 --- a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt +++ b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,17): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(9,17): error TS2558: Expected 0 type arguments, but got 1. @@ -18,7 +18,7 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17 var r2 = f(1); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r3 = f(null); ~~~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt index 440c8d113cb8d..db9943c5ba2ed 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,15 +1,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,29): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,30): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,31): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -76,7 +76,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r10 = c.foo2(1, (x) => ''); // string var r11 = c3.foo3(1, (x: T) => '', ''); // error @@ -84,13 +84,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r11b = c3.foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r12 = c3.foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ !!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt index f348a0fb97434..e8705615424c5 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,41): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expected 0 type arguments, but got 1. @@ -14,7 +14,7 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expe var f = (x: B) => { return x.foo(1); } // error ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var f2 = (x: B) => { return x.foo(1); } // error ~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/stringLiteralsWithEqualityChecks03.errors.txt b/tests/baselines/reference/stringLiteralsWithEqualityChecks03.errors.txt index f182c6721cf54..cbefbbac978bd 100644 --- a/tests/baselines/reference/stringLiteralsWithEqualityChecks03.errors.txt +++ b/tests/baselines/reference/stringLiteralsWithEqualityChecks03.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(16,5): error TS2367: This condition will always return 'false' since the types '"foo"' and '"bar"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(19,5): error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. -tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(20,5): error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap. +tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(20,5): error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(25,5): error TS2367: This condition will always return 'true' since the types '"foo"' and '"bar"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(28,5): error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. -tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5): error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap. +tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5): error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. ==== tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts (6 errors) ==== @@ -32,7 +32,7 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5 !!! error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. b = "bar" === y; ~~~~~~~~~~~ -!!! error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap. +!!! error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. b = x !== y; b = "foo" !== y @@ -47,5 +47,5 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks03.ts(29,5 !!! error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. b = "bar" !== y; ~~~~~~~~~~~ -!!! error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap. +!!! error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralsWithEqualityChecks04.errors.txt b/tests/baselines/reference/stringLiteralsWithEqualityChecks04.errors.txt index 3b8e39c3eb4a6..293abe0b5c565 100644 --- a/tests/baselines/reference/stringLiteralsWithEqualityChecks04.errors.txt +++ b/tests/baselines/reference/stringLiteralsWithEqualityChecks04.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(16,5): error TS2367: This condition will always return 'false' since the types '"foo"' and '"bar"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(19,5): error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. -tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(20,5): error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap. +tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(20,5): error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(25,5): error TS2367: This condition will always return 'true' since the types '"foo"' and '"bar"' have no overlap. tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(28,5): error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. -tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5): error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap. +tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5): error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. ==== tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts (6 errors) ==== @@ -32,7 +32,7 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5 !!! error TS2367: This condition will always return 'false' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. b = "bar" == y; ~~~~~~~~~~ -!!! error TS2367: This condition will always return 'false' since the types 'string' and 'Refrigerator | "foo"' have no overlap. +!!! error TS2367: This condition will always return 'false' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. b = x != y; b = "foo" != y @@ -47,5 +47,5 @@ tests/cases/conformance/types/literal/stringLiteralsWithEqualityChecks04.ts(29,5 !!! error TS2367: This condition will always return 'true' since the types 'Refrigerator | "foo"' and '"bar"' have no overlap. b = "bar" != y; ~~~~~~~~~~ -!!! error TS2367: This condition will always return 'true' since the types 'string' and 'Refrigerator | "foo"' have no overlap. +!!! error TS2367: This condition will always return 'true' since the types '"bar"' and 'Refrigerator | "foo"' have no overlap. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt index c415f5d9a493d..5da4df50ef1cb 100644 --- a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt +++ b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(2,15): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. + 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): error TS2558: Expected 0 type arguments, but got 1. @@ -12,7 +12,7 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): erro var r2 = f(1); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r3 = f(null); ~~~ !!! error TS2558: Expected 0 type arguments, but got 1. From cb19b3d251d83989c7056ff161163b9c965adb7a Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 19 Apr 2020 21:34:05 -0400 Subject: [PATCH 04/14] Again fixed up manual unit tests --- src/testRunner/unittests/tscWatch/resolutionCache.ts | 2 +- src/testRunner/unittests/tsserver/openFile.ts | 2 +- src/testRunner/unittests/tsserver/projectReferenceErrors.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/testRunner/unittests/tscWatch/resolutionCache.ts b/src/testRunner/unittests/tscWatch/resolutionCache.ts index df06ed11a41c7..f04d481746355 100644 --- a/src/testRunner/unittests/tscWatch/resolutionCache.ts +++ b/src/testRunner/unittests/tscWatch/resolutionCache.ts @@ -37,7 +37,7 @@ namespace ts.tscWatch { // ensure file has correct number of errors after edit checkOutputErrorsIncremental(host, [ f1IsNotModule, - getDiagnosticOfFileFromProgram(watch.getCurrentProgram().getProgram(), root.path, newContent.indexOf("var x") + "var ".length, "x".length, Diagnostics.Type_0_is_not_assignable_to_type_1, 1, "string"), + getDiagnosticOfFileFromProgram(watch.getCurrentProgram().getProgram(), root.path, newContent.indexOf("var x") + "var ".length, "x".length, Diagnostics.Type_0_is_not_assignable_to_type_1, "number", "string"), cannotFindFoo ]); } diff --git a/src/testRunner/unittests/tsserver/openFile.ts b/src/testRunner/unittests/tsserver/openFile.ts index 1bc7f10cf9ffd..52949ab821a64 100644 --- a/src/testRunner/unittests/tsserver/openFile.ts +++ b/src/testRunner/unittests/tsserver/openFile.ts @@ -175,7 +175,7 @@ bar();` file, syntax: [], semantic: [ - createDiagnostic(locationOfY.start, locationOfY.end, Diagnostics.Type_0_is_not_assignable_to_type_1, ["10", "string"]), + createDiagnostic(locationOfY.start, locationOfY.end, Diagnostics.Type_0_is_not_assignable_to_type_1, ["number", "string"]), ], suggestion: [] }, diff --git a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts index 9444ccb7a9d4f..0fb2f8d883f9b 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts @@ -166,7 +166,7 @@ fnErr(); { line: 6, offset: 12 }, { line: 6, offset: 13 }, Diagnostics.Type_0_is_not_assignable_to_type_1, - ["10", "string"], + ["number", "string"], "error", ) ], @@ -235,7 +235,7 @@ fnErr(); { line: 6, offset: 5 }, { line: 6, offset: 6 }, Diagnostics.Type_0_is_not_assignable_to_type_1, - ["10", "string"], + ["number", "string"], "error", ) ], From 1b3c7a28c1883cc76f17fc3c2cc291a2cf1ebd1b Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 19 Apr 2020 21:50:17 -0400 Subject: [PATCH 05/14] This had better be the last unit test fix... --- src/testRunner/unittests/tscWatch/incremental.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index 2d05482c2b1e8..34de6c4d7b15d 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -196,7 +196,7 @@ namespace ts.tscWatch { length: 1, code: Diagnostics.Type_0_is_not_assignable_to_type_1.code, category: Diagnostics.Type_0_is_not_assignable_to_type_1.category, - messageText: "Type '20' is not assignable to type 'string'.", + messageText: "Type 'number' is not assignable to type 'string'.", relatedInformation: undefined, reportsUnnecessary: undefined, source: undefined From 035b9ac1c16e88ef1b508b018476769d0237f0f1 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 19 Apr 2020 22:09:53 -0400 Subject: [PATCH 06/14] Lint fix --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e7b6cb16aa55f..009c7356ad55d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15490,7 +15490,7 @@ namespace ts { } if (isLiteralType(source) && !isLiteralType(target)) { - generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source)) + generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source)); } reportError(message, generalizedSourceType, targetType); From d12b741004bf4cea14875328e605a70a290e41bf Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 20 Apr 2020 23:32:34 -0400 Subject: [PATCH 07/14] Excluded type unions from the generale source types --- src/compiler/checker.ts | 2 +- .../reference/bigintIndex.errors.txt | 4 ++-- .../reference/checkJsdocReturnTag2.errors.txt | 8 +++---- .../classPropertyErrorOnNameOnly.errors.txt | 8 +++---- ...yofReliesOnKeyofNeverUpperBound.errors.txt | 12 +++++----- .../reference/conditionalTypes1.errors.txt | 4 ++-- .../controlFlowArrayErrors.errors.txt | 8 +++---- ...tructuringParameterDeclaration2.errors.txt | 4 ++-- ...tructuringParameterDeclaration4.errors.txt | 4 ++-- .../intersectionPropertyCheck.errors.txt | 4 ++-- .../reference/noErrorTruncation.errors.txt | 4 ++-- .../reference/objectCreate-errors.errors.txt | 24 +++++++++---------- .../reference/strictBindCallApply1.errors.txt | 12 +++++----- .../tsxAttributeResolution14.errors.txt | 4 ++-- .../typeFromJSConstructor.errors.txt | 4 ++-- .../typeFromJSInitializer.errors.txt | 4 ++-- .../reference/typeOfOperator1.errors.txt | 4 ++-- 17 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 009c7356ad55d..1dd9fb9255b99 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15489,7 +15489,7 @@ namespace ts { } } - if (isLiteralType(source) && !isLiteralType(target)) { + if (isLiteralType(source) && !(source.flags & TypeFlags.Union) && !isLiteralType(target) && !(target.flags & TypeFlags.Union)) { generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source)); } diff --git a/tests/baselines/reference/bigintIndex.errors.txt b/tests/baselines/reference/bigintIndex.errors.txt index 216e2d4857f07..daf9fa7562dd9 100644 --- a/tests/baselines/reference/bigintIndex.errors.txt +++ b/tests/baselines/reference/bigintIndex.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/a.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/compiler/a.ts(8,11): error TS2538: Type '1n' cannot be used as an index type. -tests/cases/compiler/a.ts(14,1): error TS2322: Type 'bigint' is not assignable to type 'string | number | symbol'. +tests/cases/compiler/a.ts(14,1): error TS2322: Type '123n' is not assignable to type 'string | number | symbol'. tests/cases/compiler/a.ts(19,12): error TS2538: Type 'bigint' cannot be used as an index type. tests/cases/compiler/b.ts(2,12): error TS1136: Property assignment expected. tests/cases/compiler/b.ts(2,14): error TS1005: ';' expected. @@ -29,7 +29,7 @@ tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be key = Symbol(); key = 123n; // should error ~~~ -!!! error TS2322: Type 'bigint' is not assignable to type 'string | number | symbol'. +!!! error TS2322: Type '123n' is not assignable to type 'string | number | symbol'. // Show correct usage of bigint index: explicitly convert to string const bigNum: bigint = 0n; diff --git a/tests/baselines/reference/checkJsdocReturnTag2.errors.txt b/tests/baselines/reference/checkJsdocReturnTag2.errors.txt index 8ff291f2e5579..fcc4f25694d1e 100644 --- a/tests/baselines/reference/checkJsdocReturnTag2.errors.txt +++ b/tests/baselines/reference/checkJsdocReturnTag2.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/jsdoc/returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'string | number'. +tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'true | 5' is not assignable to type 'string | number'. + Type 'true' is not assignable to type 'string | number'. ==== tests/cases/conformance/jsdoc/returns.js (2 errors) ==== @@ -20,6 +20,6 @@ tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'number | boo function f1() { return 5 || true; ~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. -!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. +!!! error TS2322: Type 'true | 5' is not assignable to type 'string | number'. +!!! error TS2322: Type 'true' is not assignable to type 'string | number'. } \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt index 6a7e077de4421..7ef791997dd32 100644 --- a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt +++ b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(7,3): 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 '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. tests/cases/compiler/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 '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. @@ -16,7 +16,7 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type ' insideClass: FuncType = function(val) { // error span goes from here ~~~~~~~~~~~ !!! 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 '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. !!! error TS2322: Type 'undefined' is not assignable to type 'string'. switch (val) { case 1: @@ -37,7 +37,7 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type ' const outsideClass: FuncType = function(val) { // compare to errors only on this line in this case ~~~~~~~~~~~~ !!! 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 '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. !!! error TS2322: Type 'undefined' is not assignable to type 'string'. switch (val) { case 1: diff --git a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt index 5276e42c4de8a..0fffac781bbc4 100644 --- a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt +++ b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt @@ -2,17 +2,17 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick | ChannelOfType, "type">'. Types of property 'type' are incompatible. Type 'T' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. - Type 'string' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. + Type '"text" | "email"' 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 '"text" | "email"' is not assignable to type 'ChannelOfType["type"]'. Type 'string' is not assignable to type 'ChannelOfType["type"]'. Type 'string' is not assignable to type 'T & "text"'. Type 'string' 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 'T & "text"'. - Type 'string' is not assignable to type 'T & "text"'. + Type '"text" | "email"' is not assignable to type 'T & "text"'. Type 'string' is not assignable to type 'T & "text"'. Type 'string' 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"'. @@ -60,17 +60,17 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t !!! error TS2322: Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick | ChannelOfType, "type">'. !!! error TS2322: Types of property 'type' are incompatible. !!! error TS2322: Type 'T' 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 '"text" | "email"' 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 '"text" | "email"' 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 'T & "text"'. !!! error TS2322: Type 'string' 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 'T & "text"'. -!!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. +!!! error TS2322: Type '"text" | "email"' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' 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"'. diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index e15d0ba769c90..f4175aa793473 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -45,7 +45,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. Type 'number' is not assignable to type 'T'. '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. - Type 'string | number' is not assignable to type 'T'. + Type '"" | 0' is not assignable to type 'T'. '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type 'string' is not assignable to type 'T'. '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. @@ -285,7 +285,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS !!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. !!! error TS2322: Type 'number' is not assignable to type 'T'. !!! error TS2322: '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. -!!! error TS2322: Type 'string | number' is not assignable to type 'T'. +!!! error TS2322: Type '"" | 0' is not assignable to type 'T'. !!! error TS2322: '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type 'string' is not assignable to type 'T'. !!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. diff --git a/tests/baselines/reference/controlFlowArrayErrors.errors.txt b/tests/baselines/reference/controlFlowArrayErrors.errors.txt index 91ff3032c6224..317dba264ef64 100644 --- a/tests/baselines/reference/controlFlowArrayErrors.errors.txt +++ b/tests/baselines/reference/controlFlowArrayErrors.errors.txt @@ -4,8 +4,8 @@ tests/cases/compiler/controlFlowArrayErrors.ts(11,9): error TS7034: Variable 'x' tests/cases/compiler/controlFlowArrayErrors.ts(13,13): error TS7005: Variable 'x' implicitly has an 'any[]' type. tests/cases/compiler/controlFlowArrayErrors.ts(19,9): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined. tests/cases/compiler/controlFlowArrayErrors.ts(22,9): error TS7005: Variable 'x' implicitly has an 'any[]' type. -tests/cases/compiler/controlFlowArrayErrors.ts(29,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. -tests/cases/compiler/controlFlowArrayErrors.ts(34,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. +tests/cases/compiler/controlFlowArrayErrors.ts(29,12): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +tests/cases/compiler/controlFlowArrayErrors.ts(34,12): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. tests/cases/compiler/controlFlowArrayErrors.ts(48,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. tests/cases/compiler/controlFlowArrayErrors.ts(56,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/compiler/controlFlowArrayErrors.ts(60,11): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined. @@ -55,14 +55,14 @@ tests/cases/compiler/controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x' x = [5, "hello"]; // Non-evolving array x.push(true); // Error ~~~~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. } function f5() { let x = [5, "hello"]; // Non-evolving array x.push(true); // Error ~~~~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. } function f6() { diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index 12beead1afb2a..b959911266bcb 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt @@ -13,7 +13,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( Property 'z' is missing in type '{}' but required in type '{ z: number; }'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(36,6): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(37,6): error TS2322: Type 'boolean' is not assignable to type 'number'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,6): error TS2322: Type 'boolean' is not assignable to type 'string | number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,6): error TS2322: Type 'true' is not assignable to type 'string | number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(39,11): error TS2322: Type 'boolean' is not assignable to type '[[any]]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(40,13): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(46,13): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. @@ -98,7 +98,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( !!! error TS2322: Type 'boolean' is not assignable to type 'number'. c3({ b: true }); // Error, implied type is { b: number|string }. ~ -!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. +!!! error TS2322: Type 'true' is not assignable to type 'string | number'. !!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts:29:20: The expected type comes from property 'b' which is declared here on type '{ b: string | number; }' c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]] ~~~~~ diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index 98a9ff93f7090..1f7d1b48d604e 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(14,17): error TS1047: A rest parameter cannot be optional. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(15,16): error TS1048: A rest parameter cannot have an initializer. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(21,7): error TS2552: Cannot find name 'array2'. Did you mean 'Array'? tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(22,11): error TS2322: Type 'string' is not assignable to type '[[any]]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(23,4): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'. @@ -37,7 +37,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(1, 2, "hello", true); // Error, parameter type is (number|string)[] ~~~~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'? diff --git a/tests/baselines/reference/intersectionPropertyCheck.errors.txt b/tests/baselines/reference/intersectionPropertyCheck.errors.txt index 568c3a82ad844..7c74c3512eaf1 100644 --- a/tests/baselines/reference/intersectionPropertyCheck.errors.txt +++ b/tests/baselines/reference/intersectionPropertyCheck.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/intersectionPropertyCheck.ts(4,5): error TS2322: Type '{ a: tests/cases/compiler/intersectionPropertyCheck.ts(7,3): error TS2322: Type 'T & { a: boolean; }' is not assignable to type '{ a?: string | undefined; }'. Types of property 'a' are incompatible. Type 'boolean' is not assignable to type 'string | undefined'. -tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'boolean' is not assignable to type 'string[] | undefined'. +tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'true' is not assignable to type 'string[] | undefined'. ==== tests/cases/compiler/intersectionPropertyCheck.ts (4 errors) ==== @@ -40,7 +40,7 @@ tests/cases/compiler/intersectionPropertyCheck.ts(17,22): error TS2322: Type 'bo function test(value: T): Test { return { ...value, hi: true } ~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'string[] | undefined'. +!!! error TS2322: Type 'true' is not assignable to type 'string[] | undefined'. !!! related TS6500 tests/cases/compiler/intersectionPropertyCheck.ts:13:12: The expected type comes from property 'hi' which is declared here on type 'Test' } \ No newline at end of file diff --git a/tests/baselines/reference/noErrorTruncation.errors.txt b/tests/baselines/reference/noErrorTruncation.errors.txt index 0bc6d295c025f..d5244df81a893 100644 --- a/tests/baselines/reference/noErrorTruncation.errors.txt +++ b/tests/baselines/reference/noErrorTruncation.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type 'number' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. +tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type '42' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. ==== tests/cases/compiler/noErrorTruncation.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type 'number' is const x: SomeLongOptionA ~ -!!! error TS2322: Type 'number' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. +!!! error TS2322: Type '42' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD diff --git a/tests/baselines/reference/objectCreate-errors.errors.txt b/tests/baselines/reference/objectCreate-errors.errors.txt index 7303795d93c15..12f62cc4d2cb3 100644 --- a/tests/baselines/reference/objectCreate-errors.errors.txt +++ b/tests/baselines/reference/objectCreate-errors.errors.txt @@ -1,23 +1,23 @@ -tests/cases/compiler/objectCreate-errors.ts(1,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'. -tests/cases/compiler/objectCreate-errors.ts(2,24): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'. -tests/cases/compiler/objectCreate-errors.ts(3,24): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(1,24): error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(2,24): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(3,24): error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'. tests/cases/compiler/objectCreate-errors.ts(4,24): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'. -tests/cases/compiler/objectCreate-errors.ts(7,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'. -tests/cases/compiler/objectCreate-errors.ts(8,24): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'. -tests/cases/compiler/objectCreate-errors.ts(9,24): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(7,24): error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(8,24): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'. +tests/cases/compiler/objectCreate-errors.ts(9,24): error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'. tests/cases/compiler/objectCreate-errors.ts(10,24): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'. ==== tests/cases/compiler/objectCreate-errors.ts (8 errors) ==== var e1 = Object.create(1); // Error ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'. var e2 = Object.create("string"); // Error ~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'. var e3 = Object.create(false); // Error ~~~~~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'. var e4 = Object.create(undefined); // Error ~~~~~~~~~ !!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'. @@ -25,13 +25,13 @@ tests/cases/compiler/objectCreate-errors.ts(10,24): error TS2345: Argument of ty var e5 = Object.create(1, {}); // Error ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'object | null'. var e6 = Object.create("string", {}); // Error ~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'object | null'. var e7 = Object.create(false, {}); // Error ~~~~~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object | null'. +!!! error TS2345: Argument of type 'false' is not assignable to parameter of type 'object | null'. var e8 = Object.create(undefined, {}); // Error ~~~~~~~~~ !!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'object | null'. \ No newline at end of file diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index 7996f2807cf17..8b5518e958fc8 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(11,11): error TS2769: Overload 2 of 6, '(this: (this: undefined, ...args: (10 | 20)[]) => string, thisArg: undefined, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. The 'this' context of type '(a: number, b: string) => string' is not assignable to method's 'this' of type '(this: undefined, ...args: (10 | 20)[]) => string'. Types of parameters 'b' and 'args' are incompatible. - Type 'number' is not assignable to type 'string'. + Type '10 | 20' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(17,15): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(18,35): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. @@ -21,7 +21,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(41,11): error TS2769: Overload 2 of 6, '(this: (this: C, ...args: (10 | 20)[]) => string, thisArg: C, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. The 'this' context of type '(this: C, a: number, b: string) => string' is not assignable to method's 'this' of type '(this: C, ...args: (10 | 20)[]) => string'. Types of parameters 'b' and 'args' are incompatible. - Type 'number' is not assignable to type 'string'. + Type '10 | 20' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(42,11): error TS2769: No overload matches this call. Overload 1 of 6, '(this: (this: C, a: number, b: string) => string, thisArg: C): (a: number, b: string) => string', gave the following error. @@ -45,7 +45,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(62,11): error TS2769: Overload 2 of 6, '(this: new (...args: (10 | 20)[]) => C, thisArg: any, ...args: (10 | 20)[]): new (...args: (10 | 20)[]) => C', gave the following error. The 'this' context of type 'typeof C' is not assignable to method's 'this' of type 'new (...args: (10 | 20)[]) => C'. Types of parameters 'b' and 'args' are incompatible. - Type 'number' is not assignable to type 'string'. + Type '10 | 20' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(65,3): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. @@ -74,7 +74,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2769: Overload 2 of 6, '(this: (this: undefined, ...args: (10 | 20)[]) => string, thisArg: undefined, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. !!! error TS2769: The 'this' context of type '(a: number, b: string) => string' is not assignable to method's 'this' of type '(this: undefined, ...args: (10 | 20)[]) => string'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. !!! error TS2769: Type 'number' is not assignable to type 'string'. let f04 = overloaded.bind(undefined); // typeof overloaded @@ -128,7 +128,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2769: Overload 2 of 6, '(this: (this: C, ...args: (10 | 20)[]) => string, thisArg: C, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. !!! error TS2769: The 'this' context of type '(this: C, a: number, b: string) => string' is not assignable to method's 'this' of type '(this: C, ...args: (10 | 20)[]) => string'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. !!! error TS2769: Type 'number' is not assignable to type 'string'. let f14 = c.foo.bind(undefined); // Error ~~~~~~~~~~~~~~~~~~~~~ @@ -183,7 +183,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2769: Overload 2 of 6, '(this: new (...args: (10 | 20)[]) => C, thisArg: any, ...args: (10 | 20)[]): new (...args: (10 | 20)[]) => C', gave the following error. !!! error TS2769: The 'this' context of type 'typeof C' is not assignable to method's 'this' of type 'new (...args: (10 | 20)[]) => C'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. !!! error TS2769: Type 'number' is not assignable to type 'string'. C.call(c, 10, "hello"); diff --git a/tests/baselines/reference/tsxAttributeResolution14.errors.txt b/tests/baselines/reference/tsxAttributeResolution14.errors.txt index 84fa778968886..71b5e329f4868 100644 --- a/tests/baselines/reference/tsxAttributeResolution14.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution14.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(13,28): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'boolean' is not assignable to type 'string | number'. +tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'true' is not assignable to type 'string | number'. ==== tests/cases/conformance/jsx/react.d.ts (0 errors) ==== @@ -31,7 +31,7 @@ tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'boolean' is not // ok // error ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. +!!! error TS2322: Type 'true' is not assignable to type 'string | number'. !!! related TS6501 tests/cases/conformance/jsx/file.tsx:3:3: The expected type comes from this index signature. ) diff --git a/tests/baselines/reference/typeFromJSConstructor.errors.txt b/tests/baselines/reference/typeFromJSConstructor.errors.txt index 9124b5044d267..9a883a7b4a7e9 100644 --- a/tests/baselines/reference/typeFromJSConstructor.errors.txt +++ b/tests/baselines/reference/typeFromJSConstructor.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/salsa/a.js(10,5): error TS7008: Member 'twices' implicit tests/cases/conformance/salsa/a.js(14,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/salsa/a.js(21,5): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/salsa/a.js(24,5): error TS2322: Type 'null' is not assignable to type 'string | undefined'. -tests/cases/conformance/salsa/a.js(25,5): error TS2322: Type 'boolean' is not assignable to type 'string | undefined'. +tests/cases/conformance/salsa/a.js(25,5): error TS2322: Type 'false' is not assignable to type 'string | undefined'. tests/cases/conformance/salsa/a.js(26,5): error TS2531: Object is possibly 'null'. @@ -41,7 +41,7 @@ tests/cases/conformance/salsa/a.js(26,5): error TS2531: Object is possibly 'null !!! error TS2322: Type 'null' is not assignable to type 'string | undefined'. this.twice = false // error ~~~~~~~~~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'string | undefined'. +!!! error TS2322: Type 'false' is not assignable to type 'string | undefined'. this.twices.push(1) // error: Object is possibly null ~~~~~~~~~~~ !!! error TS2531: Object is possibly 'null'. diff --git a/tests/baselines/reference/typeFromJSInitializer.errors.txt b/tests/baselines/reference/typeFromJSInitializer.errors.txt index 91ab058fac35d..08d66a2a9f388 100644 --- a/tests/baselines/reference/typeFromJSInitializer.errors.txt +++ b/tests/baselines/reference/typeFromJSInitializer.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/salsa/a.js(4,5): error TS7008: Member 'unknowable' impli tests/cases/conformance/salsa/a.js(5,5): error TS7008: Member 'empty' implicitly has an 'any[]' type. tests/cases/conformance/salsa/a.js(25,12): error TS7006: Parameter 'a' implicitly has an 'any' type. tests/cases/conformance/salsa/a.js(25,29): error TS7006: Parameter 'l' implicitly has an 'any[]' type. -tests/cases/conformance/salsa/a.js(37,5): error TS2322: Type 'string' is not assignable to type 'number | undefined'. +tests/cases/conformance/salsa/a.js(37,5): error TS2322: Type '"error"' is not assignable to type 'number | undefined'. ==== tests/cases/conformance/salsa/a.js (6 errors) ==== @@ -55,7 +55,7 @@ tests/cases/conformance/salsa/a.js(37,5): error TS2322: Type 'string' is not ass b = undefined b = 'error' ~ -!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'. +!!! error TS2322: Type '"error"' is not assignable to type 'number | undefined'. // l should be any[] l.push(1) diff --git a/tests/baselines/reference/typeOfOperator1.errors.txt b/tests/baselines/reference/typeOfOperator1.errors.txt index 6349e2b4eec38..b83f1c01dedf7 100644 --- a/tests/baselines/reference/typeOfOperator1.errors.txt +++ b/tests/baselines/reference/typeOfOperator1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. @@ -7,5 +7,5 @@ tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type 'string' is not var y: string = typeof x; var z: number = typeof x; ~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file From 99cdb64839afd3a21faf01c3b45e4a2ef2738e4a Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 22 Apr 2020 12:48:23 -0400 Subject: [PATCH 08/14] Used DH's suggested heuristic --- src/compiler/checker.ts | 2 +- tests/baselines/reference/bigintIndex.errors.txt | 4 ++-- .../reference/checkJsdocReturnTag2.errors.txt | 8 ++++---- .../classPropertyErrorOnNameOnly.errors.txt | 8 ++++---- ...ccessKeyofReliesOnKeyofNeverUpperBound.errors.txt | 12 ++++++------ .../baselines/reference/conditionalTypes1.errors.txt | 4 ++-- .../reference/controlFlowArrayErrors.errors.txt | 8 ++++---- .../destructuringParameterDeclaration2.errors.txt | 4 ++-- .../destructuringParameterDeclaration4.errors.txt | 4 ++-- .../baselines/reference/noErrorTruncation.errors.txt | 4 ++-- .../reference/strictBindCallApply1.errors.txt | 12 ++++++------ .../reference/tsxAttributeResolution14.errors.txt | 4 ++-- tests/baselines/reference/typeOfOperator1.errors.txt | 4 ++-- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1dd9fb9255b99..791123e8479cf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15489,7 +15489,7 @@ namespace ts { } } - if (isLiteralType(source) && !(source.flags & TypeFlags.Union) && !isLiteralType(target) && !(target.flags & TypeFlags.Union)) { + if (isLiteralType(source) && !forEachType(target, isUnitType)) { generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source)); } diff --git a/tests/baselines/reference/bigintIndex.errors.txt b/tests/baselines/reference/bigintIndex.errors.txt index daf9fa7562dd9..216e2d4857f07 100644 --- a/tests/baselines/reference/bigintIndex.errors.txt +++ b/tests/baselines/reference/bigintIndex.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/a.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/compiler/a.ts(8,11): error TS2538: Type '1n' cannot be used as an index type. -tests/cases/compiler/a.ts(14,1): error TS2322: Type '123n' is not assignable to type 'string | number | symbol'. +tests/cases/compiler/a.ts(14,1): error TS2322: Type 'bigint' is not assignable to type 'string | number | symbol'. tests/cases/compiler/a.ts(19,12): error TS2538: Type 'bigint' cannot be used as an index type. tests/cases/compiler/b.ts(2,12): error TS1136: Property assignment expected. tests/cases/compiler/b.ts(2,14): error TS1005: ';' expected. @@ -29,7 +29,7 @@ tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be key = Symbol(); key = 123n; // should error ~~~ -!!! error TS2322: Type '123n' is not assignable to type 'string | number | symbol'. +!!! error TS2322: Type 'bigint' is not assignable to type 'string | number | symbol'. // Show correct usage of bigint index: explicitly convert to string const bigNum: bigint = 0n; diff --git a/tests/baselines/reference/checkJsdocReturnTag2.errors.txt b/tests/baselines/reference/checkJsdocReturnTag2.errors.txt index fcc4f25694d1e..8ff291f2e5579 100644 --- a/tests/baselines/reference/checkJsdocReturnTag2.errors.txt +++ b/tests/baselines/reference/checkJsdocReturnTag2.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/jsdoc/returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'true | 5' is not assignable to type 'string | number'. - Type 'true' is not assignable to type 'string | number'. +tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. + Type 'boolean' is not assignable to type 'string | number'. ==== tests/cases/conformance/jsdoc/returns.js (2 errors) ==== @@ -20,6 +20,6 @@ tests/cases/conformance/jsdoc/returns.js(13,5): error TS2322: Type 'true | 5' is function f1() { return 5 || true; ~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'true | 5' is not assignable to type 'string | number'. -!!! error TS2322: Type 'true' is not assignable to type 'string | number'. +!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. } \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt index 7ef791997dd32..6a7e077de4421 100644 --- a/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt +++ b/tests/baselines/reference/classPropertyErrorOnNameOnly.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(7,3): error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. - Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. + Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. - Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. + Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. @@ -16,7 +16,7 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type ' insideClass: FuncType = function(val) { // error span goes from here ~~~~~~~~~~~ !!! error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. -!!! error TS2322: Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. +!!! 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: @@ -37,7 +37,7 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type ' const outsideClass: FuncType = function(val) { // compare to errors only on this line in this case ~~~~~~~~~~~~ !!! error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'. -!!! error TS2322: Type '"1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'string'. +!!! 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: diff --git a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt index 0fffac781bbc4..5276e42c4de8a 100644 --- a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt +++ b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt @@ -2,17 +2,17 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick | ChannelOfType, "type">'. Types of property 'type' are incompatible. Type 'T' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. - Type '"text" | "email"' 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"] & ChannelOfType["type"]'. Type 'string' is not assignable to type 'ChannelOfType["type"]'. Type 'T' is not assignable to type 'ChannelOfType["type"]'. - Type '"text" | "email"' 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 'string' is not assignable to type 'T & "text"'. Type 'string' 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 'T & "text"'. - Type '"text" | "email"' is not assignable to type 'T & "text"'. + Type 'string' is not assignable to type 'T & "text"'. Type 'string' is not assignable to type 'T & "text"'. Type 'string' 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"'. @@ -60,17 +60,17 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t !!! error TS2322: Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick | ChannelOfType, "type">'. !!! error TS2322: Types of property 'type' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. -!!! error TS2322: Type '"text" | "email"' 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"] & 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 '"text" | "email"' 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 'string' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' 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 'T & "text"'. -!!! error TS2322: Type '"text" | "email"' is not assignable to type 'T & "text"'. +!!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. !!! error TS2322: Type 'string' 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"'. diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index f4175aa793473..e15d0ba769c90 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -45,7 +45,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. Type 'number' is not assignable to type 'T'. '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. - Type '"" | 0' is not assignable to type 'T'. + Type 'string | number' is not assignable to type 'T'. '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type 'string' is not assignable to type 'T'. '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. @@ -285,7 +285,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS !!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. !!! error TS2322: Type 'number' is not assignable to type 'T'. !!! error TS2322: '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. -!!! error TS2322: Type '"" | 0' is not assignable to type 'T'. +!!! error TS2322: Type 'string | number' is not assignable to type 'T'. !!! error TS2322: '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type 'string' is not assignable to type 'T'. !!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. diff --git a/tests/baselines/reference/controlFlowArrayErrors.errors.txt b/tests/baselines/reference/controlFlowArrayErrors.errors.txt index 317dba264ef64..91ff3032c6224 100644 --- a/tests/baselines/reference/controlFlowArrayErrors.errors.txt +++ b/tests/baselines/reference/controlFlowArrayErrors.errors.txt @@ -4,8 +4,8 @@ tests/cases/compiler/controlFlowArrayErrors.ts(11,9): error TS7034: Variable 'x' tests/cases/compiler/controlFlowArrayErrors.ts(13,13): error TS7005: Variable 'x' implicitly has an 'any[]' type. tests/cases/compiler/controlFlowArrayErrors.ts(19,9): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined. tests/cases/compiler/controlFlowArrayErrors.ts(22,9): error TS7005: Variable 'x' implicitly has an 'any[]' type. -tests/cases/compiler/controlFlowArrayErrors.ts(29,12): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. -tests/cases/compiler/controlFlowArrayErrors.ts(34,12): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +tests/cases/compiler/controlFlowArrayErrors.ts(29,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. +tests/cases/compiler/controlFlowArrayErrors.ts(34,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. tests/cases/compiler/controlFlowArrayErrors.ts(48,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. tests/cases/compiler/controlFlowArrayErrors.ts(56,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/compiler/controlFlowArrayErrors.ts(60,11): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined. @@ -55,14 +55,14 @@ tests/cases/compiler/controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x' x = [5, "hello"]; // Non-evolving array x.push(true); // Error ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. } function f5() { let x = [5, "hello"]; // Non-evolving array x.push(true); // Error ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. } function f6() { diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index b959911266bcb..12beead1afb2a 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt @@ -13,7 +13,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( Property 'z' is missing in type '{}' but required in type '{ z: number; }'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(36,6): error TS2322: Type 'boolean' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(37,6): error TS2322: Type 'boolean' is not assignable to type 'number'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,6): error TS2322: Type 'true' is not assignable to type 'string | number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,6): error TS2322: Type 'boolean' is not assignable to type 'string | number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(39,11): error TS2322: Type 'boolean' is not assignable to type '[[any]]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(40,13): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(46,13): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. @@ -98,7 +98,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( !!! error TS2322: Type 'boolean' is not assignable to type 'number'. c3({ b: true }); // Error, implied type is { b: number|string }. ~ -!!! error TS2322: Type 'true' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. !!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts:29:20: The expected type comes from property 'b' which is declared here on type '{ b: string | number; }' c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]] ~~~~~ diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index 1f7d1b48d604e..98a9ff93f7090 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(14,17): error TS1047: A rest parameter cannot be optional. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(15,16): error TS1048: A rest parameter cannot have an initializer. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(21,7): error TS2552: Cannot find name 'array2'. Did you mean 'Array'? tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(22,11): error TS2322: Type 'string' is not assignable to type '[[any]]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(23,4): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'. @@ -37,7 +37,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(1, 2, "hello", true); // Error, parameter type is (number|string)[] ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'? diff --git a/tests/baselines/reference/noErrorTruncation.errors.txt b/tests/baselines/reference/noErrorTruncation.errors.txt index d5244df81a893..0bc6d295c025f 100644 --- a/tests/baselines/reference/noErrorTruncation.errors.txt +++ b/tests/baselines/reference/noErrorTruncation.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type '42' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. +tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type 'number' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. ==== tests/cases/compiler/noErrorTruncation.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type '42' is not const x: SomeLongOptionA ~ -!!! error TS2322: Type '42' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. +!!! error TS2322: Type 'number' is not assignable to type 'SomeLongOptionA | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD | SomeLongOptionE | SomeLongOptionF'. | SomeLongOptionB | SomeLongOptionC | SomeLongOptionD diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index 8b5518e958fc8..7996f2807cf17 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(11,11): error TS2769: Overload 2 of 6, '(this: (this: undefined, ...args: (10 | 20)[]) => string, thisArg: undefined, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. The 'this' context of type '(a: number, b: string) => string' is not assignable to method's 'this' of type '(this: undefined, ...args: (10 | 20)[]) => string'. Types of parameters 'b' and 'args' are incompatible. - Type '10 | 20' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(17,15): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(18,35): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. @@ -21,7 +21,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(41,11): error TS2769: Overload 2 of 6, '(this: (this: C, ...args: (10 | 20)[]) => string, thisArg: C, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. The 'this' context of type '(this: C, a: number, b: string) => string' is not assignable to method's 'this' of type '(this: C, ...args: (10 | 20)[]) => string'. Types of parameters 'b' and 'args' are incompatible. - Type '10 | 20' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(42,11): error TS2769: No overload matches this call. Overload 1 of 6, '(this: (this: C, a: number, b: string) => string, thisArg: C): (a: number, b: string) => string', gave the following error. @@ -45,7 +45,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(62,11): error TS2769: Overload 2 of 6, '(this: new (...args: (10 | 20)[]) => C, thisArg: any, ...args: (10 | 20)[]): new (...args: (10 | 20)[]) => C', gave the following error. The 'this' context of type 'typeof C' is not assignable to method's 'this' of type 'new (...args: (10 | 20)[]) => C'. Types of parameters 'b' and 'args' are incompatible. - Type '10 | 20' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(65,3): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. @@ -74,7 +74,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2769: Overload 2 of 6, '(this: (this: undefined, ...args: (10 | 20)[]) => string, thisArg: undefined, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. !!! error TS2769: The 'this' context of type '(a: number, b: string) => string' is not assignable to method's 'this' of type '(this: undefined, ...args: (10 | 20)[]) => string'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. !!! error TS2769: Type 'number' is not assignable to type 'string'. let f04 = overloaded.bind(undefined); // typeof overloaded @@ -128,7 +128,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2769: Overload 2 of 6, '(this: (this: C, ...args: (10 | 20)[]) => string, thisArg: C, ...args: (10 | 20)[]): (...args: (10 | 20)[]) => string', gave the following error. !!! error TS2769: The 'this' context of type '(this: C, a: number, b: string) => string' is not assignable to method's 'this' of type '(this: C, ...args: (10 | 20)[]) => string'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. !!! error TS2769: Type 'number' is not assignable to type 'string'. let f14 = c.foo.bind(undefined); // Error ~~~~~~~~~~~~~~~~~~~~~ @@ -183,7 +183,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: !!! error TS2769: Overload 2 of 6, '(this: new (...args: (10 | 20)[]) => C, thisArg: any, ...args: (10 | 20)[]): new (...args: (10 | 20)[]) => C', gave the following error. !!! error TS2769: The 'this' context of type 'typeof C' is not assignable to method's 'this' of type 'new (...args: (10 | 20)[]) => C'. !!! error TS2769: Types of parameters 'b' and 'args' are incompatible. -!!! error TS2769: Type '10 | 20' is not assignable to type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. !!! error TS2769: Type 'number' is not assignable to type 'string'. C.call(c, 10, "hello"); diff --git a/tests/baselines/reference/tsxAttributeResolution14.errors.txt b/tests/baselines/reference/tsxAttributeResolution14.errors.txt index 71b5e329f4868..84fa778968886 100644 --- a/tests/baselines/reference/tsxAttributeResolution14.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution14.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(13,28): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'true' is not assignable to type 'string | number'. +tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'boolean' is not assignable to type 'string | number'. ==== tests/cases/conformance/jsx/react.d.ts (0 errors) ==== @@ -31,7 +31,7 @@ tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'true' is not as // ok // error ~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'true' is not assignable to type 'string | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'. !!! related TS6501 tests/cases/conformance/jsx/file.tsx:3:3: The expected type comes from this index signature. ) diff --git a/tests/baselines/reference/typeOfOperator1.errors.txt b/tests/baselines/reference/typeOfOperator1.errors.txt index b83f1c01dedf7..6349e2b4eec38 100644 --- a/tests/baselines/reference/typeOfOperator1.errors.txt +++ b/tests/baselines/reference/typeOfOperator1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' is not assignable to type 'number'. +tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type 'string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. @@ -7,5 +7,5 @@ tests/cases/compiler/typeOfOperator1.ts(3,5): error TS2322: Type '"string" | "nu var y: string = typeof x; var z: number = typeof x; ~ -!!! error TS2322: Type '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file From d4825ab90fe2d13a66450d71a1b2d190413d114f Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 27 Apr 2020 19:59:41 -0400 Subject: [PATCH 09/14] I did everything you said I followed all the rules --- src/compiler/checker.ts | 12 +++++- ...yofReliesOnKeyofNeverUpperBound.errors.txt | 40 +++++++++---------- .../reference/conditionalTypes1.errors.txt | 12 +++--- ...mplementationWithDefaultValues2.errors.txt | 4 +- .../derivedGenericClassWithAny.errors.txt | 8 ++-- ...cCallWithFunctionTypedArguments.errors.txt | 12 +++--- ...lWithGenericSignatureArguments2.errors.txt | 8 ++-- ...thObjectTypeArgsAndInitializers.errors.txt | 4 +- ...kedInsideItsContainingFunction1.errors.txt | 4 +- ...ithFunctionTypedMemberArguments.errors.txt | 12 +++--- .../genericWithOpenTypeParameters1.errors.txt | 4 +- .../keyofAndIndexedAccess2.errors.txt | 24 +++++------ .../keyofAndIndexedAccessErrors.errors.txt | 16 ++++---- .../keyofIsLiteralContexualType.errors.txt | 4 +- ...OnFunctionsWithNoTypeParameters.errors.txt | 4 +- 15 files changed, 89 insertions(+), 79 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 791123e8479cf..5067bef7adf01 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15489,13 +15489,23 @@ namespace ts { } } - if (isLiteralType(source) && !forEachType(target, isUnitType)) { + if (isLiteralType(source) && !typeCouldHaveNoTopLevelSingletonTypes(target)) { generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source)); } reportError(message, generalizedSourceType, targetType); } + function typeCouldHaveNoTopLevelSingletonTypes(type: Type) { + return forEachType(type, typeCouldHaveNoTopLevelSingletonTypesWorker); + } + + function typeCouldHaveNoTopLevelSingletonTypesWorker(type: Type): boolean { + return (type.flags & TypeFlags.Intersection) + ? !!forEach((type as IntersectionType).types, typeCouldHaveNoTopLevelSingletonTypesWorker) + : isUnitType(type) || !!(type.flags & TypeFlags.Instantiable); + } + function tryElaborateErrorsForPrimitivesAndObjects(source: Type, target: Type) { const sourceType = symbolValueDeclarationIsContextSensitive(source.symbol) ? typeToString(source, source.symbol.valueDeclaration) : typeToString(source); const targetType = symbolValueDeclarationIsContextSensitive(target.symbol) ? typeToString(target, target.symbol.valueDeclaration) : typeToString(target); diff --git a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt index 5276e42c4de8a..af63c18523d6a 100644 --- a/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt +++ b/tests/baselines/reference/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt @@ -2,19 +2,19 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick | ChannelOfType, "type">'. Types of property 'type' are incompatible. Type 'T' 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"] & ChannelOfType["type"]'. - Type 'string' is not assignable to type 'ChannelOfType["type"]'. + Type '"text" | "email"' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. + Type '"text"' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. + Type '"text"' 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 'string' is not assignable to type 'T & "text"'. - Type 'string' is not assignable to type 'T'. + Type '"text" | "email"' is not assignable to type 'ChannelOfType["type"]'. + Type '"text"' 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 'T & "text"'. - Type 'string' is not assignable to type 'T & "text"'. - Type 'string' is not assignable to type 'T & "text"'. - Type 'string' is not assignable to type 'T'. + 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"'. @@ -60,19 +60,19 @@ tests/cases/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.t !!! error TS2322: Type '{ type: T; localChannelId: string; }' is not assignable to type 'Pick | ChannelOfType, "type">'. !!! error TS2322: Types of property 'type' are incompatible. !!! error TS2322: Type 'T' 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"] & ChannelOfType["type"]'. -!!! error TS2322: Type 'string' is not assignable to type 'ChannelOfType["type"]'. +!!! error TS2322: Type '"text" | "email"' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. +!!! error TS2322: Type '"text"' is not assignable to type 'ChannelOfType["type"] & ChannelOfType["type"]'. +!!! error TS2322: Type '"text"' 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 'string' is not assignable to type 'T & "text"'. -!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: Type '"text" | "email"' is not assignable to type 'ChannelOfType["type"]'. +!!! error TS2322: Type '"text"' 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 'T & "text"'. -!!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. -!!! error TS2322: Type 'string' is not assignable to type 'T & "text"'. -!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! 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"'. diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index e15d0ba769c90..f83761215e50a 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -43,11 +43,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2 'ZeroOf' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. - Type 'number' is not assignable to type 'T'. + Type '0' is not assignable to type 'T'. '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. - Type 'string | number' is not assignable to type 'T'. + Type '"" | 0' is not assignable to type 'T'. '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. - Type 'string' is not assignable to type 'T'. + Type '""' is not assignable to type 'T'. '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf'. Type 'string | number' is not assignable to type 'ZeroOf'. @@ -283,11 +283,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS !!! error TS2322: 'ZeroOf' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. !!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. -!!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: Type '0' is not assignable to type 'T'. !!! error TS2322: '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. -!!! error TS2322: Type 'string | number' is not assignable to type 'T'. +!!! error TS2322: Type '"" | 0' is not assignable to type 'T'. !!! error TS2322: '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. -!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: Type '""' is not assignable to type 'T'. !!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. y = x; // Error ~ diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt index 2cceb88175a09..a260247188962 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type 'number' is not assignable to type 'T'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type '1' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,27): error TS2322: Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. @@ -21,7 +21,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co constructor(x: T, y: U); constructor(x: T = 1, public y: U = x) { // error ~~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: Type '1' is not assignable to type 'T'. !!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. ~~~~~~~~~~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'U'. diff --git a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt index 4abd4a4cd09d6..e63849e4aa887 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt @@ -2,9 +2,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type 'string' is not assignable to type 'T'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type '""' is not assignable to type 'T'. '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type 'string' is not assignable to type 'T'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type '""' is not assignable to type 'T'. '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E' is not assignable to type 'C'. Types of property 'x' are incompatible. @@ -51,12 +51,12 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: Type '""' is not assignable to type 'T'. !!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. foo(): T { return ''; // error ~~~~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: Type '""' is not assignable to type 'T'. !!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. } } diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt index 53ef67b340d62..5dad15dd775e8 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -2,15 +2,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun Type 'string' is not assignable to type '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type 'number' is not assignable to type 'T'. + Type '1' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type 'number' is not assignable to type 'T'. + Type '1' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,24): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type 'number' is not assignable to type 'T'. + Type '1' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,23): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -53,7 +53,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: Type '1' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r10 = foo2(1, (x) => ''); // string @@ -61,13 +61,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: Type '1' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r11b = foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: Type '1' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r12 = foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index 2e6ced0af8696..e179f079011e8 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. @@ -12,7 +12,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,43): error TS2322: Type 'F' is not assignable to type 'E'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. @@ -47,7 +47,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen !!! error TS2345: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. var r10 = r7(1); // error ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. } @@ -96,7 +96,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen !!! error TS2345: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. var r10 = r7(1); ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. } diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt index b37937c9edbb1..9e22e42299c89 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type 'number' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type '1' is not assignable to type 'T'. '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(6,37): error TS2322: Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. @@ -15,7 +15,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC function foo2(x: T = undefined) { return x; } // ok function foo3(x: T = 1) { } // error ~~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: Type '1' is not assignable to type 'T'. !!! error TS2322: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. function foo4(x: T, y: U = x) { } // error ~~~~~~~~ diff --git a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt index 1f179fb32675a..c8a67a59d2140 100644 --- a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt +++ b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,16): error TS2558: Expected 0 type arguments, but got 1. -tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,17): error TS2558: Expected 0 type arguments, but got 1. @@ -17,7 +17,7 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17 !!! error TS2558: Expected 0 type arguments, but got 1. var r2 = f(1); ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r3 = f(null); ~~~ diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt index db9943c5ba2ed..b11f0fcfddb2e 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,14 +1,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,29): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type 'number' is not assignable to type 'T'. + Type '1' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,30): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type 'number' is not assignable to type 'T'. + Type '1' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,31): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type 'number' is not assignable to type 'T'. + Type '1' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -75,7 +75,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: Type '1' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r10 = c.foo2(1, (x) => ''); // string @@ -83,13 +83,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: Type '1' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r11b = c3.foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'T'. +!!! error TS2345: Type '1' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r12 = c3.foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt index e8705615424c5..c824b71b534e2 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,41): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expected 0 type arguments, but got 1. @@ -13,7 +13,7 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expe x.foo(1); // no error var f = (x: B) => { return x.foo(1); } // error ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var f2 = (x: B) => { return x.foo(1); } // error ~ diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt index 88859ee6543ef..bd6b0b81c80f8 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt @@ -12,19 +12,19 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(18,5): error TS232 tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(19,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type 'T'. '{ [key: string]: number; }' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{ [key: string]: number; }'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(26,7): error TS2339: Property 'x' does not exist on type 'T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(27,5): error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(27,5): error TS2322: Type '1' is not assignable to type 'T[keyof T]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(31,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type '{ [P in K]: number; }'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(38,5): error TS2322: Type '{ [x: string]: number; }' is not assignable to type '{ [P in K]: number; }'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(50,3): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Item'. No index signature with a parameter of type 'string' was found on type 'Item'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(51,3): error TS2322: Type 'number' is not assignable to type 'never'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(52,3): error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(53,3): error TS2322: Type 'number' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(52,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(53,3): error TS2322: Type '123' is not assignable to type 'T[K]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(65,7): error TS2339: Property 'foo' does not exist on type 'T'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(66,3): error TS2536: Type 'string' cannot be used to index type 'T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(67,3): error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(68,3): error TS2322: Type 'number' is not assignable to type 'T[K]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS2322: Type 'number' is not assignable to type 'Type[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(67,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(68,3): error TS2322: Type '123' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS2322: Type '123' is not assignable to type 'Type[K]'. Type 'number' is not assignable to type 'never'. @@ -82,7 +82,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS2339: Property 'x' does not exist on type 'T'. c[k] = 1; // Error, cannot write to index signature through constraint ~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. +!!! error TS2322: Type '1' is not assignable to type 'T[keyof T]'. } function f3(a: { [P in K]: number }, b: { [key: string]: number }, k: K) { @@ -118,10 +118,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS2322: Type 'number' is not assignable to type 'never'. obj[k3] = 123; // Error ~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. +!!! error TS2322: Type '123' is not assignable to type 'T[keyof T]'. obj[k4] = 123; // Error ~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'T[K]'. +!!! error TS2322: Type '123' is not assignable to type 'T[K]'. } type Dict = Record; @@ -141,10 +141,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS2536: Type 'string' cannot be used to index type 'T'. obj[k2] = 123; // Error ~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. +!!! error TS2322: Type '123' is not assignable to type 'T[keyof T]'. obj[k3] = 123; // Error ~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'T[K]'. +!!! error TS2322: Type '123' is not assignable to type 'T[K]'. } // Repro from #27895 @@ -186,7 +186,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 function get123(): Type[K] { return 123; // Error ~~~~~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'Type[K]'. +!!! error TS2322: Type '123' is not assignable to type 'Type[K]'. !!! error TS2322: Type 'number' is not assignable to type 'never'. } diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index 6bc2e322e17b8..1738d6d977369 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -69,10 +69,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(114,5): error tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error TS2322: Type 'T[K]' is not assignable to type 'U[J]'. Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(122,5): error TS2322: Type 'number' is not assignable to type 'keyof T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error TS2322: Type 'string' is not assignable to type 'keyof T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type 'number' is not assignable to type 'T[K]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(141,5): error TS2322: Type 'string' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(122,5): error TS2322: Type '42' is not assignable to type 'keyof T'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error TS2322: Type '"hello"' is not assignable to type 'keyof T'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type '42' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(141,5): error TS2322: Type '"hello"' is not assignable to type 'T[K]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error TS2322: Type 'number[]' is not assignable to type 'T[K]'. @@ -306,10 +306,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error function f4(k: keyof T) { k = 42; // error ~ -!!! error TS2322: Type 'number' is not assignable to type 'keyof T'. +!!! error TS2322: Type '42' is not assignable to type 'keyof T'. k = "hello"; // error ~ -!!! error TS2322: Type 'string' is not assignable to type 'keyof T'. +!!! error TS2322: Type '"hello"' is not assignable to type 'keyof T'. } // Repro from #27470 @@ -328,10 +328,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error function test1, K extends keyof T>(t: T, k: K) { t[k] = 42; // Error ~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'T[K]'. +!!! error TS2322: Type '42' is not assignable to type 'T[K]'. t[k] = "hello"; // Error ~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'T[K]'. +!!! error TS2322: Type '"hello"' is not assignable to type 'T[K]'. t[k] = [10, 20]; // Error ~~~~ !!! error TS2322: Type 'number[]' is not assignable to type 'T[K]'. diff --git a/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt b/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt index 7d6c194eddbc3..92f3d403d02ad 100644 --- a/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt +++ b/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/keyofIsLiteralContexualType.ts(5,37): error TS2322: Type 'string' is not assignable to type 'keyof T'. +tests/cases/compiler/keyofIsLiteralContexualType.ts(5,37): error TS2322: Type '"c"' is not assignable to type 'keyof T'. Type '"c"' is not assignable to type '"a" | "b"'. tests/cases/compiler/keyofIsLiteralContexualType.ts(13,11): error TS2339: Property 'b' does not exist on type 'Pick<{ a: number; b: number; c: number; }, "a" | "c">'. @@ -10,7 +10,7 @@ tests/cases/compiler/keyofIsLiteralContexualType.ts(13,11): error TS2339: Proper let a: (keyof T)[] = ["a", "b"]; let b: (keyof T)[] = ["a", "b", "c"]; ~~~ -!!! error TS2322: Type 'string' is not assignable to type 'keyof T'. +!!! error TS2322: Type '"c"' is not assignable to type 'keyof T'. !!! error TS2322: Type '"c"' is not assignable to type '"a" | "b"'. } diff --git a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt index 5da4df50ef1cb..aaa5cad857cc3 100644 --- a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt +++ b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(2,15): error TS2558: Expected 0 type arguments, but got 1. -tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): error TS2558: Expected 0 type arguments, but got 1. @@ -11,7 +11,7 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): erro !!! error TS2558: Expected 0 type arguments, but got 1. var r2 = f(1); ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r3 = f(null); ~~~ From a04ecb592c91c1b68e4893174ae420f21a6f3492 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 22 May 2020 00:40:28 +0000 Subject: [PATCH 10/14] Check constraints deeply on singleton types. --- src/compiler/checker.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 734fb738dfe94..5f1e95dbce33f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15764,23 +15764,13 @@ namespace ts { } } - if (isLiteralType(source) && !typeCouldHaveNoTopLevelSingletonTypes(target)) { + if (isLiteralType(source) && !typeCouldHaveTopLevelSingletonTypes(target)) { generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source)); } reportError(message, generalizedSourceType, targetType); } - function typeCouldHaveNoTopLevelSingletonTypes(type: Type) { - return forEachType(type, typeCouldHaveNoTopLevelSingletonTypesWorker); - } - - function typeCouldHaveNoTopLevelSingletonTypesWorker(type: Type): boolean { - return (type.flags & TypeFlags.Intersection) - ? !!forEach((type as IntersectionType).types, typeCouldHaveNoTopLevelSingletonTypesWorker) - : isUnitType(type) || !!(type.flags & TypeFlags.Instantiable); - } - function tryElaborateErrorsForPrimitivesAndObjects(source: Type, target: Type) { const sourceType = symbolValueDeclarationIsContextSensitive(source.symbol) ? typeToString(source, source.symbol.valueDeclaration) : typeToString(source); const targetType = symbolValueDeclarationIsContextSensitive(target.symbol) ? typeToString(target, target.symbol.valueDeclaration) : typeToString(target); @@ -17375,6 +17365,21 @@ namespace ts { } } + function typeCouldHaveTopLevelSingletonTypes(type: Type): boolean { + if (type.flags & TypeFlags.UnionOrIntersection) { + return !!forEach((type as IntersectionType).types, typeCouldHaveTopLevelSingletonTypes); + } + + if (type.flags & TypeFlags.Instantiable) { + const constraint = getConstraintOfType(type); + if (constraint) { + return typeCouldHaveTopLevelSingletonTypes(constraint); + } + } + + return isUnitType(type); + } + function getBestMatchingType(source: Type, target: UnionOrIntersectionType, isRelatedTo = compareTypesAssignable) { return findMatchingDiscriminantType(source, target, isRelatedTo, /*skipPartial*/ true) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || From b38b0c70b36711546e993c3dd873101726d27cfd Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 22 May 2020 00:40:43 +0000 Subject: [PATCH 11/14] Updated baselines. --- .../reference/conditionalTypes1.errors.txt | 12 +++++------ ...mplementationWithDefaultValues2.errors.txt | 4 ++-- .../derivedGenericClassWithAny.errors.txt | 8 ++++---- ...cCallWithFunctionTypedArguments.errors.txt | 12 +++++------ ...lWithGenericSignatureArguments2.errors.txt | 8 ++++---- ...thObjectTypeArgsAndInitializers.errors.txt | 4 ++-- ...kedInsideItsContainingFunction1.errors.txt | 4 ++-- ...ithFunctionTypedMemberArguments.errors.txt | 12 +++++------ .../genericWithOpenTypeParameters1.errors.txt | 4 ++-- .../keyofAndIndexedAccess2.errors.txt | 20 +++++++++---------- .../keyofAndIndexedAccessErrors.errors.txt | 16 +++++++-------- .../keyofIsLiteralContexualType.errors.txt | 4 ++-- ...OnFunctionsWithNoTypeParameters.errors.txt | 4 ++-- 13 files changed, 56 insertions(+), 56 deletions(-) diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index f83761215e50a..e15d0ba769c90 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -43,11 +43,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2 'ZeroOf' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. - Type '0' is not assignable to type 'T'. + Type 'number' is not assignable to type 'T'. '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. - Type '"" | 0' is not assignable to type 'T'. + Type 'string | number' is not assignable to type 'T'. '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. - Type '""' is not assignable to type 'T'. + Type 'string' is not assignable to type 'T'. '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf'. Type 'string | number' is not assignable to type 'ZeroOf'. @@ -283,11 +283,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS !!! error TS2322: 'ZeroOf' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. !!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. -!!! error TS2322: Type '0' is not assignable to type 'T'. +!!! error TS2322: Type 'number' is not assignable to type 'T'. !!! error TS2322: '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. -!!! error TS2322: Type '"" | 0' is not assignable to type 'T'. +!!! error TS2322: Type 'string | number' is not assignable to type 'T'. !!! error TS2322: '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. -!!! error TS2322: Type '""' is not assignable to type 'T'. +!!! error TS2322: Type 'string' is not assignable to type 'T'. !!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. y = x; // Error ~ diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt index a260247188962..2cceb88175a09 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type '1' is not assignable to type 'T'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type 'number' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,27): error TS2322: Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. @@ -21,7 +21,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co constructor(x: T, y: U); constructor(x: T = 1, public y: U = x) { // error ~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'T'. +!!! error TS2322: Type 'number' is not assignable to type 'T'. !!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. ~~~~~~~~~~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'U'. diff --git a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt index e63849e4aa887..4abd4a4cd09d6 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt @@ -2,9 +2,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type '""' is not assignable to type 'T'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type 'string' is not assignable to type 'T'. '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type '""' is not assignable to type 'T'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type 'string' is not assignable to type 'T'. '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E' is not assignable to type 'C'. Types of property 'x' are incompatible. @@ -51,12 +51,12 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'T'. +!!! error TS2322: Type 'string' is not assignable to type 'T'. !!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. foo(): T { return ''; // error ~~~~~~~~~~ -!!! error TS2322: Type '""' is not assignable to type 'T'. +!!! error TS2322: Type 'string' is not assignable to type 'T'. !!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. } } diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt index 5dad15dd775e8..53ef67b340d62 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -2,15 +2,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun Type 'string' is not assignable to type '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. + Type 'number' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. + Type 'number' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,24): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. + Type 'number' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,23): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -53,7 +53,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r10 = foo2(1, (x) => ''); // string @@ -61,13 +61,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r11b = foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r12 = foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index e179f079011e8..2e6ced0af8696 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. @@ -12,7 +12,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,43): error TS2322: Type 'F' is not assignable to type 'E'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. @@ -47,7 +47,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen !!! error TS2345: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. var r10 = r7(1); // error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. } @@ -96,7 +96,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen !!! error TS2345: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. var r10 = r7(1); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. } diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt index 9e22e42299c89..b37937c9edbb1 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type '1' is not assignable to type 'T'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type 'number' is not assignable to type 'T'. '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(6,37): error TS2322: Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. @@ -15,7 +15,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC function foo2(x: T = undefined) { return x; } // ok function foo3(x: T = 1) { } // error ~~~~~~~~ -!!! error TS2322: Type '1' is not assignable to type 'T'. +!!! error TS2322: Type 'number' is not assignable to type 'T'. !!! error TS2322: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. function foo4(x: T, y: U = x) { } // error ~~~~~~~~ diff --git a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt index c8a67a59d2140..1f179fb32675a 100644 --- a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt +++ b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,16): error TS2558: Expected 0 type arguments, but got 1. -tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,17): error TS2558: Expected 0 type arguments, but got 1. @@ -17,7 +17,7 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17 !!! error TS2558: Expected 0 type arguments, but got 1. var r2 = f(1); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r3 = f(null); ~~~ diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt index b11f0fcfddb2e..db9943c5ba2ed 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,14 +1,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,29): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. + Type 'number' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,30): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. + Type 'number' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,31): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. - Type '1' is not assignable to type 'T'. + Type 'number' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -75,7 +75,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r10 = c.foo2(1, (x) => ''); // string @@ -83,13 +83,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r11b = c3.foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. -!!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: Type 'number' is not assignable to type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r12 = c3.foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt index c824b71b534e2..e8705615424c5 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,41): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expected 0 type arguments, but got 1. @@ -13,7 +13,7 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expe x.foo(1); // no error var f = (x: B) => { return x.foo(1); } // error ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var f2 = (x: B) => { return x.foo(1); } // error ~ diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt index bd6b0b81c80f8..510f6fc6359b0 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt @@ -12,18 +12,18 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(18,5): error TS232 tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(19,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type 'T'. '{ [key: string]: number; }' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{ [key: string]: number; }'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(26,7): error TS2339: Property 'x' does not exist on type 'T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(27,5): error TS2322: Type '1' is not assignable to type 'T[keyof T]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(27,5): error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(31,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type '{ [P in K]: number; }'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(38,5): error TS2322: Type '{ [x: string]: number; }' is not assignable to type '{ [P in K]: number; }'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(50,3): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Item'. No index signature with a parameter of type 'string' was found on type 'Item'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(51,3): error TS2322: Type 'number' is not assignable to type 'never'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(52,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(53,3): error TS2322: Type '123' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(52,3): error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(53,3): error TS2322: Type 'number' is not assignable to type 'T[K]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(65,7): error TS2339: Property 'foo' does not exist on type 'T'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(66,3): error TS2536: Type 'string' cannot be used to index type 'T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(67,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(68,3): error TS2322: Type '123' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(67,3): error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(68,3): error TS2322: Type 'number' is not assignable to type 'T[K]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS2322: Type '123' is not assignable to type 'Type[K]'. Type 'number' is not assignable to type 'never'. @@ -82,7 +82,7 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS2339: Property 'x' does not exist on type 'T'. c[k] = 1; // Error, cannot write to index signature through constraint ~~~~ -!!! error TS2322: Type '1' is not assignable to type 'T[keyof T]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. } function f3(a: { [P in K]: number }, b: { [key: string]: number }, k: K) { @@ -118,10 +118,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS2322: Type 'number' is not assignable to type 'never'. obj[k3] = 123; // Error ~~~~~~~ -!!! error TS2322: Type '123' is not assignable to type 'T[keyof T]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. obj[k4] = 123; // Error ~~~~~~~ -!!! error TS2322: Type '123' is not assignable to type 'T[K]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[K]'. } type Dict = Record; @@ -141,10 +141,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 !!! error TS2536: Type 'string' cannot be used to index type 'T'. obj[k2] = 123; // Error ~~~~~~~ -!!! error TS2322: Type '123' is not assignable to type 'T[keyof T]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[keyof T]'. obj[k3] = 123; // Error ~~~~~~~ -!!! error TS2322: Type '123' is not assignable to type 'T[K]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[K]'. } // Repro from #27895 diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index 1738d6d977369..6bc2e322e17b8 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -69,10 +69,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(114,5): error tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error TS2322: Type 'T[K]' is not assignable to type 'U[J]'. Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(122,5): error TS2322: Type '42' is not assignable to type 'keyof T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error TS2322: Type '"hello"' is not assignable to type 'keyof T'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type '42' is not assignable to type 'T[K]'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(141,5): error TS2322: Type '"hello"' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(122,5): error TS2322: Type 'number' is not assignable to type 'keyof T'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error TS2322: Type 'string' is not assignable to type 'keyof T'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type 'number' is not assignable to type 'T[K]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(141,5): error TS2322: Type 'string' is not assignable to type 'T[K]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error TS2322: Type 'number[]' is not assignable to type 'T[K]'. @@ -306,10 +306,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error function f4(k: keyof T) { k = 42; // error ~ -!!! error TS2322: Type '42' is not assignable to type 'keyof T'. +!!! error TS2322: Type 'number' is not assignable to type 'keyof T'. k = "hello"; // error ~ -!!! error TS2322: Type '"hello"' is not assignable to type 'keyof T'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof T'. } // Repro from #27470 @@ -328,10 +328,10 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error function test1, K extends keyof T>(t: T, k: K) { t[k] = 42; // Error ~~~~ -!!! error TS2322: Type '42' is not assignable to type 'T[K]'. +!!! error TS2322: Type 'number' is not assignable to type 'T[K]'. t[k] = "hello"; // Error ~~~~ -!!! error TS2322: Type '"hello"' is not assignable to type 'T[K]'. +!!! error TS2322: Type 'string' is not assignable to type 'T[K]'. t[k] = [10, 20]; // Error ~~~~ !!! error TS2322: Type 'number[]' is not assignable to type 'T[K]'. diff --git a/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt b/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt index 92f3d403d02ad..7d6c194eddbc3 100644 --- a/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt +++ b/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/keyofIsLiteralContexualType.ts(5,37): error TS2322: Type '"c"' is not assignable to type 'keyof T'. +tests/cases/compiler/keyofIsLiteralContexualType.ts(5,37): error TS2322: Type 'string' is not assignable to type 'keyof T'. Type '"c"' is not assignable to type '"a" | "b"'. tests/cases/compiler/keyofIsLiteralContexualType.ts(13,11): error TS2339: Property 'b' does not exist on type 'Pick<{ a: number; b: number; c: number; }, "a" | "c">'. @@ -10,7 +10,7 @@ tests/cases/compiler/keyofIsLiteralContexualType.ts(13,11): error TS2339: Proper let a: (keyof T)[] = ["a", "b"]; let b: (keyof T)[] = ["a", "b", "c"]; ~~~ -!!! error TS2322: Type '"c"' is not assignable to type 'keyof T'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof T'. !!! error TS2322: Type '"c"' is not assignable to type '"a" | "b"'. } diff --git a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt index aaa5cad857cc3..5da4df50ef1cb 100644 --- a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt +++ b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(2,15): error TS2558: Expected 0 type arguments, but got 1. -tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): error TS2558: Expected 0 type arguments, but got 1. @@ -11,7 +11,7 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): erro !!! error TS2558: Expected 0 type arguments, but got 1. var r2 = f(1); ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. !!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. var r3 = f(null); ~~~ From afe90f13146f7a4ecd7c018566030656927b8599 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 22 May 2020 01:02:27 +0000 Subject: [PATCH 12/14] Feed generalized source type to elaboration. --- src/compiler/checker.ts | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5f1e95dbce33f..91461c1463589 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15730,24 +15730,34 @@ namespace ts { function reportRelationError(message: DiagnosticMessage | undefined, source: Type, target: Type) { if (incompatibleStack.length) reportIncompatibleStack(); const [sourceType, targetType] = getTypeNamesForErrorDisplay(source, target); - let generalizedSourceType = sourceType; + let generalizedSource: Type; + let generalizedSourceType: string; + + if (isLiteralType(source) && !typeCouldHaveTopLevelSingletonTypes(target)) { + generalizedSource = getBaseTypeOfLiteralType(source); + generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource); + } + else { + generalizedSource = source; + generalizedSourceType = sourceType; + } if (target.flags & TypeFlags.TypeParameter) { const constraint = getBaseConstraintOfType(target); - const constraintElab = constraint && isTypeAssignableTo(source, constraint); - if (constraintElab) { + let needsOriginalSource; + if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source, constraint)))) { reportError( Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, - sourceType, + needsOriginalSource ? sourceType : generalizedSourceType, targetType, - typeToString(constraint!), + typeToString(constraint), ); } else { reportError( Diagnostics._0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1, targetType, - sourceType + generalizedSourceType ); } } @@ -15764,10 +15774,6 @@ namespace ts { } } - if (isLiteralType(source) && !typeCouldHaveTopLevelSingletonTypes(target)) { - generalizedSourceType = getTypeNameForErrorDisplay(getBaseTypeOfLiteralType(source)); - } - reportError(message, generalizedSourceType, targetType); } From a008792d016361d7475387b15f9be410ed7cb27e Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 22 May 2020 01:02:37 +0000 Subject: [PATCH 13/14] Updated baselines. --- .../baselines/reference/conditionalTypes1.errors.txt | 12 ++++++------ ...ructorImplementationWithDefaultValues2.errors.txt | 4 ++-- .../reference/derivedGenericClassWithAny.errors.txt | 8 ++++---- .../genericCallWithFunctionTypedArguments.errors.txt | 12 ++++++------ ...ericCallWithGenericSignatureArguments2.errors.txt | 8 ++++---- ...cCallWithObjectTypeArgsAndInitializers.errors.txt | 4 ++-- ...ackInvokedInsideItsContainingFunction1.errors.txt | 4 ++-- ...cClassWithFunctionTypedMemberArguments.errors.txt | 12 ++++++------ .../genericWithOpenTypeParameters1.errors.txt | 4 ++-- ...gumentsOnFunctionsWithNoTypeParameters.errors.txt | 4 ++-- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index e15d0ba769c90..16a81ba69c6fe 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -44,11 +44,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2 Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. Type 'number' is not assignable to type 'T'. - '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type 'string | number' is not assignable to type 'T'. - '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + 'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type 'string' is not assignable to type 'T'. - '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf'. Type 'string | number' is not assignable to type 'ZeroOf'. Type 'string' is not assignable to type 'ZeroOf'. @@ -284,11 +284,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS !!! error TS2322: Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. !!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'. !!! error TS2322: Type 'number' is not assignable to type 'T'. -!!! error TS2322: '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type 'string | number' is not assignable to type 'T'. -!!! error TS2322: '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: 'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. y = x; // Error ~ !!! error TS2322: Type 'T' is not assignable to type 'ZeroOf'. diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt index 2cceb88175a09..3d22f3fb320be 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,27): error TS2322: Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(17,17): error TS2322: Type 'Date' is not assignable to type 'T'. @@ -22,7 +22,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co constructor(x: T = 1, public y: U = x) { // error ~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'T'. -!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. ~~~~~~~~~~~~~~~ !!! 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'. diff --git a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt index 4abd4a4cd09d6..3e717a6d59a34 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt @@ -3,9 +3,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type 'string' is not assignable to type 'T'. - '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type 'string' is not assignable to type 'T'. - '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E' is not assignable to type 'C'. Types of property 'x' are incompatible. Type 'string' is not assignable to type 'number'. @@ -52,12 +52,12 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. foo(): T { return ''; // error ~~~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. } } diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt index 53ef67b340d62..aef8a5ad372f5 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -3,15 +3,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,24): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,23): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -54,7 +54,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r10 = foo2(1, (x) => ''); // string var r11 = foo3(1, (x: T) => '', ''); // error @@ -62,13 +62,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r11b = foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r12 = foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ !!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index 2e6ced0af8696..08330d4a5867e 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. Type 'Date' is not assignable to type 'T'. @@ -13,7 +13,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. Type 'Date' is not assignable to type 'T'. @@ -48,7 +48,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r10 = r7(1); // error ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. } function foo2(a: (x: T) => T, b: (x: T) => T) { @@ -97,7 +97,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r10 = r7(1); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. } function foo2(a: (x: T) => T, b: (x: U) => U) { diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt index b37937c9edbb1..545a8b47a7981 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type 'number' is not assignable to type 'T'. - '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(6,37): error TS2322: Type 'T' is not assignable to type 'U'. 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(8,56): error TS2322: Type 'U' is not assignable to type 'V'. @@ -16,7 +16,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC function foo3(x: T = 1) { } // error ~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'T'. -!!! error TS2322: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. +!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. function foo4(x: T, y: U = x) { } // error ~~~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'U'. diff --git a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt index 1f179fb32675a..25915c23a88b7 100644 --- a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt +++ b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,17): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(9,17): error TS2558: Expected 0 type arguments, but got 1. @@ -18,7 +18,7 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17 var r2 = f(1); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r3 = f(null); ~~~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt index db9943c5ba2ed..440c8d113cb8d 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,15 +1,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,29): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,30): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,31): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type 'number' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -76,7 +76,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r10 = c.foo2(1, (x) => ''); // string var r11 = c3.foo3(1, (x: T) => '', ''); // error @@ -84,13 +84,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r11b = c3.foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r12 = c3.foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ !!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt index e8705615424c5..f348a0fb97434 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,41): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expected 0 type arguments, but got 1. @@ -14,7 +14,7 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expe var f = (x: B) => { return x.foo(1); } // error ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var f2 = (x: B) => { return x.foo(1); } // error ~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt index 5da4df50ef1cb..c415f5d9a493d 100644 --- a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt +++ b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(2,15): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. + 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): error TS2558: Expected 0 type arguments, but got 1. @@ -12,7 +12,7 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): erro var r2 = f(1); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. -!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to '1'. +!!! error TS2345: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'. var r3 = f(null); ~~~ !!! error TS2558: Expected 0 type arguments, but got 1. From d3d282cb45fbe73e8caaffe33bbbe2f6301d679a Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 22 May 2020 01:49:26 +0000 Subject: [PATCH 14/14] Less code --- src/compiler/checker.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 91461c1463589..a57c87345fcab 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15730,17 +15730,13 @@ namespace ts { function reportRelationError(message: DiagnosticMessage | undefined, source: Type, target: Type) { if (incompatibleStack.length) reportIncompatibleStack(); const [sourceType, targetType] = getTypeNamesForErrorDisplay(source, target); - let generalizedSource: Type; - let generalizedSourceType: string; + let generalizedSource = source; + let generalizedSourceType = sourceType; if (isLiteralType(source) && !typeCouldHaveTopLevelSingletonTypes(target)) { generalizedSource = getBaseTypeOfLiteralType(source); generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource); } - else { - generalizedSource = source; - generalizedSourceType = sourceType; - } if (target.flags & TypeFlags.TypeParameter) { const constraint = getBaseConstraintOfType(target);