From f20f700025e40129d3bdec97adb0bf2ae8b80925 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 25 Jun 2019 13:16:34 -0700 Subject: [PATCH] Update baselines, except JSX JSX is still broken --- src/compiler/checker.ts | 161 ++++++++---------- tests/baselines/reference/for-of39.errors.txt | 20 ++- .../reference/functionOverloads40.errors.txt | 11 +- .../reference/functionOverloads41.errors.txt | 11 +- .../heterogeneousArrayAndOverloads.errors.txt | 22 +-- .../iterableArrayPattern28.errors.txt | 20 ++- .../overloadResolutionTest1.errors.txt | 33 ++-- .../overloadsWithProvisionalErrors.errors.txt | 23 ++- .../reference/promiseTypeInference.errors.txt | 29 ++-- ...actDefaultPropsInferenceSuccess.errors.txt | 50 +++--- .../reference/strictBindCallApply1.errors.txt | 52 ++++-- 11 files changed, 250 insertions(+), 182 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 06066e3120e..f1aa67ab00f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11659,7 +11659,7 @@ namespace ts { return isTypeComparableTo(type1, type2) || isTypeComparableTo(type2, type1); } - function checkTypeAssignableTo(source: Type, target: Type, errorNode: Node | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined, errorOutputObject?: { error?: Diagnostic }): boolean { + function checkTypeAssignableTo(source: Type, target: Type, errorNode: Node | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined, errorOutputObject?: { errors?: Diagnostic[] }): boolean { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain, errorOutputObject); } @@ -11679,10 +11679,10 @@ namespace ts { expr: Expression | undefined, headMessage: DiagnosticMessage | undefined, containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, - errorOutputContainer: { error?: Diagnostic, skipLogging?: boolean } | undefined + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined ): boolean { if (isTypeRelatedTo(source, target, relation)) return true; - if (!errorNode || !elaborateError(expr, source, target, relation, headMessage, errorOutputContainer)) { + if (!errorNode || !elaborateError(expr, source, target, relation, headMessage, containingMessageChain, errorOutputContainer)) { return checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer); } return false; @@ -11698,34 +11698,35 @@ namespace ts { target: Type, relation: Map, headMessage: DiagnosticMessage | undefined, - errorOutputContainer: { error?: Diagnostic, skipLogging?: boolean } | undefined + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined ): boolean { // TODO: The first case probably still needs to set errorOutputContainer.error to something // TODO: Make sure all error logging in dynamic scope sets errorOutputContainer.error instead if (!node || isOrHasGenericConditional(target)) return false; if (!checkTypeRelatedTo(source, target, relation, /*errorNode*/ undefined) - && elaborateDidYouMeanToCallOrConstruct(node, source, target, relation, headMessage, errorOutputContainer)) { + && elaborateDidYouMeanToCallOrConstruct(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer)) { return true; } switch (node.kind) { case SyntaxKind.JsxExpression: case SyntaxKind.ParenthesizedExpression: - return elaborateError((node as ParenthesizedExpression | JsxExpression).expression, source, target, relation, headMessage, errorOutputContainer); + return elaborateError((node as ParenthesizedExpression | JsxExpression).expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); case SyntaxKind.BinaryExpression: switch ((node as BinaryExpression).operatorToken.kind) { case SyntaxKind.EqualsToken: case SyntaxKind.CommaToken: - return elaborateError((node as BinaryExpression).right, source, target, relation, headMessage, errorOutputContainer); + return elaborateError((node as BinaryExpression).right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; case SyntaxKind.ObjectLiteralExpression: - return elaborateObjectLiteral(node as ObjectLiteralExpression, source, target, relation, errorOutputContainer); + return elaborateObjectLiteral(node as ObjectLiteralExpression, source, target, relation, containingMessageChain, errorOutputContainer); case SyntaxKind.ArrayLiteralExpression: - return elaborateArrayLiteral(node as ArrayLiteralExpression, source, target, relation, errorOutputContainer); + return elaborateArrayLiteral(node as ArrayLiteralExpression, source, target, relation, containingMessageChain, errorOutputContainer); case SyntaxKind.JsxAttributes: - return elaborateJsxComponents(node as JsxAttributes, source, target, relation, errorOutputContainer); + return elaborateJsxComponents(node as JsxAttributes, source, target, relation, containingMessageChain, errorOutputContainer); case SyntaxKind.ArrowFunction: - return elaborateArrowFunction(node as ArrowFunction, source, target, relation, errorOutputContainer); + return elaborateArrowFunction(node as ArrowFunction, source, target, relation, containingMessageChain, errorOutputContainer); } return false; } @@ -11736,7 +11737,8 @@ namespace ts { target: Type, relation: Map, headMessage: DiagnosticMessage | undefined, - errorOutputContainer: { error?: Diagnostic, skipLogging?: boolean } | undefined + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined ): boolean { const callSignatures = getSignaturesOfType(source, SignatureKind.Call); const constructSignatures = getSignaturesOfType(source, SignatureKind.Construct); @@ -11745,9 +11747,9 @@ namespace ts { const returnType = getReturnTypeOfSignature(s); return !(returnType.flags & (TypeFlags.Any | TypeFlags.Never)) && checkTypeRelatedTo(returnType, target, relation, /*errorNode*/ undefined); })) { - const resultObj: { error?: Diagnostic } = errorOutputContainer || {}; - checkTypeAssignableTo(source, target, node, headMessage, /*containingChain*/ undefined, resultObj); - const diagnostic = resultObj.error!; + const resultObj: { errors?: Diagnostic[] } = errorOutputContainer || {}; + checkTypeAssignableTo(source, target, node, headMessage, containingMessageChain, resultObj); + const diagnostic = resultObj.errors![resultObj.errors!.length - 1]; addRelatedInfo(diagnostic, createDiagnosticForNode( node, signatures === constructSignatures ? Diagnostics.Did_you_mean_to_use_new_with_this_expression : Diagnostics.Did_you_mean_to_call_this_expression @@ -11763,7 +11765,8 @@ namespace ts { source: Type, target: Type, relation: Map, - errorOutputContainer: { error?: Diagnostic, skipLogging?: boolean } | undefined + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined ): boolean { // Don't elaborate blocks if (isBlock(node.body)) { @@ -11785,15 +11788,15 @@ namespace ts { const sourceReturn = getReturnTypeOfSignature(sourceSig); const targetReturn = getUnionType(map(targetSignatures, getReturnTypeOfSignature)); if (!checkTypeRelatedTo(sourceReturn, targetReturn, relation, /*errorNode*/ undefined)) { - const elaborated = returnExpression && elaborateError(returnExpression, sourceReturn, targetReturn, relation, /*headMessage*/ undefined, errorOutputContainer); + const elaborated = returnExpression && elaborateError(returnExpression, sourceReturn, targetReturn, relation, /*headMessage*/ undefined, containingMessageChain, errorOutputContainer); if (elaborated) { return elaborated; } - const resultObj: { error?: Diagnostic } = errorOutputContainer || {}; - checkTypeRelatedTo(sourceReturn, targetReturn, relation, returnExpression, /*message*/ undefined, /*chain*/ undefined, resultObj); - if (resultObj.error) { + const resultObj: { errors?: Diagnostic[] } = errorOutputContainer || {}; + checkTypeRelatedTo(sourceReturn, targetReturn, relation, returnExpression, /*message*/ undefined, containingMessageChain, resultObj); + if (resultObj.errors) { if (target.symbol && length(target.symbol.declarations)) { - addRelatedInfo(resultObj.error, createDiagnosticForNode( + addRelatedInfo(resultObj.errors[resultObj.errors.length - 1], createDiagnosticForNode( target.symbol.declarations[0], Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature, )); @@ -11815,7 +11818,8 @@ namespace ts { source: Type, target: Type, relation: Map, - errorOutputContainer: { error?: Diagnostic, skipLogging?: boolean } | undefined + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined ) { // Assignability failure - check each prop individually, and if that fails, fall back on the bad error span let reportedError = false; @@ -11825,22 +11829,22 @@ namespace ts { if (!targetPropType || targetPropType.flags & TypeFlags.IndexedAccess) continue; // Don't elaborate on indexes on generic variables const sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType); if (sourcePropType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) { - const elaborated = next && elaborateError(next, sourcePropType, targetPropType, relation, /*headMessage*/ undefined, errorOutputContainer); + const elaborated = next && elaborateError(next, sourcePropType, targetPropType, relation, /*headMessage*/ undefined, containingMessageChain, errorOutputContainer); if (elaborated) { reportedError = true; } else { // Issue error on the prop itself, since the prop couldn't elaborate the error - const resultObj: { error?: Diagnostic } = errorOutputContainer || {}; + const resultObj: { errors?: Diagnostic[] } = errorOutputContainer || {}; // Use the expression type, if available const specificSource = next ? checkExpressionForMutableLocation(next, CheckMode.Normal, sourcePropType) : sourcePropType; - const result = checkTypeRelatedTo(specificSource, targetPropType, relation, prop, errorMessage, /*containingChain*/ undefined, resultObj); + const result = checkTypeRelatedTo(specificSource, targetPropType, relation, prop, errorMessage, containingMessageChain, resultObj); if (result && specificSource !== sourcePropType) { // If for whatever reason the expression type doesn't yield an error, make sure we still issue an error on the sourcePropType - checkTypeRelatedTo(sourcePropType, targetPropType, relation, prop, errorMessage, /*containingChain*/ undefined, resultObj); + checkTypeRelatedTo(sourcePropType, targetPropType, relation, prop, errorMessage, containingMessageChain, resultObj); } - if (resultObj.error) { - const reportedDiag = resultObj.error; + if (resultObj.errors) { + const reportedDiag = resultObj.errors[resultObj.errors.length - 1]; const propertyName = isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : undefined; const targetProp = propertyName !== undefined ? getPropertyOfType(target, propertyName) : undefined; @@ -11928,9 +11932,10 @@ namespace ts { source: Type, target: Type, relation: Map, - errorOutputContainer: { error?: Diagnostic, skipLogging?: boolean } | undefined + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined ) { - let result = elaborateElementwise(generateJsxAttributes(node), source, target, relation, errorOutputContainer); + let result = elaborateElementwise(generateJsxAttributes(node), source, target, relation, containingMessageChain, errorOutputContainer); let invalidTextDiagnostic: DiagnosticMessage | undefined; if (isJsxOpeningElement(node.parent) && isJsxElement(node.parent.parent)) { const containingElement = node.parent.parent; @@ -11949,7 +11954,7 @@ namespace ts { if (arrayLikeTargetParts !== neverType) { const realSource = createTupleType(checkJsxChildren(containingElement, CheckMode.Normal)); const children = generateJsxChildren(containingElement, getInvalidTextualChildDiagnostic) - result = elaborateElementwise(children, realSource, arrayLikeTargetParts, relation, errorOutputContainer) || result; + result = elaborateElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result; } else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) { // arity mismatch @@ -11961,7 +11966,7 @@ namespace ts { typeToString(childrenTargetType) ); if (errorOutputContainer && errorOutputContainer.skipLogging) { - errorOutputContainer.error = diag; + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); } } } @@ -11975,6 +11980,7 @@ namespace ts { source, target, relation, + containingMessageChain, errorOutputContainer ) || result; } @@ -11989,7 +11995,7 @@ namespace ts { typeToString(childrenTargetType) ); if (errorOutputContainer && errorOutputContainer.skipLogging) { - errorOutputContainer.error = diag; + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); } } } @@ -12027,16 +12033,17 @@ namespace ts { source: Type, target: Type, relation: Map, - errorOutputContainer: { error?: Diagnostic, skipLogging?: boolean } | undefined + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined ) { if (target.flags & TypeFlags.Primitive) return false; if (isTupleLikeType(source)) { - return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, errorOutputContainer); + return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer); } // recreate a tuple from the elements, if possible const tupleizedType = checkArrayLiteral(node, CheckMode.Contextual, /*forceTuple*/ true); if (isTupleLikeType(tupleizedType)) { - return elaborateElementwise(generateLimitedTupleElements(node, target), tupleizedType, target, relation, errorOutputContainer); + return elaborateElementwise(generateLimitedTupleElements(node, target), tupleizedType, target, relation, containingMessageChain, errorOutputContainer); } return false; } @@ -12070,10 +12077,11 @@ namespace ts { source: Type, target: Type, relation: Map, - errorOutputContainer: { error?: Diagnostic, skipLogging?: boolean } | undefined + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined ) { if (target.flags & TypeFlags.Primitive) return false; - return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, errorOutputContainer); + return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer); } /** @@ -12423,7 +12431,7 @@ namespace ts { errorNode: Node | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined, - errorOutputContainer?: { error?: Diagnostic, skipLogging?: boolean }, + errorOutputContainer?: { errors?: Diagnostic[], skipLogging?: boolean }, ): boolean { let errorInfo: DiagnosticMessageChain | undefined; let relatedInfo: [DiagnosticRelatedInformation, ...DiagnosticRelatedInformation[]] | undefined; @@ -12442,7 +12450,7 @@ namespace ts { if (overflow) { const diag = error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); if (errorOutputContainer) { - errorOutputContainer.error = diag; + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); } } else if (errorInfo) { @@ -12471,14 +12479,14 @@ namespace ts { addRelatedInfo(diag, ...relatedInfo); } if (errorOutputContainer) { - errorOutputContainer.error = diag; + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); } if (!errorOutputContainer || !errorOutputContainer.skipLogging) { diagnostics.add(diag); } } if (errorNode && errorOutputContainer && errorOutputContainer.skipLogging && result === Ternary.False) { - Debug.assert(!!errorOutputContainer.error, "missed opportunity to interact with error."); + Debug.assert(!!errorOutputContainer.errors, "missed opportunity to interact with error."); } return result !== Ternary.False; @@ -21171,7 +21179,7 @@ namespace ts { checkMode: CheckMode, reportErrors: boolean, containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, - errorOutputContainer: { error?: Diagnostic, skipLogging?: boolean } + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } ) { // Stateless function components can have maximum of three arguments: "props", "context", and "updater". // However "context" and "updater" are implicit and can't be specify by users. Only the first parameter, props, @@ -21191,17 +21199,14 @@ namespace ts { containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, ) { - const errorOutputContainer: { error?: Diagnostic, skipLogging?: boolean } = { error: undefined, skipLogging: true }; + const errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } = { errors: undefined, skipLogging: true }; if (isJsxOpeningLikeElement(node)) { const r = checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer); if (!r) { if (reportErrors) { - Debug.assert(!!errorOutputContainer.error, "has error 0"); - return errorOutputContainer.error; - } - else { - return true; + Debug.assert(!!errorOutputContainer.errors, "has error 0"); } + return errorOutputContainer.errors || []; } } const thisType = getThisTypeOfSignature(signature); @@ -21213,15 +21218,9 @@ namespace ts { const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; const errorNode = reportErrors ? (thisArgumentNode || node) : undefined; const headMessage = Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; - const r = checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer); - if (!r) { - if (reportErrors) { - Debug.assert(!!errorOutputContainer.error, "has error 1"); // CLEAR - return errorOutputContainer.error; - } - else { - return true; - } + if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer)) { + Debug.assert(!reportErrors || !!errorOutputContainer.errors, "has error 1"); // CLEAR + return errorOutputContainer.errors || []; } } const headMessage = Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; @@ -21236,30 +21235,18 @@ namespace ts { // we obtain the regular type of any object literal arguments because we may not have inferred complete // parameter types yet and therefore excess property checks may yield false positives (see #17041). const checkArgType = checkMode & CheckMode.SkipContextSensitive ? getRegularTypeOfObjectLiteral(argType) : argType; - const r = checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer); - if (!r) { - if (reportErrors) { - Debug.assert(!!errorOutputContainer.error, "has error 2"); // CLEAR - return errorOutputContainer.error; - } - else { - return true; - } + if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer)) { + Debug.assert(!reportErrors || !!errorOutputContainer.errors, "has error 2"); // CLEAR + return errorOutputContainer.errors || []; } } } if (restType) { const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, /*context*/ undefined); const errorNode = reportErrors ? argCount < args.length ? args[argCount] : node : undefined; - const r = checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, undefined, errorOutputContainer); - if (!r) { - if (reportErrors) { - Debug.assert(!!errorOutputContainer.error, "has error 3"); // CLEAR - return errorOutputContainer.error; - } - else { - return true; - } + if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, undefined, errorOutputContainer)) { + Debug.assert(!reportErrors || !!errorOutputContainer.errors, "has error 3"); // CLEAR + return errorOutputContainer.errors || []; } } return undefined; @@ -21597,13 +21584,14 @@ namespace ts { chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error); chain = chainDiagnosticMessages(chain, Diagnostics.No_suitable_overload_for_this_call); } - const d = getSignatureApplicabilityError(node, args, last, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, () => chain); - Debug.assert(!!d, "No error for last signature"); - if (d) { - Debug.assert(d !== true); + const ds = getSignatureApplicabilityError(node, args, last, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, () => chain); + Debug.assert(!!ds, "No error for last signature"); + if (ds) { // if elaboration already displayed the error, don't do anything extra // note that we could do this always here, but getSignatureApplicabilityError is currently not configured to do that - diagnostics.add(d as Diagnostic); + for (const d of ds as Diagnostic[]) { + diagnostics.add(d); + } } } else { @@ -21611,12 +21599,11 @@ namespace ts { let i = 0; for (const c of candidatesForArgumentError) { i++; - const chain = chainDiagnosticMessages(undefined, Diagnostics.Overload_0_of_1_2_gave_the_following_error, i, candidates.length, signatureToString(c)); - const d = getSignatureApplicabilityError(node, args, c, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, () => chain); - Debug.assert(!!d, "No error for signature (1)"); - if (d) { - Debug.assert(d !== true); - related.push(d as Diagnostic); + const chain = () => chainDiagnosticMessages(undefined, Diagnostics.Overload_0_of_1_2_gave_the_following_error, i, candidates.length, signatureToString(c)); + const ds = getSignatureApplicabilityError(node, args, c, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, chain); + Debug.assert(!!ds, "No error for signature (1)"); + if (ds) { + related.push(...ds as Diagnostic[]) } } diagnostics.add(createDiagnosticForNodeFromMessageChain(node, chainDiagnosticMessages(undefined, Diagnostics.No_suitable_overload_for_this_call), related)); diff --git a/tests/baselines/reference/for-of39.errors.txt b/tests/baselines/reference/for-of39.errors.txt index fedf9f3e343..d5e48579c28 100644 --- a/tests/baselines/reference/for-of39.errors.txt +++ b/tests/baselines/reference/for-of39.errors.txt @@ -1,10 +1,24 @@ -tests/cases/conformance/es6/for-ofStatements/for-of39.ts(1,37): error TS2322: Type 'number' is not assignable to type 'boolean'. +tests/cases/conformance/es6/for-ofStatements/for-of39.ts(1,11): error TS2755: No suitable overload for this call. ==== tests/cases/conformance/es6/for-ofStatements/for-of39.ts (1 errors) ==== var map = new Map([["", true], ["", 0]]); - ~ -!!! error TS2322: Type 'number' is not assignable to type 'boolean'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/conformance/es6/for-ofStatements/for-of39.ts:1:19: Overload 1 of 3, '(iterable: Iterable): Map', gave the following error. + Argument of type '([string, number] | [string, true])[]' is not assignable to parameter of type 'Iterable'. + Types of property '[Symbol.iterator]' are incompatible. + Type '() => IterableIterator<[string, number] | [string, true]>' is not assignable to type '() => Iterator'. + Type 'IterableIterator<[string, number] | [string, true]>' is not assignable to type 'Iterator'. + Types of property 'next' are incompatible. + Type '(value?: any) => IteratorResult<[string, number] | [string, true]>' is not assignable to type '(value?: any) => IteratorResult'. + Type 'IteratorResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult'. + Type '[string, number] | [string, true]' is not assignable to type 'readonly [string, boolean]'. + Type '[string, number]' is not assignable to type 'readonly [string, boolean]'. + Types of property '1' are incompatible. + Type 'number' is not assignable to type 'boolean'. +!!! related TS2757 tests/cases/conformance/es6/for-ofStatements/for-of39.ts:1:37: Overload 2 of 3, '(entries?: readonly (readonly [string, boolean])[]): Map', gave the following error. + Type 'number' is not assignable to type 'boolean'. for (var [k, v] of map) { k; v; diff --git a/tests/baselines/reference/functionOverloads40.errors.txt b/tests/baselines/reference/functionOverloads40.errors.txt index f053c7c6208..b0706ed9650 100644 --- a/tests/baselines/reference/functionOverloads40.errors.txt +++ b/tests/baselines/reference/functionOverloads40.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/functionOverloads40.ts(4,15): error TS2322: Type 'string' is not assignable to type 'boolean'. +tests/cases/compiler/functionOverloads40.ts(4,9): error TS2755: No suitable overload for this call. ==== tests/cases/compiler/functionOverloads40.ts (1 errors) ==== @@ -6,7 +6,10 @@ tests/cases/compiler/functionOverloads40.ts(4,15): error TS2322: Type 'string' i function foo(bar:{a:boolean;}[]):number; function foo(bar:{a:any;}[]):any{ return bar } var x = foo([{a:'bar'}]); - ~ -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. -!!! related TS6500 tests/cases/compiler/functionOverloads40.ts:2:19: The expected type comes from property 'a' which is declared here on type '{ a: boolean; }' + ~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/functionOverloads40.ts:4:15: Overload 1 of 2, '(bar: { a: number; }[]): string', gave the following error. + Type 'string' is not assignable to type 'number'. +!!! related TS2757 tests/cases/compiler/functionOverloads40.ts:4:15: Overload 2 of 2, '(bar: { a: boolean; }[]): number', gave the following error. + Type 'string' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads41.errors.txt b/tests/baselines/reference/functionOverloads41.errors.txt index a09e6e14769..430a6e295c6 100644 --- a/tests/baselines/reference/functionOverloads41.errors.txt +++ b/tests/baselines/reference/functionOverloads41.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/functionOverloads41.ts(4,14): error TS2741: Property 'a' is missing in type '{}' but required in type '{ a: boolean; }'. +tests/cases/compiler/functionOverloads41.ts(4,9): error TS2755: No suitable overload for this call. ==== tests/cases/compiler/functionOverloads41.ts (1 errors) ==== @@ -6,7 +6,10 @@ tests/cases/compiler/functionOverloads41.ts(4,14): error TS2741: Property 'a' is function foo(bar:{a:boolean;}[]):number; function foo(bar:{a:any;}[]):any{ return bar } var x = foo([{}]); - ~~ -!!! error TS2741: Property 'a' is missing in type '{}' but required in type '{ a: boolean; }'. -!!! related TS2728 tests/cases/compiler/functionOverloads41.ts:2:19: 'a' is declared here. + ~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/functionOverloads41.ts:4:14: Overload 1 of 2, '(bar: { a: number; }[]): string', gave the following error. + Property 'a' is missing in type '{}' but required in type '{ a: number; }'. +!!! related TS2757 tests/cases/compiler/functionOverloads41.ts:4:14: Overload 2 of 2, '(bar: { a: boolean; }[]): number', gave the following error. + Property 'a' is missing in type '{}' but required in type '{ a: boolean; }'. \ No newline at end of file diff --git a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt index 60228b956f9..8c2d8ed2617 100644 --- a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt +++ b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt @@ -1,9 +1,7 @@ -tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,20): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,23): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,32): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,9): error TS2755: No suitable overload for this call. -==== tests/cases/compiler/heterogeneousArrayAndOverloads.ts (3 errors) ==== +==== tests/cases/compiler/heterogeneousArrayAndOverloads.ts (1 errors) ==== class arrTest { test(arg1: number[]); test(arg1: string[]); @@ -13,11 +11,15 @@ tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,32): error TS2322: Type this.test(["hi"]); this.test([]); this.test([1, 2, "hi", 5]); // Error - ~ -!!! error TS2322: Type 'number' 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'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/heterogeneousArrayAndOverloads.ts:9:26: Overload 1 of 2, '(arg1: number[]): any', gave the following error. + Type 'string' is not assignable to type 'number'. +!!! related TS2757 tests/cases/compiler/heterogeneousArrayAndOverloads.ts:9:20: Overload 2 of 2, '(arg1: string[]): any', gave the following error. + Type 'number' is not assignable to type 'string'. +!!! related TS2757 tests/cases/compiler/heterogeneousArrayAndOverloads.ts:9:23: Overload 2 of 2, '(arg1: string[]): any', gave the following error. + Type 'number' is not assignable to type 'string'. +!!! related TS2757 tests/cases/compiler/heterogeneousArrayAndOverloads.ts:9:32: Overload 2 of 2, '(arg1: string[]): any', gave the following error. + 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 f90bba07c1a..53e41cb1de3 100644 --- a/tests/baselines/reference/iterableArrayPattern28.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern28.errors.txt @@ -1,8 +1,22 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts(2,52): error TS2322: Type 'true' is not assignable to type 'number'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts(2,24): error TS2755: No suitable overload for this call. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts (1 errors) ==== function takeFirstTwoEntries(...[[k1, v1], [k2, v2]]: [string, number][]) { } takeFirstTwoEntries(...new Map([["", 0], ["hello", true]])); - ~~~~ -!!! error TS2322: Type 'true' is not assignable to type 'number'. \ No newline at end of file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts:2:32: Overload 1 of 3, '(iterable: Iterable): Map', gave the following error. + Argument of type '([string, number] | [string, boolean])[]' is not assignable to parameter of type 'Iterable'. + Types of property '[Symbol.iterator]' are incompatible. + Type '() => IterableIterator<[string, number] | [string, boolean]>' is not assignable to type '() => Iterator'. + Type 'IterableIterator<[string, number] | [string, boolean]>' is not assignable to type 'Iterator'. + Types of property 'next' are incompatible. + Type '(value?: any) => IteratorResult<[string, number] | [string, boolean]>' is not assignable to type '(value?: any) => IteratorResult'. + Type 'IteratorResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult'. + Type '[string, number] | [string, boolean]' is not assignable to type 'readonly [string, number]'. + Type '[string, boolean]' is not assignable to type 'readonly [string, number]'. + Types of property '1' are incompatible. + Type 'boolean' is not assignable to type 'number'. +!!! related TS2757 tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts:2:52: Overload 2 of 3, '(entries?: readonly (readonly [string, number])[]): Map', gave the following error. + Type 'true' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadResolutionTest1.errors.txt b/tests/baselines/reference/overloadResolutionTest1.errors.txt index 008ee13127c..f765e3d27d7 100644 --- a/tests/baselines/reference/overloadResolutionTest1.errors.txt +++ b/tests/baselines/reference/overloadResolutionTest1.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/overloadResolutionTest1.ts(7,18): error TS2322: Type 'string' is not assignable to type 'boolean'. -tests/cases/compiler/overloadResolutionTest1.ts(18,16): error TS2322: Type 'string' is not assignable to type 'boolean'. -tests/cases/compiler/overloadResolutionTest1.ts(24,15): error TS2322: Type 'true' is not assignable to type 'string'. +tests/cases/compiler/overloadResolutionTest1.ts(7,12): error TS2755: No suitable overload for this call. +tests/cases/compiler/overloadResolutionTest1.ts(18,10): error TS2755: No suitable overload for this call. +tests/cases/compiler/overloadResolutionTest1.ts(24,9): error TS2755: No suitable overload for this call. ==== tests/cases/compiler/overloadResolutionTest1.ts (3 errors) ==== @@ -11,9 +11,12 @@ tests/cases/compiler/overloadResolutionTest1.ts(24,15): error TS2322: Type 'true var x1 = foo([{a:true}]); // works var x11 = foo([{a:0}]); // works var x111 = foo([{a:"s"}]); // error - does not match any signature - ~ -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. -!!! related TS6500 tests/cases/compiler/overloadResolutionTest1.ts:2:19: The expected type comes from property 'a' which is declared here on type '{ a: boolean; }' + ~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/overloadResolutionTest1.ts:7:18: Overload 1 of 2, '(bar: { a: number; }[]): string', gave the following error. + Type 'string' is not assignable to type 'number'. +!!! related TS2757 tests/cases/compiler/overloadResolutionTest1.ts:7:18: Overload 2 of 2, '(bar: { a: boolean; }[]): number', gave the following error. + Type 'string' is not assignable to type 'boolean'. var x1111 = foo([{a:null}]); // works - ambiguous call is resolved to be the first in the overload set so this returns a string @@ -25,15 +28,21 @@ tests/cases/compiler/overloadResolutionTest1.ts(24,15): error TS2322: Type 'true var x2 = foo2({a:0}); // works var x3 = foo2({a:true}); // works var x4 = foo2({a:"s"}); // error - ~ -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. -!!! related TS6500 tests/cases/compiler/overloadResolutionTest1.ts:13:20: The expected type comes from property 'a' which is declared here on type '{ a: boolean; }' + ~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/overloadResolutionTest1.ts:18:16: Overload 1 of 2, '(bar: { a: number; }): string', gave the following error. + Type 'string' is not assignable to type 'number'. +!!! related TS2757 tests/cases/compiler/overloadResolutionTest1.ts:18:16: Overload 2 of 2, '(bar: { a: boolean; }): number', gave the following error. + Type 'string' is not assignable to type 'boolean'. function foo4(bar:{a:number;}):number; function foo4(bar:{a:string;}):string; function foo4(bar:{a:any;}):any{ return bar }; var x = foo4({a:true}); // error - ~ -!!! error TS2322: Type 'true' is not assignable to type 'string'. -!!! 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 + ~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/overloadResolutionTest1.ts:24:15: Overload 1 of 2, '(bar: { a: number; }): number', gave the following error. + Type 'true' is not assignable to type 'number'. +!!! related TS2757 tests/cases/compiler/overloadResolutionTest1.ts:24:15: Overload 2 of 2, '(bar: { a: string; }): string', gave the following error. + Type 'true' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt b/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt index 3db9a29053f..2f2d4a5f5cd 100644 --- a/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt +++ b/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/overloadsWithProvisionalErrors.ts(6,11): error TS2739: Type '{}' is missing the following properties from type '{ a: number; b: number; }': a, b +tests/cases/compiler/overloadsWithProvisionalErrors.ts(6,1): error TS2755: No suitable overload for this call. tests/cases/compiler/overloadsWithProvisionalErrors.ts(7,17): error TS2304: Cannot find name 'blah'. -tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,11): error TS2741: Property 'b' is missing in type '{ a: any; }' but required in type '{ a: number; b: number; }'. +tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,1): error TS2755: No suitable overload for this call. tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cannot find name 'blah'. @@ -11,16 +11,21 @@ tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cann }; func(s => ({})); // Error for no applicable overload (object type is missing a and b) - ~~~~ -!!! error TS2739: Type '{}' is missing the following properties from type '{ a: number; b: number; }': a, b -!!! related TS6502 tests/cases/compiler/overloadsWithProvisionalErrors.ts:3:14: The expected type comes from the return type of this signature. + ~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/overloadsWithProvisionalErrors.ts:6:6: Overload 1 of 2, '(s: string): number', gave the following error. + Argument of type '(s: string) => {}' is not assignable to parameter of type 'string'. +!!! related TS2757 tests/cases/compiler/overloadsWithProvisionalErrors.ts:6:11: Overload 2 of 2, '(lambda: (s: string) => { a: number; b: number; }): string', gave the following error. + Type '{}' is missing the following properties from type '{ a: number; b: number; }': a, b func(s => ({ a: blah, b: 3 })); // Only error inside the function, but not outside (since it would be applicable if not for the provisional error) ~~~~ !!! error TS2304: Cannot find name 'blah'. func(s => ({ a: blah })); // Two errors here, one for blah not being defined, and one for the overload since it would not be applicable anyway - ~~~~~~~~~~~~~ -!!! error TS2741: Property 'b' is missing in type '{ a: any; }' but required in type '{ a: number; b: number; }'. -!!! related TS2728 tests/cases/compiler/overloadsWithProvisionalErrors.ts:3:42: 'b' is declared here. -!!! related TS6502 tests/cases/compiler/overloadsWithProvisionalErrors.ts:3:14: The expected type comes from the return type of this signature. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/overloadsWithProvisionalErrors.ts:8:6: Overload 1 of 2, '(s: string): number', gave the following error. + Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type 'string'. +!!! related TS2757 tests/cases/compiler/overloadsWithProvisionalErrors.ts:8:11: Overload 2 of 2, '(lambda: (s: string) => { a: number; b: number; }): string', gave the following error. + Property 'b' is missing in type '{ a: any; }' but required in type '{ a: number; b: number; }'. ~~~~ !!! error TS2304: Cannot find name 'blah'. \ No newline at end of file diff --git a/tests/baselines/reference/promiseTypeInference.errors.txt b/tests/baselines/reference/promiseTypeInference.errors.txt index 1996f37e540..ebd8bcf947b 100644 --- a/tests/baselines/reference/promiseTypeInference.errors.txt +++ b/tests/baselines/reference/promiseTypeInference.errors.txt @@ -1,10 +1,4 @@ -tests/cases/compiler/promiseTypeInference.ts(10,39): error TS2322: Type 'IPromise' is not assignable to type 'number | PromiseLike'. - Type 'IPromise' is not assignable to type 'PromiseLike'. - Types of property 'then' are incompatible. - Type '(success?: (value: number) => IPromise) => IPromise' is not assignable to type '(onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. - Types of parameters 'success' and 'onfulfilled' are incompatible. - Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. - Type 'TResult1' is not assignable to type 'IPromise'. +tests/cases/compiler/promiseTypeInference.ts(10,11): error TS2755: No suitable overload for this call. ==== tests/cases/compiler/promiseTypeInference.ts (1 errors) ==== @@ -18,13 +12,16 @@ tests/cases/compiler/promiseTypeInference.ts(10,39): error TS2322: Type 'IPromis declare function convert(s: string): IPromise; var $$x = load("something").then(s => convert(s)); - ~~~~~~~~~~ -!!! error TS2322: Type 'IPromise' is not assignable to type 'number | PromiseLike'. -!!! error TS2322: Type 'IPromise' is not assignable to type 'PromiseLike'. -!!! error TS2322: Types of property 'then' are incompatible. -!!! error TS2322: Type '(success?: (value: number) => IPromise) => IPromise' is not assignable to type '(onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. -!!! error TS2322: Types of parameters 'success' and 'onfulfilled' are incompatible. -!!! error TS2322: Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. -!!! error TS2322: Type 'TResult1' is not assignable to type 'IPromise'. -!!! related TS6502 /.ts/lib.es5.d.ts:1406:57: The expected type comes from the return type of this signature. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/promiseTypeInference.ts:10:39: Overload 1 of 2, '(success?: (value: string) => Promise): Promise', gave the following error. + Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. +!!! related TS2757 tests/cases/compiler/promiseTypeInference.ts:10:39: Overload 2 of 2, '(onfulfilled?: (value: string) => number | PromiseLike, onrejected?: (reason: any) => PromiseLike): Promise', gave the following error. + Type 'IPromise' is not assignable to type 'number | PromiseLike'. + Type 'IPromise' is not assignable to type 'PromiseLike'. + Types of property 'then' are incompatible. + Type '(success?: (value: number) => IPromise) => IPromise' is not assignable to type '(onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. + Types of parameters 'success' and 'onfulfilled' are incompatible. + Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. + Type 'TResult1' is not assignable to type 'IPromise'. \ No newline at end of file diff --git a/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt b/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt index dbc1e42c572..d49b31bc38d 100644 --- a/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt +++ b/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt @@ -1,11 +1,6 @@ -tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(27,36): error TS2322: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. - Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. - Type 'void' is not assignable to type 'boolean'. -tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(43,41): error TS2322: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. - Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. - Type 'void' is not assignable to type 'boolean'. -tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2322: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. - Type 'void' is not assignable to type 'boolean'. +tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(27,21): error TS2755: No suitable overload for this call. +tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(43,22): error TS2755: No suitable overload for this call. +tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,21): error TS2755: No suitable overload for this call. ==== tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx (3 errors) ==== @@ -36,11 +31,15 @@ tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2322: // Error: Void not assignable to boolean const Test2 = () => console.log(value)} />; - ~~~~ -!!! error TS2322: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. -!!! error TS2322: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. -!!! error TS2322: Type 'void' is not assignable to type 'boolean'. -!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children" | "error"> & Partial & Readonly, "when">> & Partial boolean; }, never>>' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:27:36: Overload 1 of 2, '(props: Readonly): FieldFeedback', gave the following error. + Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. + Type 'void' is not assignable to type 'boolean'. +!!! related TS2757 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:27:36: Overload 2 of 2, '(props: Props, context?: any): FieldFeedback', gave the following error. + Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. class FieldFeedbackBeta

extends React.Component

{ static defaultProps: BaseProps = { @@ -57,11 +56,15 @@ tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2322: // Error: Void not assignable to boolean const Test2a = () => console.log(value)} error>Hah; - ~~~~ -!!! error TS2322: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. -!!! error TS2322: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. -!!! error TS2322: Type 'void' is not assignable to type 'boolean'. -!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children"> & Partial & Readonly, "when" | "error">> & Partial>' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:43:41: Overload 1 of 2, '(props: Readonly): FieldFeedbackBeta', gave the following error. + Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. + Type 'void' is not assignable to type 'boolean'. +!!! related TS2757 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:43:41: Overload 2 of 2, '(props: Props, context?: any): FieldFeedbackBeta', gave the following error. + Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. interface MyPropsProps extends Props { when: (value: string) => boolean; @@ -83,10 +86,13 @@ tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2322: // Error: Void not assignable to boolean const Test4 = () => console.log(value)} />; - ~~~~ -!!! error TS2322: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. -!!! error TS2322: Type 'void' is not assignable to type 'boolean'. -!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:46:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes> & Pick & Readonly, "children" | "error"> & Partial & Readonly, "when">> & Partial boolean; }, never>>' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:64:37: Overload 1 of 2, '(props: Readonly): FieldFeedback2', gave the following error. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. + Type 'void' is not assignable to type 'boolean'. +!!! related TS2757 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:64:37: Overload 2 of 2, '(props: MyPropsProps, context?: any): FieldFeedback2', gave the following error. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. // OK const Test5 = () => ; diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index 7b13d5e3181..c673a2b26ea 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/functions/strictBindCallApply1.ts(11,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(11,11): error TS2755: No suitable overload for this call. tests/cases/conformance/functions/strictBindCallApply1.ts(17,11): 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(19,44): error TS2554: Expected 3 arguments, but got 4. @@ -8,8 +8,8 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(23,37): error TS2322: tests/cases/conformance/functions/strictBindCallApply1.ts(24,32): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. Types of property 'length' are incompatible. Type '3' is not assignable to type '2'. -tests/cases/conformance/functions/strictBindCallApply1.ts(41,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(42,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(41,11): error TS2755: No suitable overload for this call. +tests/cases/conformance/functions/strictBindCallApply1.ts(42,11): error TS2755: No suitable overload for this call. tests/cases/conformance/functions/strictBindCallApply1.ts(48,11): 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(50,38): error TS2554: Expected 3 arguments, but got 4. @@ -18,7 +18,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(54,26): error TS2345: tests/cases/conformance/functions/strictBindCallApply1.ts(55,31): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(56,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. 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,33): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(62,11): error TS2755: No suitable overload for this call. tests/cases/conformance/functions/strictBindCallApply1.ts(65,1): 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(67,24): error TS2554: Expected 3 arguments, but got 4. @@ -39,8 +39,15 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: let f01 = foo.bind(undefined, 10); let f02 = foo.bind(undefined, 10, "hello"); let f03 = foo.bind(undefined, 10, 20); // Error - ~~ -!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/conformance/functions/strictBindCallApply1.ts:11:35: 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'. +!!! related TS2757 tests/cases/conformance/functions/strictBindCallApply1.ts:11:11: 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'. let f04 = overloaded.bind(undefined); // typeof overloaded let f05 = generic.bind(undefined); // typeof generic @@ -86,11 +93,25 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: let f11 = c.foo.bind(c, 10); let f12 = c.foo.bind(c, 10, "hello"); let f13 = c.foo.bind(c, 10, 20); // Error - ~~ -!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/conformance/functions/strictBindCallApply1.ts:41:29: 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'. +!!! related TS2757 tests/cases/conformance/functions/strictBindCallApply1.ts:41:11: 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'. let f14 = c.foo.bind(undefined); // Error - ~~~~~~~~~ -!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/conformance/functions/strictBindCallApply1.ts:42:22: 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'. +!!! related TS2757 tests/cases/conformance/functions/strictBindCallApply1.ts:42:11: Overload 2 of 6, '(this: (this: C, ...args: (string | number)[]) => string, thisArg: C, ...args: (string | number)[]): (...args: (string | number)[]) => 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: (string | number)[]) => string'. + Types of parameters 'a' and 'args' are incompatible. + Type 'string | number' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded let f16 = c.generic.bind(c); // typeof C.prototype.generic @@ -127,8 +148,15 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: let f21 = C.bind(undefined, 10); let f22 = C.bind(undefined, 10, "hello"); let f23 = C.bind(undefined, 10, 20); // Error - ~~ -!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2755: No suitable overload for this call. +!!! related TS2757 tests/cases/conformance/functions/strictBindCallApply1.ts:62:33: 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'. +!!! related TS2757 tests/cases/conformance/functions/strictBindCallApply1.ts:62:11: 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'. C.call(c, 10, "hello"); C.call(c, 10); // Error