diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 40b86ad679a98..610967cfc4f50 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11793,7 +11793,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); } @@ -11802,13 +11802,22 @@ namespace ts { * attempt to issue more specific errors on, for example, specific object literal properties or tuple members. */ function checkTypeAssignableToAndOptionallyElaborate(source: Type, target: Type, errorNode: Node | undefined, expr: Expression | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined): boolean { - return checkTypeRelatedToAndOptionallyElaborate(source, target, assignableRelation, errorNode, expr, headMessage, containingMessageChain); + return checkTypeRelatedToAndOptionallyElaborate(source, target, assignableRelation, errorNode, expr, headMessage, containingMessageChain, /*errorOutputContainer*/ undefined); } - function checkTypeRelatedToAndOptionallyElaborate(source: Type, target: Type, relation: Map, errorNode: Node | undefined, expr: Expression | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined): boolean { + function checkTypeRelatedToAndOptionallyElaborate( + source: Type, + target: Type, + relation: Map, + errorNode: Node | undefined, + expr: Expression | undefined, + headMessage: DiagnosticMessage | undefined, + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined + ): boolean { if (isTypeRelatedTo(source, target, relation)) return true; - if (!errorNode || !elaborateError(expr, source, target, relation, headMessage)) { - return checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain); + if (!errorNode || !elaborateError(expr, source, target, relation, headMessage, containingMessageChain, errorOutputContainer)) { + return checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer); } return false; } @@ -11817,35 +11826,52 @@ namespace ts { return !!(type.flags & TypeFlags.Conditional || (type.flags & TypeFlags.Intersection && some((type as IntersectionType).types, isOrHasGenericConditional))); } - function elaborateError(node: Expression | undefined, source: Type, target: Type, relation: Map, headMessage: DiagnosticMessage | undefined): boolean { + function elaborateError( + node: Expression | undefined, + source: Type, + target: Type, + relation: Map, + headMessage: DiagnosticMessage | undefined, + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined + ): boolean { if (!node || isOrHasGenericConditional(target)) return false; - if (!checkTypeRelatedTo(source, target, relation, /*errorNode*/ undefined) && elaborateDidYouMeanToCallOrConstruct(node, source, target, relation, headMessage)) { + if (!checkTypeRelatedTo(source, target, relation, /*errorNode*/ undefined) + && 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); + 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); + return elaborateError((node as BinaryExpression).right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; case SyntaxKind.ObjectLiteralExpression: - return elaborateObjectLiteral(node as ObjectLiteralExpression, source, target, relation); + return elaborateObjectLiteral(node as ObjectLiteralExpression, source, target, relation, containingMessageChain, errorOutputContainer); case SyntaxKind.ArrayLiteralExpression: - return elaborateArrayLiteral(node as ArrayLiteralExpression, source, target, relation); + return elaborateArrayLiteral(node as ArrayLiteralExpression, source, target, relation, containingMessageChain, errorOutputContainer); case SyntaxKind.JsxAttributes: - return elaborateJsxComponents(node as JsxAttributes, source, target, relation); + return elaborateJsxComponents(node as JsxAttributes, source, target, relation, containingMessageChain, errorOutputContainer); case SyntaxKind.ArrowFunction: - return elaborateArrowFunction(node as ArrowFunction, source, target, relation); + return elaborateArrowFunction(node as ArrowFunction, source, target, relation, containingMessageChain, errorOutputContainer); } return false; } - function elaborateDidYouMeanToCallOrConstruct(node: Expression, source: Type, target: Type, relation: Map, headMessage: DiagnosticMessage | undefined): boolean { + function elaborateDidYouMeanToCallOrConstruct( + node: Expression, + source: Type, + target: Type, + relation: Map, + headMessage: DiagnosticMessage | undefined, + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined + ): boolean { const callSignatures = getSignaturesOfType(source, SignatureKind.Call); const constructSignatures = getSignaturesOfType(source, SignatureKind.Construct); for (const signatures of [constructSignatures, callSignatures]) { @@ -11853,9 +11879,9 @@ namespace ts { const returnType = getReturnTypeOfSignature(s); return !(returnType.flags & (TypeFlags.Any | TypeFlags.Never)) && checkTypeRelatedTo(returnType, target, relation, /*errorNode*/ undefined); })) { - const resultObj: { error?: Diagnostic } = {}; - 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 @@ -11866,7 +11892,14 @@ namespace ts { return false; } - function elaborateArrowFunction(node: ArrowFunction, source: Type, target: Type, relation: Map): boolean { + function elaborateArrowFunction( + node: ArrowFunction, + source: Type, + target: Type, + relation: Map, + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined + ): boolean { // Don't elaborate blocks if (isBlock(node.body)) { return false; @@ -11887,15 +11920,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); + const elaborated = returnExpression && elaborateError(returnExpression, sourceReturn, targetReturn, relation, /*headMessage*/ undefined, containingMessageChain, errorOutputContainer); if (elaborated) { return elaborated; } - const resultObj: { error?: Diagnostic } = {}; - 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, )); @@ -11912,7 +11945,14 @@ namespace ts { * If that element would issue an error, we first attempt to dive into that element's inner expression and issue a more specific error by recuring into `elaborateError` * Otherwise, we issue an error on _every_ element which fail the assignability check */ - function elaborateElementwise(iterator: ElaborationIterator, source: Type, target: Type, relation: Map) { + function elaborateElementwise( + iterator: ElaborationIterator, + source: Type, + target: Type, + relation: Map, + 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; for (let status = iterator.next(); !status.done; status = iterator.next()) { @@ -11921,22 +11961,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); + 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 } = {}; + 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; @@ -12019,8 +12059,15 @@ namespace ts { return filter(children, i => !isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces); } - function elaborateJsxComponents(node: JsxAttributes, source: Type, target: Type, relation: Map) { - let result = elaborateElementwise(generateJsxAttributes(node), source, target, relation); + function elaborateJsxComponents( + node: JsxAttributes, + source: Type, + target: Type, + relation: Map, + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined + ) { + 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; @@ -12038,17 +12085,21 @@ namespace ts { if (moreThanOneRealChildren) { if (arrayLikeTargetParts !== neverType) { const realSource = createTupleType(checkJsxChildren(containingElement, CheckMode.Normal)); - result = elaborateElementwise(generateJsxChildren(containingElement, getInvalidTextualChildDiagnostic), realSource, arrayLikeTargetParts, relation) || result; + const children = generateJsxChildren(containingElement, getInvalidTextualChildDiagnostic); + result = elaborateElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result; } else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) { // arity mismatch result = true; - error( + const diag = error( containingElement.openingElement.tagName, Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided, childrenPropName, typeToString(childrenTargetType) ); + if (errorOutputContainer && errorOutputContainer.skipLogging) { + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); + } } } else { @@ -12060,19 +12111,24 @@ namespace ts { (function*() { yield elem; })(), source, target, - relation + relation, + containingMessageChain, + errorOutputContainer ) || result; } } else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) { // arity mismatch result = true; - error( + const diag = error( containingElement.openingElement.tagName, Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided, childrenPropName, typeToString(childrenTargetType) ); + if (errorOutputContainer && errorOutputContainer.skipLogging) { + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); + } } } } @@ -12104,15 +12160,22 @@ namespace ts { } } - function elaborateArrayLiteral(node: ArrayLiteralExpression, source: Type, target: Type, relation: Map) { + function elaborateArrayLiteral( + node: ArrayLiteralExpression, + source: Type, + target: Type, + relation: Map, + 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); + 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); + return elaborateElementwise(generateLimitedTupleElements(node, target), tupleizedType, target, relation, containingMessageChain, errorOutputContainer); } return false; } @@ -12141,9 +12204,16 @@ namespace ts { } } - function elaborateObjectLiteral(node: ObjectLiteralExpression, source: Type, target: Type, relation: Map) { + function elaborateObjectLiteral( + node: ObjectLiteralExpression, + source: Type, + target: Type, + relation: Map, + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined + ) { if (target.flags & TypeFlags.Primitive) return false; - return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation); + return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer); } /** @@ -12484,6 +12554,7 @@ namespace ts { * @param errorNode The suggested node upon which all errors will be reported, if defined. This may or may not be the actual node used. * @param headMessage If the error chain should be prepended by a head message, then headMessage will be used. * @param containingMessageChain A chain of errors to prepend any new errors found. + * @param errorOutputContainer Return the diagnostic. Do not log if 'skipLogging' is truthy. */ function checkTypeRelatedTo( source: Type, @@ -12492,9 +12563,8 @@ namespace ts { errorNode: Node | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined, - errorOutputContainer?: { error?: Diagnostic } + errorOutputContainer?: { errors?: Diagnostic[], skipLogging?: boolean }, ): boolean { - let errorInfo: DiagnosticMessageChain | undefined; let relatedInfo: [DiagnosticRelatedInformation, ...DiagnosticRelatedInformation[]] | undefined; let maybeKeys: string[]; @@ -12510,13 +12580,17 @@ namespace ts { const result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage); if (overflow) { - error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); + const diag = error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); + if (errorOutputContainer) { + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); + } } else if (errorInfo) { if (containingMessageChain) { const chain = containingMessageChain(); if (chain) { - errorInfo = concatenateDiagnosticMessageChains(chain, errorInfo); + concatenateDiagnosticMessageChains(chain, errorInfo); + errorInfo = chain; } } @@ -12533,15 +12607,19 @@ namespace ts { } } } - const diag = createDiagnosticForNodeFromMessageChain(errorNode!, errorInfo, relatedInformation); if (relatedInfo) { addRelatedInfo(diag, ...relatedInfo); } if (errorOutputContainer) { - errorOutputContainer.error = diag; + (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag); + } + if (!errorOutputContainer || !errorOutputContainer.skipLogging) { + diagnostics.add(diag); } - diagnostics.add(diag); // TODO: GH#18217 + } + if (errorNode && errorOutputContainer && errorOutputContainer.skipLogging && result === Ternary.False) { + Debug.assert(!!errorOutputContainer.errors, "missed opportunity to interact with error."); } return result !== Ternary.False; @@ -21273,24 +21351,48 @@ namespace ts { * @param signature a candidate signature we are trying whether it is a call signature * @param relation a relationship to check parameter and argument type */ - function checkApplicableSignatureForJsxOpeningLikeElement(node: JsxOpeningLikeElement, signature: Signature, relation: Map, checkMode: CheckMode, reportErrors: boolean) { + function checkApplicableSignatureForJsxOpeningLikeElement( + node: JsxOpeningLikeElement, + signature: Signature, + relation: Map, + checkMode: CheckMode, + reportErrors: boolean, + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + 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, // can be specified by users through attributes property. const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node); const attributesType = checkExpressionWithContextualType(node.attributes, paramType, /*inferenceContext*/ undefined, checkMode); - return checkTypeRelatedToAndOptionallyElaborate(attributesType, paramType, relation, reportErrors ? node.tagName : undefined, node.attributes); - } - - function checkApplicableSignature( + return checkTypeRelatedToAndOptionallyElaborate( + attributesType, + paramType, + relation, + reportErrors ? node.tagName : undefined, + node.attributes, + /*headMessage*/ undefined, + containingMessageChain, + errorOutputContainer); + } + + function getSignatureApplicabilityError( node: CallLikeExpression, args: ReadonlyArray, signature: Signature, relation: Map, checkMode: CheckMode, - reportErrors: boolean) { + reportErrors: boolean, + containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined, + ) { + + const errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } = { errors: undefined, skipLogging: true }; if (isJsxOpeningLikeElement(node)) { - return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors); + if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer)) { + Debug.assert(!reportErrors || !!errorOutputContainer.errors, "jsx should have errors when reporting errors"); + return errorOutputContainer.errors || []; + } + return undefined; } const thisType = getThisTypeOfSignature(signature); if (thisType && thisType !== voidType && node.kind !== SyntaxKind.NewExpression) { @@ -21301,8 +21403,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; - if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage)) { - return false; + if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer)) { + Debug.assert(!reportErrors || !!errorOutputContainer.errors, "this parameter should have errors when reporting errors"); + return errorOutputContainer.errors || []; } } const headMessage = Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; @@ -21317,17 +21420,21 @@ 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; - if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage)) { - return false; + if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer)) { + Debug.assert(!reportErrors || !!errorOutputContainer.errors, "parameter should have errors when reporting errors"); + 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; - return checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage); + if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, /*containingMessageChain*/ undefined, errorOutputContainer)) { + Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors"); + return errorOutputContainer.errors || []; + } } - return true; + return undefined; } /** @@ -21645,7 +21752,7 @@ namespace ts { // function foo(): void; // foo(0); // - let candidateForArgumentError: Signature | undefined; + let candidatesForArgumentError: Signature[] | undefined; let candidateForArgumentArityError: Signature | undefined; let candidateForTypeArgumentError: Signature | undefined; let result: Signature | undefined; @@ -21680,9 +21787,55 @@ namespace ts { // If candidate is undefined, it means that no candidates had a suitable arity. In that case, // skip the checkApplicableSignature check. if (reportErrors) { + if (candidatesForArgumentError) { + if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) { + const last = candidatesForArgumentError[candidatesForArgumentError.length - 1]; + let chain: DiagnosticMessageChain | undefined; + if (candidatesForArgumentError.length > 3) { + chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error); + chain = chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call); + } + const diags = getSignatureApplicabilityError(node, args, last, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, () => chain); + if (diags) { + for (const d of diags) { + if (last.declaration && candidatesForArgumentError.length > 3) { + addRelatedInfo(d, createDiagnosticForNode(last.declaration, Diagnostics.The_last_overload_is_declared_here)); + } + diagnostics.add(d); + } + } + else { + Debug.fail("No error for last overload signature"); + } + } + else { + const allDiagnostics: DiagnosticRelatedInformation[][] = []; + let max = 0; + let min = Number.MAX_VALUE; + let minIndex = 0; + let i = 0; + for (const c of candidatesForArgumentError) { + const chain = () => chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Overload_0_of_1_2_gave_the_following_error, i + 1, candidates.length, signatureToString(c)); + const diags = getSignatureApplicabilityError(node, args, c, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, chain); + if (diags) { + if (diags.length <= min) { + min = diags.length; + minIndex = i; + } + max = Math.max(max, diags.length); + allDiagnostics.push(diags); + } + else { + Debug.fail("No error for 3 or fewer overload signatures"); + } + i++; + } - if (candidateForArgumentError) { - checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, CheckMode.Normal, /*reportErrors*/ true); + const diags = max > 1 ? allDiagnostics[minIndex] : flatten(allDiagnostics); + const chain = map(diags, d => typeof d.messageText === "string" ? (d as DiagnosticMessageChain) : d.messageText); + const related = flatMap(diags, d => (d as Diagnostic).relatedInformation) as DiagnosticRelatedInformation[]; + diagnostics.add(createDiagnosticForNodeFromMessageChain(node, chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call), related)); + } } else if (candidateForArgumentArityError) { diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args)); @@ -21707,7 +21860,7 @@ namespace ts { return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray); function chooseOverload(candidates: Signature[], relation: Map, signatureHelpTrailingComma = false) { - candidateForArgumentError = undefined; + candidatesForArgumentError = undefined; candidateForArgumentArityError = undefined; candidateForTypeArgumentError = undefined; @@ -21716,8 +21869,8 @@ namespace ts { if (typeArguments || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma)) { return undefined; } - if (!checkApplicableSignature(node, args, candidate, relation, CheckMode.Normal, /*reportErrors*/ false)) { - candidateForArgumentError = candidate; + if (getSignatureApplicabilityError(node, args, candidate, relation, CheckMode.Normal, /*reportErrors*/ false, /*containingMessageChain*/ undefined)) { + candidatesForArgumentError = [candidate]; return undefined; } return candidate; @@ -21757,11 +21910,9 @@ namespace ts { else { checkCandidate = candidate; } - if (!checkApplicableSignature(node, args, checkCandidate, relation, argCheckMode, /*reportErrors*/ false)) { + if (getSignatureApplicabilityError(node, args, checkCandidate, relation, argCheckMode, /*reportErrors*/ false, /*containingMessageChain*/ undefined)) { // Give preference to error candidates that have no rest parameters (as they are more specific) - if (!candidateForArgumentError || getEffectiveRestType(candidateForArgumentError) || !getEffectiveRestType(checkCandidate)) { - candidateForArgumentError = checkCandidate; - } + (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate); continue; } if (argCheckMode) { @@ -21779,11 +21930,9 @@ namespace ts { continue; } } - if (!checkApplicableSignature(node, args, checkCandidate, relation, argCheckMode, /*reportErrors*/ false)) { + if (getSignatureApplicabilityError(node, args, checkCandidate, relation, argCheckMode, /*reportErrors*/ false, /*containingMessageChain*/ undefined)) { // Give preference to error candidates that have no rest parameters (as they are more specific) - if (!candidateForArgumentError || getEffectiveRestType(candidateForArgumentError) || !getEffectiveRestType(checkCandidate)) { - candidateForArgumentError = checkCandidate; - } + (candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate); continue; } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 545e5d7bdda06..e0e70c7294364 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -600,24 +600,18 @@ namespace ts { * * @param array The array to flatten. */ - export function flatten(array: ReadonlyArray | undefined>): T[]; - export function flatten(array: ReadonlyArray | undefined> | undefined): T[] | undefined; - export function flatten(array: ReadonlyArray | undefined> | undefined): T[] | undefined { - let result: T[] | undefined; - if (array) { - result = []; - for (const v of array) { - if (v) { - if (isArray(v)) { - addRange(result, v); - } - else { - result.push(v); - } + export function flatten(array: T[][] | ReadonlyArray | undefined>): T[] { + const result = []; + for (const v of array) { + if (v) { + if (isArray(v)) { + addRange(result, v); + } + else { + result.push(v); } } } - return result; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c404851af3e90..3b426f2d0c6be 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2677,6 +2677,22 @@ "category": "Error", "code": 2768 }, + "No overload matches this call.": { + "category": "Error", + "code": 2769 + }, + "The last overload gave the following error.": { + "category": "Error", + "code": 2770 + }, + "The last overload is declared here.": { + "category": "Error", + "code": 2771 + }, + "Overload {0} of {1}, '{2}', gave the following error.": { + "category": "Error", + "code": 2772 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 889d24549e55c..664e2d0319d9a 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -502,30 +502,29 @@ namespace ts { return output; } - export function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain | undefined, newLine: string): string { - if (isString(messageText)) { - return messageText; + export function flattenDiagnosticMessageText(diag: string | DiagnosticMessageChain | undefined, newLine: string, indent = 0): string { + if (isString(diag)) { + return diag; } - else { - let diagnosticChain = messageText; - let result = ""; - - let indent = 0; - while (diagnosticChain) { - if (indent) { - result += newLine; + else if (diag === undefined) { + return ""; + } + let result = ""; + if (indent) { + result += newLine; - for (let i = 0; i < indent; i++) { - result += " "; - } - } - result += diagnosticChain.messageText; - indent++; - diagnosticChain = diagnosticChain.next; + for (let i = 0; i < indent; i++) { + result += " "; + } + } + result += diag.messageText; + indent++; + if (diag.next) { + for (const kid of diag.next) { + result += flattenDiagnosticMessageText(kid, newLine, indent); } - - return result; } + return result; } /* @internal */ diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a31e707f98496..a88580f9b1240 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4577,7 +4577,7 @@ namespace ts { messageText: string; category: DiagnosticCategory; code: number; - next?: DiagnosticMessageChain; + next?: DiagnosticMessageChain[]; } export interface Diagnostic extends DiagnosticRelatedInformation { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index e9b23bdedf024..3203e10f370e7 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7125,8 +7125,8 @@ namespace ts { }; } - export function chainDiagnosticMessages(details: DiagnosticMessageChain | undefined, message: DiagnosticMessage, ...args: (string | number | undefined)[]): DiagnosticMessageChain; - export function chainDiagnosticMessages(details: DiagnosticMessageChain | undefined, message: DiagnosticMessage): DiagnosticMessageChain { + export function chainDiagnosticMessages(details: DiagnosticMessageChain | DiagnosticMessageChain[] | undefined, message: DiagnosticMessage, ...args: (string | number | undefined)[]): DiagnosticMessageChain; + export function chainDiagnosticMessages(details: DiagnosticMessageChain | DiagnosticMessageChain[] | undefined, message: DiagnosticMessage): DiagnosticMessageChain { let text = getLocaleSpecificMessage(message); if (arguments.length > 2) { @@ -7138,18 +7138,17 @@ namespace ts { category: message.category, code: message.code, - next: details + next: details === undefined || Array.isArray(details) ? details : [details] }; } - export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain { + export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): void { let lastChain = headChain; while (lastChain.next) { - lastChain = lastChain.next; + lastChain = lastChain.next[0]; } - lastChain.next = tailChain; - return headChain; + lastChain.next = [tailChain]; } function getDiagnosticFilePath(diagnostic: Diagnostic): string | undefined { @@ -7185,29 +7184,42 @@ namespace ts { } function compareMessageText(t1: string | DiagnosticMessageChain, t2: string | DiagnosticMessageChain): Comparison { - let text1: string | DiagnosticMessageChain | undefined = t1; - let text2: string | DiagnosticMessageChain | undefined = t2; - while (text1 && text2) { - // We still have both chains. - const string1 = isString(text1) ? text1 : text1.messageText; - const string2 = isString(text2) ? text2 : text2.messageText; - - const res = compareStringsCaseSensitive(string1, string2); + if (typeof t1 === "string" && typeof t2 === "string") { + return compareStringsCaseSensitive(t1, t2); + } + else if (typeof t1 === "string") { + return Comparison.LessThan; + } + else if (typeof t2 === "string") { + return Comparison.GreaterThan; + } + let res = compareStringsCaseSensitive(t1.messageText, t2.messageText); + if (res) { + return res; + } + if (!t1.next && !t2.next) { + return Comparison.EqualTo; + } + if (!t1.next) { + return Comparison.LessThan; + } + if (!t2.next) { + return Comparison.GreaterThan; + } + const len = Math.min(t1.next.length, t2.next.length); + for (let i = 0; i < len; i++) { + res = compareMessageText(t1.next[i], t2.next[i]); if (res) { return res; } - - text1 = isString(text1) ? undefined : text1.next; - text2 = isString(text2) ? undefined : text2.next; } - - if (!text1 && !text2) { - // if the chains are done, then these messages are the same. - return Comparison.EqualTo; + if (t1.next.length < t2.next.length) { + return Comparison.LessThan; } - - // We still have one chain remaining. The shorter chain should come first. - return text1 ? Comparison.GreaterThan : Comparison.LessThan; + else if (t1.next.length > t2.next.length) { + return Comparison.GreaterThan; + } + return Comparison.EqualTo; } export function getEmitScriptTarget(compilerOptions: CompilerOptions) { @@ -8105,7 +8117,7 @@ namespace ts { visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth); } - return flatten(results); + return flatten(results); function visitDirectory(path: string, absolutePath: string, depth: number | undefined) { const canonicalPath = toCanonical(realpath(absolutePath)); diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c26b059ced8e5..ffc0759e92ebf 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1497,13 +1497,7 @@ Actual: ${stringify(fullActual)}`); const diagnostics = ts.getPreEmitDiagnostics(this.languageService.getProgram()!); // TODO: GH#18217 for (const diagnostic of diagnostics) { if (!ts.isString(diagnostic.messageText)) { - let chainedMessage: ts.DiagnosticMessageChain | undefined = diagnostic.messageText; - let indentation = " "; - while (chainedMessage) { - resultString += indentation + chainedMessage.messageText + Harness.IO.newLine(); - chainedMessage = chainedMessage.next; - indentation = indentation + " "; - } + resultString += this.flattenChainedMessage(diagnostic.messageText); } else { resultString += " " + diagnostic.messageText + Harness.IO.newLine(); @@ -1521,6 +1515,17 @@ Actual: ${stringify(fullActual)}`); Harness.Baseline.runBaseline(ts.Debug.assertDefined(this.testData.globalOptions[MetadataOptionNames.baselineFile]), resultString); } + private flattenChainedMessage(diag: ts.DiagnosticMessageChain, indent = " ") { + let result = ""; + result += indent + diag.messageText + Harness.IO.newLine(); + if (diag.next) { + for (const kid of diag.next) { + result += this.flattenChainedMessage(kid, indent + " "); + } + } + return result; + } + public baselineQuickInfo() { const baselineFile = this.getBaselineFileName(); Harness.Baseline.runBaseline( diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index dfb9947447fa6..b4a089f63b9e7 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2457,7 +2457,7 @@ declare namespace ts { messageText: string; category: DiagnosticCategory; code: number; - next?: DiagnosticMessageChain; + next?: DiagnosticMessageChain[]; } interface Diagnostic extends DiagnosticRelatedInformation { /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ @@ -4277,7 +4277,7 @@ declare namespace ts { function formatDiagnostics(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string; function formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; - function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain | undefined, newLine: string): string; + function flattenDiagnosticMessageText(diag: string | DiagnosticMessageChain | undefined, newLine: string, indent?: number): string; function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): ReadonlyArray; /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index a0833bf618ebb..46f1c31e6e353 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2457,7 +2457,7 @@ declare namespace ts { messageText: string; category: DiagnosticCategory; code: number; - next?: DiagnosticMessageChain; + next?: DiagnosticMessageChain[]; } interface Diagnostic extends DiagnosticRelatedInformation { /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */ @@ -4277,7 +4277,7 @@ declare namespace ts { function formatDiagnostics(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string; function formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray, host: FormatDiagnosticsHost): string; - function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain | undefined, newLine: string): string; + function flattenDiagnosticMessageText(diag: string | DiagnosticMessageChain | undefined, newLine: string, indent?: number): string; function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): ReadonlyArray; /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index 993f43d5a055f..9b1b99401c2d0 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -1,9 +1,30 @@ tests/cases/compiler/bigintWithLib.ts(4,1): error TS2350: Only a void function can be called with the 'new' keyword. -tests/cases/compiler/bigintWithLib.ts(16,33): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. - Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag] +tests/cases/compiler/bigintWithLib.ts(16,15): error TS2769: No overload matches this call. + Overload 1 of 3, '(length?: number): BigInt64Array', gave the following error. + Argument of type 'number[]' is not assignable to parameter of type 'number'. + Overload 2 of 3, '(array: Iterable): BigInt64Array', gave the following error. + Argument of type 'number[]' is not assignable to parameter of type 'Iterable'. + Types of property '[Symbol.iterator]' are incompatible. + Type '() => IterableIterator' is not assignable to type '() => Iterator'. + Type 'IterableIterator' is not assignable to type 'Iterator'. + Types of property 'next' are incompatible. + Type '(...args: [] | [undefined]) => IteratorResult' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'number' is not assignable to type 'bigint'. + Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigInt64Array', gave the following error. + Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. + Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag] tests/cases/compiler/bigintWithLib.ts(21,13): error TS2540: Cannot assign to 'length' because it is a read-only property. -tests/cases/compiler/bigintWithLib.ts(28,35): error TS2345: 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(28,16): error TS2769: No overload matches this call. + Overload 1 of 3, '(length?: number): BigUint64Array', gave the following error. + Argument of type 'number[]' is not assignable to parameter of type 'number'. + Overload 2 of 3, '(array: Iterable): BigUint64Array', gave the following error. + Argument of type 'number[]' is not assignable to parameter of type 'Iterable'. + Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigUint64Array', gave the following error. + 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'. @@ -28,9 +49,24 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12 bigIntArray = new BigInt64Array(10); bigIntArray = new BigInt64Array([1n, 2n, 3n]); bigIntArray = new BigInt64Array([1, 2, 3]); // should error - ~~~~~~~~~ -!!! error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. -!!! error TS2345: Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(length?: number): BigInt64Array', gave the following error. +!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'number'. +!!! error TS2769: Overload 2 of 3, '(array: Iterable): BigInt64Array', gave the following error. +!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'Iterable'. +!!! error TS2769: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2769: Type '() => IterableIterator' is not assignable to type '() => Iterator'. +!!! error TS2769: Type 'IterableIterator' is not assignable to type 'Iterator'. +!!! error TS2769: Types of property 'next' are incompatible. +!!! error TS2769: Type '(...args: [] | [undefined]) => IteratorResult' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. +!!! error TS2769: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2769: Type 'number' is not assignable to type 'bigint'. +!!! error TS2769: Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigInt64Array', gave the following error. +!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. +!!! error TS2769: Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag] bigIntArray = new BigInt64Array(new ArrayBuffer(80)); bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8); bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3); @@ -45,9 +81,15 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12 bigUintArray = new BigUint64Array(10); bigUintArray = new BigUint64Array([1n, 2n, 3n]); bigUintArray = new BigUint64Array([1, 2, 3]); // should error - ~~~~~~~~~ -!!! error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. -!!! error TS2345: Type 'number[]' is not assignable to type 'SharedArrayBuffer'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(length?: number): BigUint64Array', gave the following error. +!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'number'. +!!! error TS2769: Overload 2 of 3, '(array: Iterable): BigUint64Array', gave the following error. +!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'Iterable'. +!!! error TS2769: Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigUint64Array', gave the following error. +!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. +!!! error TS2769: Type 'number[]' is not assignable to type 'SharedArrayBuffer'. bigUintArray = new BigUint64Array(new ArrayBuffer(80)); bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8); bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3); diff --git a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt index 66078776c5f9c..b8ad32a540879 100644 --- a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt @@ -1,8 +1,14 @@ -tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2322: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. - Types of property 'children' are incompatible. - Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. - Types of property 'length' are incompatible. - Type '3' is not assignable to type '2'. +tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx(17,17): error TS2769: No overload matches this call. + Overload 1 of 2, '(props: Readonly): ResizablePanel', gave the following error. + Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. + Types of property 'children' are incompatible. + Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. + Types of property 'length' are incompatible. + Type '3' is not assignable to type '2'. + Overload 2 of 2, '(props: ResizablePanelProps, context?: any): ResizablePanel', gave the following error. + Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. + Types of property 'children' are incompatible. + Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. ==== tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx (1 errors) ==== @@ -23,12 +29,18 @@ tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2 const testErr = - ~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. -!!! error TS2322: Types of property 'children' are incompatible. -!!! error TS2322: Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. -!!! error TS2322: Types of property 'length' are incompatible. -!!! error TS2322: Type '3' is not assignable to type '2'. + ~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(props: Readonly): ResizablePanel', gave the following error. +!!! error TS2769: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. +!!! error TS2769: Types of property 'children' are incompatible. +!!! error TS2769: Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. +!!! error TS2769: Types of property 'length' are incompatible. +!!! error TS2769: Type '3' is not assignable to type '2'. +!!! error TS2769: Overload 2 of 2, '(props: ResizablePanelProps, context?: any): ResizablePanel', gave the following error. +!!! error TS2769: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. +!!! error TS2769: Types of property 'children' are incompatible. +!!! error TS2769: Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'.
diff --git a/tests/baselines/reference/constructorOverloads1.errors.txt b/tests/baselines/reference/constructorOverloads1.errors.txt index 2e8c79d159ab7..f7775bf78ae88 100644 --- a/tests/baselines/reference/constructorOverloads1.errors.txt +++ b/tests/baselines/reference/constructorOverloads1.errors.txt @@ -2,8 +2,16 @@ tests/cases/compiler/constructorOverloads1.ts(2,5): error TS2392: Multiple const tests/cases/compiler/constructorOverloads1.ts(3,5): error TS2392: Multiple constructor implementations are not allowed. tests/cases/compiler/constructorOverloads1.ts(4,5): error TS2392: Multiple constructor implementations are not allowed. tests/cases/compiler/constructorOverloads1.ts(7,5): error TS2392: Multiple constructor implementations are not allowed. -tests/cases/compiler/constructorOverloads1.ts(16,18): error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'number'. -tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2345: Argument of type 'any[]' is not assignable to parameter of type 'number'. +tests/cases/compiler/constructorOverloads1.ts(16,10): error TS2769: No overload matches this call. + Overload 1 of 2, '(s: string): Foo', gave the following error. + Argument of type 'Foo' is not assignable to parameter of type 'string'. + Overload 2 of 2, '(n: number): Foo', gave the following error. + Argument of type 'Foo' is not assignable to parameter of type 'number'. +tests/cases/compiler/constructorOverloads1.ts(17,10): error TS2769: No overload matches this call. + Overload 1 of 2, '(s: string): Foo', gave the following error. + Argument of type 'any[]' is not assignable to parameter of type 'string'. + Overload 2 of 2, '(n: number): Foo', gave the following error. + Argument of type 'any[]' is not assignable to parameter of type 'number'. ==== tests/cases/compiler/constructorOverloads1.ts (6 errors) ==== @@ -35,11 +43,19 @@ tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2345: Argument of var f1 = new Foo("hey"); var f2 = new Foo(0); var f3 = new Foo(f1); - ~~ -!!! error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'number'. + ~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(s: string): Foo', gave the following error. +!!! error TS2769: Argument of type 'Foo' is not assignable to parameter of type 'string'. +!!! error TS2769: Overload 2 of 2, '(n: number): Foo', gave the following error. +!!! error TS2769: Argument of type 'Foo' is not assignable to parameter of type 'number'. var f4 = new Foo([f1,f2,f3]); - ~~~~~~~~~~ -!!! error TS2345: Argument of type 'any[]' is not assignable to parameter of type 'number'. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(s: string): Foo', gave the following error. +!!! error TS2769: Argument of type 'any[]' is not assignable to parameter of type 'string'. +!!! error TS2769: Overload 2 of 2, '(n: number): Foo', gave the following error. +!!! error TS2769: Argument of type 'any[]' is not assignable to parameter of type 'number'. f1.bar1(); f1.bar2(); diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt index 747bbb9db8eed..96e40ea87cbf5 100644 --- a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt +++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt @@ -1,11 +1,31 @@ -tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(27,13): error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. - Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. -tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(28,13): error TS2322: Type '{ onClick: (k: any) => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. - Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. -tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(29,13): error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. - Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. -tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(30,13): error TS2322: Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. - Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. +tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(27,12): error TS2769: No overload matches this call. + Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. + Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. + Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. + Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. + Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. + Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. +tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(28,12): error TS2769: No overload matches this call. + Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. + Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. + Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. + Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. + Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. + Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. +tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(29,12): error TS2769: No overload matches this call. + Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. + Type '{ extra: true; goTo: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. + Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. + Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. + Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. + Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. +tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(30,12): error TS2769: No overload matches this call. + Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. + Type '{ goTo: string; extra: true; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. + Property 'goTo' does not exist on type 'IntrinsicAttributes & ButtonProps'. + Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. + Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. + Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(33,13): error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,13): error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. @@ -40,21 +60,41 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,13): err } const b0 = {console.log(k)}}} extra />; // k has type "left" | "right" - ~~~~~~~~~~ -!!! error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. -!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. +!!! error TS2769: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. +!!! error TS2769: Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. +!!! error TS2769: Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. +!!! error TS2769: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. +!!! error TS2769: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. const b2 = {console.log(k)}} extra />; // k has type "left" | "right" - ~~~~~~~~~~ -!!! error TS2322: Type '{ onClick: (k: any) => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. -!!! error TS2322: Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. +!!! error TS2769: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. +!!! error TS2769: Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. +!!! error TS2769: Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. +!!! error TS2769: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. +!!! error TS2769: Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. const b3 = ; // goTo has type"home" | "contact" - ~~~~~~~~~~ -!!! error TS2322: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. -!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. +!!! error TS2769: Type '{ extra: true; goTo: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. +!!! error TS2769: Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. +!!! error TS2769: Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. +!!! error TS2769: Type '{ extra: true; goTo: "home"; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. +!!! error TS2769: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. const b4 = ; // goTo has type "home" | "contact" - ~~~~~~~~~~ -!!! error TS2322: Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. -!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(buttonProps: ButtonProps): Element', gave the following error. +!!! error TS2769: Type '{ goTo: string; extra: true; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. +!!! error TS2769: Property 'goTo' does not exist on type 'IntrinsicAttributes & ButtonProps'. +!!! error TS2769: Overload 2 of 2, '(linkProps: LinkProps): Element', gave the following error. +!!! error TS2769: Type '{ goTo: "home"; extra: true; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. +!!! error TS2769: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. export function NoOverload(buttonProps: ButtonProps): JSX.Element { return undefined } const c1 = {console.log(k)}}} extra />; // k has type any diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.types b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.types index 1d3508ff5c7d5..badb7b0d4e97c 100644 --- a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.types +++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.types @@ -81,14 +81,14 @@ const b2 = {console.log(k)}} extra />; // k has type >b2 : JSX.Element >{console.log(k)}} extra /> : JSX.Element >MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; } ->onClick : (k: any) => void ->(k)=>{console.log(k)} : (k: any) => void ->k : any +>onClick : (k: "left" | "right") => void +>(k)=>{console.log(k)} : (k: "left" | "right") => void +>k : "left" | "right" >console.log(k) : void >console.log : (message?: any, ...optionalParams: any[]) => void >console : Console >log : (message?: any, ...optionalParams: any[]) => void ->k : any +>k : "left" | "right" >extra : true const b3 = ; // goTo has type"home" | "contact" diff --git a/tests/baselines/reference/controlFlowIterationErrors.errors.txt b/tests/baselines/reference/controlFlowIterationErrors.errors.txt index 28cbf8bdc478a..3d9ac86964912 100644 --- a/tests/baselines/reference/controlFlowIterationErrors.errors.txt +++ b/tests/baselines/reference/controlFlowIterationErrors.errors.txt @@ -2,10 +2,20 @@ tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(11,17): error Type 'number' is not assignable to type 'string'. tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(22,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(34,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(45,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. - Type 'string' is not assignable to type 'number'. +tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(34,13): error TS2769: No overload matches this call. + Overload 1 of 2, '(x: string): number', gave the following error. + Argument of type 'string | number' is not assignable to parameter of type 'string'. + Type 'number' is not assignable to type 'string'. + Overload 2 of 2, '(x: number): string', gave the following error. + Argument of type 'string | number' is not assignable to parameter of type 'number'. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(45,13): error TS2769: No overload matches this call. + Overload 1 of 2, '(x: string): number', gave the following error. + Argument of type 'string | number' is not assignable to parameter of type 'string'. + Type 'number' is not assignable to type 'string'. + Overload 2 of 2, '(x: number): string', gave the following error. + Argument of type 'string | number' is not assignable to parameter of type 'number'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts (4 errors) ==== @@ -49,9 +59,14 @@ tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(45,17): error x = ""; while (cond) { x = foo(x); - ~ -!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. -!!! error TS2345: Type 'string' is not assignable to type 'number'. + ~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(x: string): number', gave the following error. +!!! error TS2769: Argument of type 'string | number' is not assignable to parameter of type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Overload 2 of 2, '(x: number): string', gave the following error. +!!! error TS2769: Argument of type 'string | number' is not assignable to parameter of type 'number'. +!!! error TS2769: Type 'string' is not assignable to type 'number'. x; } x; @@ -63,9 +78,14 @@ tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(45,17): error while (cond) { x; x = foo(x); - ~ -!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. -!!! error TS2345: Type 'string' is not assignable to type 'number'. + ~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(x: string): number', gave the following error. +!!! error TS2769: Argument of type 'string | number' is not assignable to parameter of type 'string'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Overload 2 of 2, '(x: number): string', gave the following error. +!!! error TS2769: Argument of type 'string | number' is not assignable to parameter of type 'number'. +!!! error TS2769: Type 'string' is not assignable to type 'number'. } x; } diff --git a/tests/baselines/reference/destructuringTuple.errors.txt b/tests/baselines/reference/destructuringTuple.errors.txt index cd366409dc807..32b94ff418410 100644 --- a/tests/baselines/reference/destructuringTuple.errors.txt +++ b/tests/baselines/reference/destructuringTuple.errors.txt @@ -1,5 +1,9 @@ tests/cases/compiler/destructuringTuple.ts(11,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'. -tests/cases/compiler/destructuringTuple.ts(11,60): error TS2345: Argument of type 'number' is not assignable to parameter of type 'ConcatArray'. +tests/cases/compiler/destructuringTuple.ts(11,48): error TS2769: No overload matches this call. + Overload 1 of 2, '(...items: ConcatArray[]): never[]', gave the following error. + Argument of type 'number' is not assignable to parameter of type 'ConcatArray'. + Overload 2 of 2, '(...items: ConcatArray[]): never[]', gave the following error. + Argument of type 'number' is not assignable to parameter of type 'ConcatArray'. ==== tests/cases/compiler/destructuringTuple.ts (2 errors) ==== @@ -16,8 +20,12 @@ tests/cases/compiler/destructuringTuple.ts(11,60): error TS2345: Argument of typ const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []); ~~~~~ !!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'. - ~~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'ConcatArray'. + ~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(...items: ConcatArray[]): never[]', gave the following error. +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'ConcatArray'. +!!! error TS2769: Overload 2 of 2, '(...items: ConcatArray[]): never[]', gave the following error. +!!! error TS2769: Argument of type 'number' is not assignable to parameter of type 'ConcatArray'. const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []); \ No newline at end of file diff --git a/tests/baselines/reference/for-of39.errors.txt b/tests/baselines/reference/for-of39.errors.txt index fedf9f3e3435e..a36c1c28a8ca6 100644 --- a/tests/baselines/reference/for-of39.errors.txt +++ b/tests/baselines/reference/for-of39.errors.txt @@ -1,10 +1,42 @@ -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 TS2769: No overload matches this call. + 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 '(...args: [] | [undefined]) => IteratorResult<[string, number] | [string, true], any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. + Type 'IteratorResult<[string, number] | [string, true], any>' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult'. + 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'. + Overload 2 of 3, '(entries?: readonly (readonly [string, boolean])[]): Map', gave the following error. + Type 'number' is not assignable to type 'boolean'. ==== 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 TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(iterable: Iterable): Map', gave the following error. +!!! error TS2769: Argument of type '([string, number] | [string, true])[]' is not assignable to parameter of type 'Iterable'. +!!! error TS2769: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2769: Type '() => IterableIterator<[string, number] | [string, true]>' is not assignable to type '() => Iterator'. +!!! error TS2769: Type 'IterableIterator<[string, number] | [string, true]>' is not assignable to type 'Iterator'. +!!! error TS2769: Types of property 'next' are incompatible. +!!! error TS2769: Type '(...args: [] | [undefined]) => IteratorResult<[string, number] | [string, true], any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. +!!! error TS2769: Type 'IteratorResult<[string, number] | [string, true], any>' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult'. +!!! error TS2769: Type '[string, number] | [string, true]' is not assignable to type 'readonly [string, boolean]'. +!!! error TS2769: Type '[string, number]' is not assignable to type 'readonly [string, boolean]'. +!!! error TS2769: Types of property '1' are incompatible. +!!! error TS2769: Type 'number' is not assignable to type 'boolean'. +!!! error TS2769: Overload 2 of 3, '(entries?: readonly (readonly [string, boolean])[]): Map', gave the following error. +!!! error TS2769: Type 'number' is not assignable to type 'boolean'. for (var [k, v] of map) { k; v; diff --git a/tests/baselines/reference/functionOverloads2.errors.txt b/tests/baselines/reference/functionOverloads2.errors.txt index 60fbe2843d9d2..521b833564791 100644 --- a/tests/baselines/reference/functionOverloads2.errors.txt +++ b/tests/baselines/reference/functionOverloads2.errors.txt @@ -1,4 +1,8 @@ -tests/cases/compiler/functionOverloads2.ts(4,13): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. +tests/cases/compiler/functionOverloads2.ts(4,9): 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'. + Overload 2 of 2, '(bar: number): number', gave the following error. + Argument of type 'true' is not assignable to parameter of type 'number'. ==== tests/cases/compiler/functionOverloads2.ts (1 errors) ==== @@ -6,5 +10,9 @@ tests/cases/compiler/functionOverloads2.ts(4,13): error TS2345: Argument of type function foo(bar: number): number; function foo(bar: any): any { return bar }; var x = foo(true); - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. \ No newline at end of file + ~~~~~~~~~ +!!! 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: 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 diff --git a/tests/baselines/reference/functionOverloads40.errors.txt b/tests/baselines/reference/functionOverloads40.errors.txt index f053c7c6208bb..102b5845eba74 100644 --- a/tests/baselines/reference/functionOverloads40.errors.txt +++ b/tests/baselines/reference/functionOverloads40.errors.txt @@ -1,4 +1,8 @@ -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 TS2769: No overload matches this call. + Overload 1 of 2, '(bar: { a: number; }[]): string', gave the following error. + Type 'string' is not assignable to type 'number'. + Overload 2 of 2, '(bar: { a: boolean; }[]): number', gave the following error. + Type 'string' is not assignable to type 'boolean'. ==== tests/cases/compiler/functionOverloads40.ts (1 errors) ==== @@ -6,7 +10,12 @@ 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'. + ~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(bar: { a: number; }[]): string', gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! error TS2769: Overload 2 of 2, '(bar: { a: boolean; }[]): number', gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 tests/cases/compiler/functionOverloads40.ts:1:19: The expected type comes from property 'a' which is declared here on type '{ a: number; }' !!! related TS6500 tests/cases/compiler/functionOverloads40.ts:2:19: The expected type comes from property 'a' which is declared here on type '{ a: boolean; }' \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads41.errors.txt b/tests/baselines/reference/functionOverloads41.errors.txt index a09e6e14769c4..59521a6568199 100644 --- a/tests/baselines/reference/functionOverloads41.errors.txt +++ b/tests/baselines/reference/functionOverloads41.errors.txt @@ -1,4 +1,8 @@ -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 TS2769: No overload matches this call. + Overload 1 of 2, '(bar: { a: number; }[]): string', gave the following error. + Property 'a' is missing in type '{}' but required in type '{ a: number; }'. + Overload 2 of 2, '(bar: { a: boolean; }[]): number', gave the following error. + Property 'a' is missing in type '{}' but required in type '{ a: boolean; }'. ==== tests/cases/compiler/functionOverloads41.ts (1 errors) ==== @@ -6,7 +10,12 @@ 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; }'. + ~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(bar: { a: number; }[]): string', gave the following error. +!!! error TS2769: Property 'a' is missing in type '{}' but required in type '{ a: number; }'. +!!! error TS2769: Overload 2 of 2, '(bar: { a: boolean; }[]): number', gave the following error. +!!! error TS2769: Property 'a' is missing in type '{}' but required in type '{ a: boolean; }'. +!!! related TS2728 tests/cases/compiler/functionOverloads41.ts:1:19: 'a' is declared here. !!! related TS2728 tests/cases/compiler/functionOverloads41.ts:2:19: 'a' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt b/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt index 9f728e554a364..7f9315e3b133e 100644 --- a/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt +++ b/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt @@ -1,15 +1,33 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(23,38): error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. Type 'Promise' is not assignable to type 'Promise'. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(52,38): error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. - Type 'Promise' is not assignable to type 'Promise'. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(68,38): error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. - Type 'Promise' is not assignable to type 'Promise'. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(84,38): error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. - Type 'Promise' is not assignable to type 'Promise'. - Type 'number' is not assignable to type 'boolean'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(52,22): error TS2769: No overload matches this call. + Overload 1 of 2, '(cb: (x: number) => Promise): Promise', gave the following error. + Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'string'. + Overload 2 of 2, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. + Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(68,22): error TS2769: No overload matches this call. + Overload 1 of 3, '(cb: (x: number) => Promise): Promise', gave the following error. + Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'string'. + Overload 2 of 3, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. + Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. + Overload 3 of 3, '(cb: (x: number) => Promise, error?: (error: any) => string, progress?: (preservation: any) => void): Promise', gave the following error. + Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(84,22): error TS2769: No overload matches this call. + Overload 1 of 2, '(cb: (x: number) => Promise): Promise', gave the following error. + Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'boolean'. + Overload 2 of 2, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. + Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts (4 errors) ==== @@ -69,10 +87,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl var numPromise: Promise; var newPromise = numPromise.then(testFunction); - ~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. -!!! error TS2345: Type 'Promise' is not assignable to type 'Promise'. -!!! error TS2345: Type 'number' is not assignable to type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(cb: (x: number) => Promise): Promise', gave the following error. +!!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Overload 2 of 2, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. +!!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. } ////////////////////////////////////// @@ -89,10 +112,18 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl var numPromise: Promise; var newPromise = numPromise.then(testFunction); - ~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. -!!! error TS2345: Type 'Promise' is not assignable to type 'Promise'. -!!! error TS2345: Type 'number' is not assignable to type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(cb: (x: number) => Promise): Promise', gave the following error. +!!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Overload 2 of 3, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. +!!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2769: Overload 3 of 3, '(cb: (x: number) => Promise, error?: (error: any) => string, progress?: (preservation: any) => void): Promise', gave the following error. +!!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. } ////////////////////////////////////// @@ -109,9 +140,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl var numPromise: Promise; var newPromise = numPromise.then(testFunction); - ~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. -!!! error TS2345: Type 'Promise' is not assignable to type 'Promise'. -!!! error TS2345: Type 'number' is not assignable to type 'boolean'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(cb: (x: number) => Promise): Promise', gave the following error. +!!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2769: Type 'number' is not assignable to type 'boolean'. +!!! error TS2769: Overload 2 of 2, '(cb: (x: number) => Promise, error?: (error: any) => Promise): Promise', gave the following error. +!!! error TS2769: Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. } \ No newline at end of file diff --git a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt index 60228b956f972..baee91c067fda 100644 --- a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt +++ b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt @@ -1,9 +1,9 @@ -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 TS2769: No overload matches this call. + Overload 1 of 2, '(arg1: number[]): any', gave the following error. + Type 'string' is not assignable to type 'number'. -==== tests/cases/compiler/heterogeneousArrayAndOverloads.ts (3 errors) ==== +==== tests/cases/compiler/heterogeneousArrayAndOverloads.ts (1 errors) ==== class arrTest { test(arg1: number[]); test(arg1: string[]); @@ -13,11 +13,9 @@ 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 TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(arg1: number[]): any', gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'number'. } } \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleTypes.errors.txt b/tests/baselines/reference/incompatibleTypes.errors.txt index 3da9adcd2b77b..ea4b10d668642 100644 --- a/tests/baselines/reference/incompatibleTypes.errors.txt +++ b/tests/baselines/reference/incompatibleTypes.errors.txt @@ -9,12 +9,24 @@ tests/cases/compiler/incompatibleTypes.ts(26,12): error TS2416: Property 'p1' in Type 'number' is not assignable to type 'string'. tests/cases/compiler/incompatibleTypes.ts(34,12): error TS2416: Property 'p1' in type 'C4' is not assignable to the same property in base type 'IFoo4'. Type '{ c: { b: string; }; d: string; }' is missing the following properties from type '{ a: { a: string; }; b: string; }': a, b -tests/cases/compiler/incompatibleTypes.ts(42,5): error TS2345: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. - Types of property 'p1' are incompatible. - Type '() => string' is not assignable to type '(s: string) => number'. - Type 'string' is not assignable to type 'number'. -tests/cases/compiler/incompatibleTypes.ts(49,7): error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. - Object literal may only specify known properties, and 'e' does not exist in type '{ c: { b: string; }; d: string; }'. +tests/cases/compiler/incompatibleTypes.ts(42,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(i: IFoo1): void', gave the following error. + Argument of type 'C1' is not assignable to parameter of type 'IFoo1'. + Types of property 'p1' are incompatible. + Type '() => string' is not assignable to type '() => number'. + Type 'string' is not assignable to type 'number'. + Overload 2 of 2, '(i: IFoo2): void', gave the following error. + Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. + Types of property 'p1' are incompatible. + Type '() => string' is not assignable to type '(s: string) => number'. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/incompatibleTypes.ts(49,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(n: { a: { a: string; }; b: string; }): number', gave the following error. + Argument of type '{ e: number; f: number; }' is not assignable to parameter of 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; }'. + Overload 2 of 2, '(s: { c: { b: string; }; d: string; }): string', gave the following error. + Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. + 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'. @@ -79,11 +91,18 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => var c1: C1; var c2: C2; if1(c1); - ~~ -!!! error TS2345: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. -!!! error TS2345: Types of property 'p1' are incompatible. -!!! error TS2345: Type '() => string' is not assignable to type '(s: string) => number'. -!!! error TS2345: Type 'string' is not assignable to type 'number'. + ~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(i: IFoo1): void', gave the following error. +!!! error TS2769: Argument of type 'C1' is not assignable to parameter of type 'IFoo1'. +!!! error TS2769: Types of property 'p1' are incompatible. +!!! error TS2769: Type '() => string' is not assignable to type '() => number'. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! error TS2769: Overload 2 of 2, '(i: IFoo2): void', gave the following error. +!!! error TS2769: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. +!!! error TS2769: Types of property 'p1' are incompatible. +!!! error TS2769: Type '() => string' is not assignable to type '(s: string) => number'. +!!! error TS2769: Type 'string' is not assignable to type 'number'. function of1(n: { a: { a: string; }; b: string; }): number; @@ -91,9 +110,14 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => function of1(a: any) { return null; } of1({ e: 0, f: 0 }); - ~~~~ -!!! error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. -!!! error TS2345: Object literal may only specify known properties, and 'e' does not exist in type '{ c: { b: string; }; d: string; }'. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(n: { a: { a: string; }; b: string; }): number', gave the following error. +!!! error TS2769: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ a: { a: string; }; b: string; }'. +!!! error TS2769: Object literal may only specify known properties, and 'e' does not exist in type '{ a: { a: string; }; b: string; }'. +!!! error TS2769: Overload 2 of 2, '(s: { c: { b: string; }; d: string; }): string', gave the following error. +!!! error TS2769: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. +!!! error TS2769: Object literal may only specify known properties, and 'e' does not exist in type '{ c: { b: string; }; d: string; }'. interface IMap { [key:string]:string; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt b/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt index 9249e9512bc82..50b07517ffe92 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.errors.txt @@ -1,6 +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(33,17): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. -tests/cases/compiler/inheritedConstructorWithRestParams2.ts(34,17): error TS2345: Argument of type '3' 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'. + 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'. +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'. + 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'. ==== tests/cases/compiler/inheritedConstructorWithRestParams2.ts (3 errors) ==== @@ -39,8 +47,16 @@ tests/cases/compiler/inheritedConstructorWithRestParams2.ts(34,17): error TS2345 ~ !!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. new Derived("", 3, "", 3); - ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. new Derived("", 3, "", ""); - ~ -!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. \ No newline at end of file + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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 diff --git a/tests/baselines/reference/iterableArrayPattern28.errors.txt b/tests/baselines/reference/iterableArrayPattern28.errors.txt index f90bba07c1a19..7a1ff6cf42cb5 100644 --- a/tests/baselines/reference/iterableArrayPattern28.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern28.errors.txt @@ -1,8 +1,40 @@ -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 TS2769: No overload matches this call. + 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 '(...args: [] | [undefined]) => IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. + Type 'IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult'. + 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'. + Overload 2 of 3, '(entries?: readonly (readonly [string, number])[]): Map', gave the following error. + Type 'true' is not assignable to type 'number'. ==== 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 TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(iterable: Iterable): Map', gave the following error. +!!! error TS2769: Argument of type '([string, number] | [string, boolean])[]' is not assignable to parameter of type 'Iterable'. +!!! error TS2769: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2769: Type '() => IterableIterator<[string, number] | [string, boolean]>' is not assignable to type '() => Iterator'. +!!! error TS2769: Type 'IterableIterator<[string, number] | [string, boolean]>' is not assignable to type 'Iterator'. +!!! error TS2769: Types of property 'next' are incompatible. +!!! error TS2769: Type '(...args: [] | [undefined]) => IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult'. +!!! error TS2769: Type 'IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult'. +!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult'. +!!! error TS2769: Type '[string, number] | [string, boolean]' is not assignable to type 'readonly [string, number]'. +!!! error TS2769: Type '[string, boolean]' is not assignable to type 'readonly [string, number]'. +!!! 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 diff --git a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt index 4f547c59ed045..fdc017db30687 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt @@ -1,9 +1,13 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray'. - Type 'symbol[]' is not assignable to type 'ConcatArray'. - Types of property 'slice' are incompatible. - Type '(start?: number, end?: number) => symbol[]' is not assignable to type '(start?: number, end?: number) => number[]'. - Type 'symbol[]' is not assignable to type 'number[]'. - Type 'symbol' is not assignable to type 'number'. +tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(...items: ConcatArray[]): number[]', gave the following error. + Argument of type 'symbol[]' is not assignable to parameter of type 'ConcatArray'. + Types of property 'slice' are incompatible. + Type '(start?: number, end?: number) => symbol[]' is not assignable to type '(start?: number, end?: number) => number[]'. + Type 'symbol[]' is not assignable to type 'number[]'. + Type 'symbol' is not assignable to type 'number'. + Overload 2 of 2, '(...items: (number | ConcatArray)[]): number[]', gave the following error. + Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray'. + Type 'symbol[]' is not assignable to type 'ConcatArray'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts (1 errors) ==== @@ -22,10 +26,14 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS234 var array: number[] = [0, 1]; array.concat([...new SymbolIterator]); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray'. -!!! error TS2345: Type 'symbol[]' is not assignable to type 'ConcatArray'. -!!! error TS2345: Types of property 'slice' are incompatible. -!!! error TS2345: Type '(start?: number, end?: number) => symbol[]' is not assignable to type '(start?: number, end?: number) => number[]'. -!!! error TS2345: Type 'symbol[]' is not assignable to type 'number[]'. -!!! error TS2345: Type 'symbol' is not assignable to type 'number'. \ No newline at end of file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(...items: ConcatArray[]): number[]', gave the following error. +!!! error TS2769: Argument of type 'symbol[]' is not assignable to parameter of type 'ConcatArray'. +!!! error TS2769: Types of property 'slice' are incompatible. +!!! error TS2769: Type '(start?: number, end?: number) => symbol[]' is not assignable to type '(start?: number, end?: number) => number[]'. +!!! error TS2769: Type 'symbol[]' is not assignable to type 'number[]'. +!!! error TS2769: Type 'symbol' is not assignable to type 'number'. +!!! error TS2769: Overload 2 of 2, '(...items: (number | ConcatArray)[]): number[]', gave the following error. +!!! error TS2769: Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray'. +!!! error TS2769: Type 'symbol[]' is not assignable to type 'ConcatArray'. \ No newline at end of file diff --git a/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt b/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt index fc8d68f1af8ee..d158266a62814 100644 --- a/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt +++ b/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt @@ -1,8 +1,18 @@ -tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(19,5): error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. - Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. +tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(19,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(x: { s: string; }): string', gave the following error. + Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ s: string; }'. + Object literal may only specify known properties, and 'n' does not exist in type '{ s: string; }'. + Overload 2 of 2, '(x: { n: number; }): number', gave the following error. + Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. + Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'. -tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(24,5): error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. - Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. +tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(24,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(x: { s: string; }): string', gave the following error. + Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ s: string; }'. + Object literal may only specify known properties, and 'n' does not exist in type '{ s: string; }'. + Overload 2 of 2, '(x: { n: number; }): number', gave the following error. + Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. + Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. ==== tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts (3 errors) ==== @@ -25,9 +35,14 @@ tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(24,5): error TS234 var v: B; v({ s: "", n: 0 }).toLowerCase(); - ~~~~~ -!!! error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. -!!! error TS2345: Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. + ~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(x: { s: string; }): string', gave the following error. +!!! error TS2769: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ s: string; }'. +!!! error TS2769: Object literal may only specify known properties, and 'n' does not exist in type '{ s: string; }'. +!!! error TS2769: Overload 2 of 2, '(x: { n: number; }): number', gave the following error. +!!! error TS2769: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. +!!! error TS2769: Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. var w: A; var w: C; @@ -36,6 +51,11 @@ tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(24,5): error TS234 !!! related TS6203 tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts:21:5: 'w' was also declared here. w({ s: "", n: 0 }).toLowerCase(); - ~~~~~ -!!! error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. -!!! error TS2345: Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. \ No newline at end of file + ~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(x: { s: string; }): string', gave the following error. +!!! error TS2769: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ s: string; }'. +!!! error TS2769: Object literal may only specify known properties, and 'n' does not exist in type '{ s: string; }'. +!!! error TS2769: Overload 2 of 2, '(x: { n: number; }): number', gave the following error. +!!! error TS2769: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. +!!! error TS2769: Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/overload1.errors.txt b/tests/baselines/reference/overload1.errors.txt index 6133f4223119a..0eec1066dc5ab 100644 --- a/tests/baselines/reference/overload1.errors.txt +++ b/tests/baselines/reference/overload1.errors.txt @@ -3,7 +3,11 @@ tests/cases/compiler/overload1.ts(29,1): error TS2322: Type 'number' is not assi tests/cases/compiler/overload1.ts(31,11): error TS2554: Expected 1-2 arguments, but got 3. tests/cases/compiler/overload1.ts(32,5): error TS2554: Expected 1-2 arguments, but got 0. tests/cases/compiler/overload1.ts(33,1): error TS2322: Type 'C' is not assignable to type 'string'. -tests/cases/compiler/overload1.ts(34,9): error TS2345: Argument of type '2' is not assignable to parameter of 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'. + 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'. ==== tests/cases/compiler/overload1.ts (6 errors) ==== @@ -52,8 +56,12 @@ tests/cases/compiler/overload1.ts(34,9): error TS2345: Argument of type '2' is n ~ !!! error TS2322: Type 'C' is not assignable to type 'string'. z=x.h(2,2); // no match - ~ -!!! error TS2345: Argument of type '2' is not assignable to parameter of type 'string'. + ~~~~~~~~ +!!! 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: 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'. z=x.h("hello",0); // good var v=x.g; diff --git a/tests/baselines/reference/overloadResolution.errors.txt b/tests/baselines/reference/overloadResolution.errors.txt index fde241d62cc51..10b81d5870033 100644 --- a/tests/baselines/reference/overloadResolution.errors.txt +++ b/tests/baselines/reference/overloadResolution.errors.txt @@ -1,11 +1,23 @@ -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(27,5): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(27,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(s: string): string', gave the following error. + 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(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(81,5): error TS2344: Type 'boolean' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(84,5): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(85,11): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(84,1): 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'. + 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'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(85,1): 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'. + 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'. 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'. @@ -38,8 +50,12 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): // No candidate overloads found fn1({}); // Error - ~~ -!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. + ~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(s: string): string', gave the following error. +!!! error TS2769: Argument of type '{}' is not assignable to parameter of type 'string'. +!!! error TS2769: Overload 2 of 2, '(s: number): number', gave the following error. +!!! error TS2769: Argument of type '{}' is not assignable to parameter of type 'number'. // Generic and non - generic overload where generic overload is the only candidate when called with type arguments function fn2(s: string, n: number): number; @@ -107,11 +123,19 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4(true, null); // Error - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. + ~~~~~~~~~~~~~~~ +!!! 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: 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'. fn4(null, true); // Error - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~ +!!! 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: 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'. // 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 cfbc26055597b..f3028cf08b52c 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionClassConstructors.errors.txt @@ -1,4 +1,8 @@ -tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(27,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstructors.ts(27,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(s: string): fn1', gave the following error. + Argument of type '{}' is not assignable to parameter of type 'string'. + Overload 2 of 2, '(s: number): fn1', gave the following error. + Argument of type '{}' is not assignable to parameter of type 'number'. 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. @@ -42,8 +46,12 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionClassConstru // No candidate overloads found new fn1({}); // Error - ~~ -!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. + ~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(s: string): fn1', gave the following error. +!!! error TS2769: Argument of type '{}' is not assignable to parameter of type 'string'. +!!! error TS2769: Overload 2 of 2, '(s: number): fn1', gave the following error. +!!! error TS2769: Argument of type '{}' is not assignable to parameter of type 'number'. // Generic and non - generic overload where generic overload is the only candidate when called with type arguments class fn2 { diff --git a/tests/baselines/reference/overloadResolutionConstructors.errors.txt b/tests/baselines/reference/overloadResolutionConstructors.errors.txt index 40b660c7eafab..b62a78a88b25a 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionConstructors.errors.txt @@ -1,11 +1,23 @@ -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(27,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(27,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(s: string): string', gave the following error. + 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(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(88,9): error TS2344: Type 'boolean' does not satisfy the constraint 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(91,9): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(92,15): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(91,1): 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'. + 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'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(92,1): 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'. + 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'. 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'. @@ -38,8 +50,12 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors // No candidate overloads found new fn1({}); // Error - ~~ -!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. + ~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(s: string): string', gave the following error. +!!! error TS2769: Argument of type '{}' is not assignable to parameter of type 'string'. +!!! error TS2769: Overload 2 of 2, '(s: number): number', gave the following error. +!!! error TS2769: Argument of type '{}' is not assignable to parameter of type 'number'. // Generic and non - generic overload where generic overload is the only candidate when called with type arguments interface fn2 { @@ -114,11 +130,19 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors // 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 'number'. + ~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. new fn4(null, true); // Error - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. // 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 008ee13127c5a..9e4023423df0b 100644 --- a/tests/baselines/reference/overloadResolutionTest1.errors.txt +++ b/tests/baselines/reference/overloadResolutionTest1.errors.txt @@ -1,6 +1,18 @@ -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 TS2769: No overload matches this call. + Overload 1 of 2, '(bar: { a: number; }[]): string', gave the following error. + Type 'string' is not assignable to type 'number'. + Overload 2 of 2, '(bar: { a: boolean; }[]): number', gave the following error. + Type 'string' is not assignable to type 'boolean'. +tests/cases/compiler/overloadResolutionTest1.ts(18,10): error TS2769: No overload matches this call. + Overload 1 of 2, '(bar: { a: number; }): string', gave the following error. + Type 'string' is not assignable to type 'number'. + Overload 2 of 2, '(bar: { a: boolean; }): number', gave the following error. + Type 'string' is not assignable to type 'boolean'. +tests/cases/compiler/overloadResolutionTest1.ts(24,9): 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'. + Overload 2 of 2, '(bar: { a: string; }): string', gave the following error. + Type 'true' is not assignable to type 'string'. ==== tests/cases/compiler/overloadResolutionTest1.ts (3 errors) ==== @@ -11,8 +23,13 @@ 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'. + ~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(bar: { a: number; }[]): string', gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! error TS2769: Overload 2 of 2, '(bar: { a: boolean; }[]): number', gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 tests/cases/compiler/overloadResolutionTest1.ts:1:19: The expected type comes from property 'a' which is declared here on type '{ a: number; }' !!! related TS6500 tests/cases/compiler/overloadResolutionTest1.ts:2:19: The expected type comes from property 'a' which is declared here on type '{ a: 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,8 +42,13 @@ 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'. + ~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(bar: { a: number; }): string', gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! error TS2769: Overload 2 of 2, '(bar: { a: boolean; }): number', gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'boolean'. +!!! related TS6500 tests/cases/compiler/overloadResolutionTest1.ts:12:20: The expected type comes from property 'a' which is declared here on type '{ a: number; }' !!! related TS6500 tests/cases/compiler/overloadResolutionTest1.ts:13:20: The expected type comes from property 'a' which is declared here on type '{ a: boolean; }' @@ -34,6 +56,11 @@ tests/cases/compiler/overloadResolutionTest1.ts(24,15): error TS2322: Type 'true 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'. + ~~~~~~~~~~~~~~ +!!! 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: Overload 2 of 2, '(bar: { a: string; }): string', gave the following error. +!!! error TS2769: Type 'true' 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/overloadingOnConstants2.errors.txt b/tests/baselines/reference/overloadingOnConstants2.errors.txt index c12d77714a31e..ff5c8883c5213 100644 --- a/tests/baselines/reference/overloadingOnConstants2.errors.txt +++ b/tests/baselines/reference/overloadingOnConstants2.errors.txt @@ -1,5 +1,9 @@ tests/cases/compiler/overloadingOnConstants2.ts(9,10): error TS2394: This overload signature is not compatible with its implementation signature. -tests/cases/compiler/overloadingOnConstants2.ts(15,13): error TS2345: Argument of type '"um"' is not assignable to parameter of type '"bye"'. +tests/cases/compiler/overloadingOnConstants2.ts(15,9): error TS2769: No overload matches this call. + Overload 1 of 2, '(x: "hi", items: string[]): D', gave the following error. + Argument of type '"um"' is not assignable to parameter of type '"hi"'. + Overload 2 of 2, '(x: "bye", items: string[]): E', gave the following error. + Argument of type '"um"' is not assignable to parameter of type '"bye"'. tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2394: This overload signature is not compatible with its implementation signature. @@ -22,8 +26,12 @@ tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2394: This overl var a: D = foo("hi", []); // D var b: E = foo("bye", []); // E var c = foo("um", []); // error - ~~~~ -!!! error TS2345: Argument of type '"um"' is not assignable to parameter of type '"bye"'. + ~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(x: "hi", items: string[]): D', gave the following error. +!!! error TS2769: Argument of type '"um"' is not assignable to parameter of type '"hi"'. +!!! error TS2769: Overload 2 of 2, '(x: "bye", items: string[]): E', gave the following error. +!!! error TS2769: Argument of type '"um"' is not assignable to parameter of type '"bye"'. //function bar(x: "hi", items: string[]): D; diff --git a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt index 24476ecafd272..70f40199d4a57 100644 --- a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt +++ b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt @@ -3,9 +3,18 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,37): Property 'x' is missing in type 'D' but required in type 'A'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,38): error TS2344: Type 'D' does not satisfy the constraint 'A'. -tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(18,27): error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. - Types of parameters 'x' and 'x' are incompatible. - Property 'q' is missing in type 'B' but required in type 'D'. +tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(18,23): error TS2769: No overload matches this call. + Overload 1 of 3, '(arg: (x: D) => number): string', gave the following error. + Argument of type '(x: D) => G' is not assignable to parameter of type '(x: D) => number'. + Type 'G' is not assignable to type 'number'. + Overload 2 of 3, '(arg: (x: C) => any): string', gave the following error. + Argument of type '(x: D) => G' is not assignable to parameter of type '(x: C) => any'. + Types of parameters 'x' and 'x' are incompatible. + Property 'q' is missing in type 'C' but required in type 'D'. + Overload 3 of 3, '(arg: (x: B) => any): number', gave the following error. + Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. + Types of parameters 'x' and 'x' are incompatible. + Property 'q' is missing in type 'B' but required in type 'D'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,14): error TS2344: Type 'D' does not satisfy the constraint 'A'. @@ -38,14 +47,27 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,14): !!! error TS2344: Type 'D' does not satisfy the constraint 'A'. var result3: string = foo(x => { // x has type D - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. -!!! error TS2345: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2345: Property 'q' is missing in type 'B' but required in type 'D'. -!!! related TS2728 tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts:4:15: 'q' is declared here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ var y: G; // error that D does not satisfy constraint, y is of type G, entire call to foo is an error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ !!! error TS2344: Type 'D' does not satisfy the constraint 'A'. return y; + ~~~~~~~~~~~~~ }); + ~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(arg: (x: D) => number): string', gave the following error. +!!! error TS2769: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: D) => number'. +!!! error TS2769: Type 'G' is not assignable to type 'number'. +!!! error TS2769: Overload 2 of 3, '(arg: (x: C) => any): string', gave the following error. +!!! error TS2769: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: C) => any'. +!!! error TS2769: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2769: Property 'q' is missing in type 'C' but required in type 'D'. +!!! error TS2769: Overload 3 of 3, '(arg: (x: B) => any): number', gave the following error. +!!! error TS2769: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. +!!! error TS2769: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2769: Property 'q' is missing in type 'B' but required in type 'D'. +!!! related TS2728 tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts:4:15: 'q' is declared here. +!!! related TS2728 tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts:4:15: 'q' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt b/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt index 3db9a29053f54..77da1c87fd1df 100644 --- a/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt +++ b/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt @@ -1,6 +1,14 @@ -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 TS2769: No overload matches this call. + Overload 1 of 2, '(s: string): number', gave the following error. + Argument of type '(s: string) => {}' is not assignable to parameter of type 'string'. + 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 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 TS2769: No overload matches this call. + 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'. + 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; }'. tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cannot find name 'blah'. @@ -11,15 +19,23 @@ 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 + ~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(s: string): number', gave the following error. +!!! error TS2769: Argument of type '(s: string) => {}' is not assignable to parameter of type 'string'. +!!! error TS2769: Overload 2 of 2, '(lambda: (s: string) => { a: number; b: number; }): string', gave the following error. +!!! error TS2769: 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. 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; }'. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(s: string): number', gave the following error. +!!! error TS2769: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type 'string'. +!!! error TS2769: Overload 2 of 2, '(lambda: (s: string) => { a: number; b: number; }): string', gave the following error. +!!! error TS2769: 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. ~~~~ diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index c719d8a9b951e..1cb61562fe328 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -1,67 +1,133 @@ -tests/cases/compiler/promisePermutations.ts(74,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. - Types of parameters 'x' and 'value' are incompatible. - Type 'IPromise' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations.ts(79,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. - Types of parameters 'x' and 'value' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. - Types of parameters 'x' and 'value' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. - Types of parameters 'x' and 'value' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations.ts(84,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. - Types of parameters 'x' and 'value' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations.ts(88,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations.ts(92,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. -tests/cases/compiler/promisePermutations.ts(93,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations.ts(97,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations.ts(100,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations.ts(101,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. -tests/cases/compiler/promisePermutations.ts(102,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations.ts(106,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. - Types of parameters 'cb' and 'value' are incompatible. - Type 'string' is not assignable to type '(a: T) => T'. -tests/cases/compiler/promisePermutations.ts(109,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations.ts(110,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. - Types of parameters 'cb' and 'value' are incompatible. - Type 'string' is not assignable to type '(a: T) => T'. -tests/cases/compiler/promisePermutations.ts(111,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. - Types of parameters 'cb' and 'value' are incompatible. - Type 'string' is not assignable to type '(a: T) => T'. -tests/cases/compiler/promisePermutations.ts(117,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations.ts(121,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. -tests/cases/compiler/promisePermutations.ts(122,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations.ts(126,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations.ts(129,33): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. - Type 'IPromise' is not assignable to type 'IPromise'. - Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations.ts(132,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations.ts(133,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. -tests/cases/compiler/promisePermutations.ts(134,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations.ts(137,33): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. - Type 'IPromise' is not assignable to type 'IPromise'. -tests/cases/compiler/promisePermutations.ts(144,35): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. -tests/cases/compiler/promisePermutations.ts(152,36): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. - Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -tests/cases/compiler/promisePermutations.ts(156,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. - Type 'IPromise' is not assignable to type 'IPromise'. - Type 'number' is not assignable to type 'string'. -tests/cases/compiler/promisePermutations.ts(158,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. - Type 'IPromise' is not assignable to type 'IPromise'. -tests/cases/compiler/promisePermutations.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. - Type 'Promise' is not assignable to type 'Promise'. - Type 'number' is not assignable to type 'string'. -tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. - Type 'Promise' is not assignable to type 'IPromise'. - Types of property 'then' are incompatible. - Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. - Types of parameters 'onfulfilled' and 'success' are incompatible. - Types of parameters 'value' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/compiler/promisePermutations.ts(74,70): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'IPromise' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations.ts(79,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations.ts(82,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations.ts(83,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations.ts(84,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations.ts(88,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations.ts(91,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations.ts(92,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +tests/cases/compiler/promisePermutations.ts(93,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations.ts(97,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations.ts(100,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations.ts(101,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +tests/cases/compiler/promisePermutations.ts(102,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations.ts(106,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'cb' and 'value' are incompatible. + Type 'string' is not assignable to type '(a: T) => T'. +tests/cases/compiler/promisePermutations.ts(109,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations.ts(110,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. + Types of parameters 'cb' and 'value' are incompatible. + Type 'string' is not assignable to type '(a: T) => T'. +tests/cases/compiler/promisePermutations.ts(111,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'cb' and 'value' are incompatible. + Type 'string' is not assignable to type '(a: T) => T'. +tests/cases/compiler/promisePermutations.ts(117,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations.ts(120,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations.ts(121,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +tests/cases/compiler/promisePermutations.ts(122,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations.ts(126,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations.ts(129,33): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations.ts(132,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations.ts(133,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +tests/cases/compiler/promisePermutations.ts(134,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations.ts(137,33): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. +tests/cases/compiler/promisePermutations.ts(144,35): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +tests/cases/compiler/promisePermutations.ts(152,36): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. + Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. +tests/cases/compiler/promisePermutations.ts(156,21): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/promisePermutations.ts(158,21): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. +tests/cases/compiler/promisePermutations.ts(159,21): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. + Type 'Promise' is not assignable to type 'IPromise'. + Types of property 'then' are incompatible. + Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. + Types of parameters 'onfulfilled' and 'success' are incompatible. + Types of parameters 'value' and 'value' are incompatible. + Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/promisePermutations.ts (33 errors) ==== @@ -140,92 +206,143 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var s3c = s3.then(testFunction3P, testFunction3, testFunction3); var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. -!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'IPromise' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. +!!! error TS2769: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2769: Type 'IPromise' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var r4: IPromise; var sIPromise: (x: any) => IPromise; var sPromise: (x: any) => Promise; var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok var s4: Promise; var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. -!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. -!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4); var r5: IPromise; var r5a = r5.then(testFunction5, testFunction5, testFunction5); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r5b = r5.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s5: Promise; var s5a = s5.then(testFunction5, testFunction5, testFunction5); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s5b = s5.then(testFunction5P, testFunction5P, testFunction5P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s5c = s5.then(testFunction5P, testFunction5, testFunction5); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s5d = s5.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok var r6: IPromise; var r6a = r6.then(testFunction6, testFunction6, testFunction6); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r6b = r6.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s6: Promise; var s6a = s6.then(testFunction6, testFunction6, testFunction6); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s6b = s6.then(testFunction6P, testFunction6P, testFunction6P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s6c = s6.then(testFunction6P, testFunction6, testFunction6); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s6d = s6.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok var r7: IPromise; var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'cb' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type '(a: T) => T'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s7: Promise; var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. -!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: Types of parameters 'cb' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type '(a: T) => T'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. -!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'cb' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type '(a: T) => T'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok? var r8: IPromise; @@ -233,48 +350,78 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var nPromise: (x: any) => Promise; var r8a = r8.then(testFunction8, testFunction8, testFunction8); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r8b = r8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok var s8: Promise; var s8a = s8.then(testFunction8, testFunction8, testFunction8); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s8b = s8.then(testFunction8P, testFunction8P, testFunction8P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s8c = s8.then(testFunction8P, testFunction8, testFunction8); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s8d = s8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok var r9: IPromise; var r9a = r9.then(testFunction9, testFunction9, testFunction9); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok var r9d = r9.then(testFunction, sIPromise, nIPromise); // ok ~~~~~~~~~ -!!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s9: Promise; var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s9b = s9.then(testFunction9P, testFunction9P, testFunction9P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s9c = s9.then(testFunction9P, testFunction9, testFunction9); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s9d = s9.then(sPromise, sPromise, sPromise); // ok var s9e = s9.then(nPromise, nPromise, nPromise); // ok var s9f = s9.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~~~ -!!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -283,7 +430,10 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // ok ~~~~~~~~~ -!!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s10 = testFunction10P(x => x); var s10a = s10.then(testFunction10, testFunction10, testFunction10); // ok @@ -293,36 +443,51 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error ~~~~~~~~~ -!!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. -!!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. +!!! error TS2769: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. !!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; var r11a = r11.then(testFunction11, testFunction11, testFunction11); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var s11: Promise; var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // error ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. -!!! error TS2345: Type 'Promise' is not assignable to type 'Promise'. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // error ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. -!!! error TS2345: Type 'Promise' is not assignable to type 'IPromise'. -!!! error TS2345: Types of property 'then' are incompatible. -!!! error TS2345: Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. -!!! error TS2345: Types of parameters 'onfulfilled' and 'success' are incompatible. -!!! error TS2345: Types of parameters 'value' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'IPromise'. +!!! error TS2769: Types of property 'then' are incompatible. +!!! error TS2769: Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. +!!! error TS2769: Types of parameters 'onfulfilled' and 'success' are incompatible. +!!! error TS2769: Types of parameters 'value' and 'value' are incompatible. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var r12 = testFunction12(x => x); var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index b88ef28ca5c51..d601a5049bf59 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -1,9 +1,11 @@ tests/cases/compiler/promisePermutations2.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. Types of parameters 'x' and 'value' are incompatible. Type 'IPromise' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations2.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. - Types of parameters 'x' and 'value' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations2.ts(78,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(81,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. Type 'string' is not assignable to type 'number'. @@ -13,43 +15,65 @@ tests/cases/compiler/promisePermutations2.ts(82,19): error TS2345: Argument of t tests/cases/compiler/promisePermutations2.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations2.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations2.ts(87,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. tests/cases/compiler/promisePermutations2.ts(92,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations2.ts(96,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations2.ts(96,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(99,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(100,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. tests/cases/compiler/promisePermutations2.ts(101,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations2.ts(105,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. - Types of parameters 'cb' and 'value' are incompatible. - Type 'string' is not assignable to type '(a: T) => T'. -tests/cases/compiler/promisePermutations2.ts(108,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations2.ts(109,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. - Types of parameters 'cb' and 'value' are incompatible. - Type 'string' is not assignable to type '(a: T) => T'. -tests/cases/compiler/promisePermutations2.ts(110,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. - Types of parameters 'cb' and 'value' are incompatible. - Type 'string' is not assignable to type '(a: T) => T'. -tests/cases/compiler/promisePermutations2.ts(116,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations2.ts(105,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'cb' and 'value' are incompatible. + Type 'string' is not assignable to type '(a: T) => T'. +tests/cases/compiler/promisePermutations2.ts(108,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations2.ts(109,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. + Types of parameters 'cb' and 'value' are incompatible. + Type 'string' is not assignable to type '(a: T) => T'. +tests/cases/compiler/promisePermutations2.ts(110,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'cb' and 'value' are incompatible. + Type 'string' is not assignable to type '(a: T) => T'. +tests/cases/compiler/promisePermutations2.ts(116,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(119,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. tests/cases/compiler/promisePermutations2.ts(121,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations2.ts(125,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations2.ts(128,33): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. - Type 'IPromise' is not assignable to type 'IPromise'. - Type 'string' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations2.ts(125,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations2.ts(128,33): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(131,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(132,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. tests/cases/compiler/promisePermutations2.ts(133,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(136,33): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. -tests/cases/compiler/promisePermutations2.ts(143,35): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +tests/cases/compiler/promisePermutations2.ts(143,35): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. tests/cases/compiler/promisePermutations2.ts(151,36): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -tests/cases/compiler/promisePermutations2.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. - Type 'IPromise' is not assignable to type 'IPromise'. - Type 'number' is not assignable to type 'string'. +tests/cases/compiler/promisePermutations2.ts(155,21): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. + Type 'number' is not assignable to type 'string'. tests/cases/compiler/promisePermutations2.ts(157,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. tests/cases/compiler/promisePermutations2.ts(158,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. @@ -148,9 +172,12 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var sPromise: (x: any) => Promise; var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok var s4: Promise; var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error @@ -173,7 +200,10 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var r5: IPromise; var r5a = r5.then(testFunction5, testFunction5, testFunction5); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r5b = r5.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s5: Promise; var s5a = s5.then(testFunction5, testFunction5, testFunction5); // error @@ -190,7 +220,10 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var r6: IPromise; var r6a = r6.then(testFunction6, testFunction6, testFunction6); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r6b = r6.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s6: Promise; var s6a = s6.then(testFunction6, testFunction6, testFunction6); // error @@ -207,24 +240,36 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var r7: IPromise; var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'cb' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type '(a: T) => T'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s7: Promise; var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. -!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: Types of parameters 'cb' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type '(a: T) => T'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. -!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'cb' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type '(a: T) => T'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok? var r8: IPromise; @@ -232,7 +277,10 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var nPromise: (x: any) => Promise; var r8a = r8.then(testFunction8, testFunction8, testFunction8); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r8b = r8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok var s8: Promise; var s8a = s8.then(testFunction8, testFunction8, testFunction8); // error @@ -249,14 +297,20 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var r9: IPromise; var r9a = r9.then(testFunction9, testFunction9, testFunction9); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok var r9d = r9.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~~~ -!!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s9: Promise; var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error @@ -282,7 +336,10 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~~~ -!!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s10 = testFunction10P(x => x); var s10a = s10.then(testFunction10, testFunction10, testFunction10); // ok @@ -300,9 +357,12 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var r11: IPromise; var r11a = r11.then(testFunction11, testFunction11, testFunction11); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var s11: Promise; var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok ~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index 83a161af960d4..d3574d2a4c3f3 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -1,29 +1,49 @@ tests/cases/compiler/promisePermutations3.ts(68,69): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. Types of parameters 'x' and 'value' are incompatible. Type 'IPromise' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations3.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. - Types of parameters 'x' and 'value' are incompatible. - Type 'IPromise' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations3.ts(73,70): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'IPromise' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations3.ts(81,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. - Types of parameters 'x' and 'value' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations3.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. - Types of parameters 'x' and 'value' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations3.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. - Types of parameters 'x' and 'value' are incompatible. - Type 'string' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations3.ts(81,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations3.ts(82,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/promisePermutations3.ts(83,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Types of parameters 'x' and 'value' are incompatible. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations3.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations3.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. -tests/cases/compiler/promisePermutations3.ts(92,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations3.ts(90,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations3.ts(91,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +tests/cases/compiler/promisePermutations3.ts(92,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations3.ts(96,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations3.ts(99,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -tests/cases/compiler/promisePermutations3.ts(100,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. -tests/cases/compiler/promisePermutations3.ts(101,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations3.ts(99,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +tests/cases/compiler/promisePermutations3.ts(100,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +tests/cases/compiler/promisePermutations3.ts(101,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations3.ts(105,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. Type 'string' is not assignable to type '(a: T) => T'. @@ -35,36 +55,58 @@ tests/cases/compiler/promisePermutations3.ts(110,19): error TS2345: Argument of Types of parameters 'cb' and 'value' are incompatible. Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations3.ts(116,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations3.ts(119,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations3.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. -tests/cases/compiler/promisePermutations3.ts(121,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations3.ts(119,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations3.ts(120,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +tests/cases/compiler/promisePermutations3.ts(121,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations3.ts(125,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations3.ts(128,33): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/promisePermutations3.ts(131,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations3.ts(132,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. -tests/cases/compiler/promisePermutations3.ts(133,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. -tests/cases/compiler/promisePermutations3.ts(136,33): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. - Type 'IPromise' is not assignable to type 'IPromise'. +tests/cases/compiler/promisePermutations3.ts(131,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations3.ts(132,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +tests/cases/compiler/promisePermutations3.ts(133,19): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +tests/cases/compiler/promisePermutations3.ts(136,33): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. tests/cases/compiler/promisePermutations3.ts(143,35): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. -tests/cases/compiler/promisePermutations3.ts(151,36): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. - Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. +tests/cases/compiler/promisePermutations3.ts(151,36): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. + Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. tests/cases/compiler/promisePermutations3.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. Type 'number' is not assignable to type 'string'. -tests/cases/compiler/promisePermutations3.ts(157,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. - Type 'IPromise' is not assignable to type 'IPromise'. -tests/cases/compiler/promisePermutations3.ts(158,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. - Type 'Promise' is not assignable to type 'Promise'. - Type 'number' is not assignable to type 'string'. -tests/cases/compiler/promisePermutations3.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. - Type 'Promise' is not assignable to type 'IPromise'. - Types of property 'then' are incompatible. - Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise'. - Types of parameters 'onfulfilled' and 'success' are incompatible. - Types of parameters 'value' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. +tests/cases/compiler/promisePermutations3.ts(157,21): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. + Type 'IPromise' is not assignable to type 'IPromise'. +tests/cases/compiler/promisePermutations3.ts(158,21): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/promisePermutations3.ts(159,21): error TS2769: No overload matches this call. + The last overload gave the following error. + Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. + Type 'Promise' is not assignable to type 'IPromise'. + Types of property 'then' are incompatible. + Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise'. + Types of parameters 'onfulfilled' and 'success' are incompatible. + Types of parameters 'value' and 'value' are incompatible. + Type 'number' is not assignable to type 'string'. tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of type '{ (x: T): IPromise; (x: T, y: T): Promise; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise'. Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. @@ -148,9 +190,12 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s3c = s3.then(testFunction3P, testFunction3, testFunction3); var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3); ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. -!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'IPromise' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. +!!! error TS2769: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2769: Type 'IPromise' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var r4: IPromise; var sIPromise: (x: any) => IPromise; @@ -164,19 +209,28 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s4: Promise; var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. -!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. -!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. -!!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'string' is not assignable to type 'number'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Types of parameters 'x' and 'value' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4); var r5: IPromise; @@ -187,13 +241,22 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s5: Promise; var s5a = s5.then(testFunction5, testFunction5, testFunction5); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s5b = s5.then(testFunction5P, testFunction5P, testFunction5P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s5c = s5.then(testFunction5P, testFunction5, testFunction5); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s5d = s5.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok var r6: IPromise; @@ -204,13 +267,22 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s6: Promise; var s6a = s6.then(testFunction6, testFunction6, testFunction6); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s6b = s6.then(testFunction6P, testFunction6P, testFunction6P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s6c = s6.then(testFunction6P, testFunction6, testFunction6); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s6d = s6.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok var r7: IPromise; @@ -246,13 +318,22 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s8: Promise; var s8a = s8.then(testFunction8, testFunction8, testFunction8); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s8b = s8.then(testFunction8P, testFunction8P, testFunction8P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s8c = s8.then(testFunction8P, testFunction8, testFunction8); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s8d = s8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok var r9: IPromise; @@ -270,19 +351,31 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s9: Promise; var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error ~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s9b = s9.then(testFunction9P, testFunction9P, testFunction9P); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s9c = s9.then(testFunction9P, testFunction9, testFunction9); // error ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s9d = s9.then(sPromise, sPromise, sPromise); // ok var s9e = s9.then(nPromise, nPromise, nPromise); // ok var s9f = s9.then(testFunction, sIPromise, nIPromise); // error ~~~~~~~~~ -!!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var r10 = testFunction10(x => x); @@ -301,9 +394,12 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error ~~~~~~~~~ -!!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. -!!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. +!!! error TS2769: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. !!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; @@ -315,22 +411,31 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s11: Promise; var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. -!!! error TS2345: Type 'IPromise' is not assignable to type 'IPromise'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'IPromise'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // error ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. -!!! error TS2345: Type 'Promise' is not assignable to type 'Promise'. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // error ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. -!!! error TS2345: Type 'Promise' is not assignable to type 'IPromise'. -!!! error TS2345: Types of property 'then' are incompatible. -!!! error TS2345: Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise'. -!!! error TS2345: Types of parameters 'onfulfilled' and 'success' are incompatible. -!!! error TS2345: Types of parameters 'value' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2769: No overload matches this call. +!!! error TS2769: The last overload gave the following error. +!!! error TS2769: Argument of type '{ (x: number): Promise; (x: string): Promise; }' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Type 'Promise' is not assignable to type 'IPromise'. +!!! error TS2769: Types of property 'then' are incompatible. +!!! error TS2769: Type '{ (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise'. +!!! error TS2769: Types of parameters 'onfulfilled' and 'success' are incompatible. +!!! error TS2769: Types of parameters 'value' and 'value' are incompatible. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var r12 = testFunction12(x => x); var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok diff --git a/tests/baselines/reference/promiseTypeInference.errors.txt b/tests/baselines/reference/promiseTypeInference.errors.txt index 1996f37e5402c..d75e5045678e9 100644 --- a/tests/baselines/reference/promiseTypeInference.errors.txt +++ b/tests/baselines/reference/promiseTypeInference.errors.txt @@ -1,10 +1,14 @@ -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 TS2769: No overload matches this call. + 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'. + 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'. ==== tests/cases/compiler/promiseTypeInference.ts (1 errors) ==== @@ -18,13 +22,19 @@ 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'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(success?: (value: string) => Promise): Promise', gave the following error. +!!! error TS2769: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. +!!! error TS2769: Overload 2 of 2, '(onfulfilled?: (value: string) => number | PromiseLike, onrejected?: (reason: any) => PromiseLike): Promise', gave the following error. +!!! error TS2769: Type 'IPromise' is not assignable to type 'number | PromiseLike'. +!!! error TS2769: Type 'IPromise' is not assignable to type 'PromiseLike'. +!!! error TS2769: Types of property 'then' are incompatible. +!!! error TS2769: Type '(success?: (value: number) => IPromise) => IPromise' is not assignable to type '(onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. +!!! error TS2769: Types of parameters 'success' and 'onfulfilled' are incompatible. +!!! error TS2769: Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. +!!! error TS2769: Type 'TResult1' is not assignable to type 'IPromise'. +!!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. +!!! related TS6502 tests/cases/compiler/promiseTypeInference.ts:2:23: The expected type comes from the return type of this signature. !!! related TS6502 /.ts/lib.es5.d.ts:1406:57: The expected type comes from the return type of this signature. \ No newline at end of file diff --git a/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt b/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt index dbc1e42c572ea..ede187259de06 100644 --- a/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt +++ b/tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt @@ -1,11 +1,25 @@ -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 TS2769: No overload matches this call. + 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'. + 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'. +tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(43,22): error TS2769: No overload matches this call. + Overload 1 of 2, '(props: Readonly): FieldFeedbackBeta', gave the following error. + Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. + Type 'void' is not assignable to type 'boolean'. + Overload 2 of 2, '(props: 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'. +tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,21): error TS2769: No overload matches this call. + Overload 1 of 2, '(props: Readonly): FieldFeedback2', gave the following error. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. + Type 'void' is not assignable to type 'boolean'. + Overload 2 of 2, '(props: MyPropsProps, context?: any): FieldFeedback2', gave the following error. + Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. ==== tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx (3 errors) ==== @@ -36,10 +50,16 @@ 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'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(props: Readonly): FieldFeedback', gave the following error. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. +!!! error TS2769: Type 'void' is not assignable to type 'boolean'. +!!! error TS2769: Overload 2 of 2, '(props: Props, context?: any): FieldFeedback', gave the following error. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. +!!! 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>>' !!! 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>>' class FieldFeedbackBeta

extends React.Component

{ @@ -57,10 +77,16 @@ 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'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(props: Readonly): FieldFeedbackBeta', gave the following error. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. +!!! error TS2769: Type 'void' is not assignable to type 'boolean'. +!!! error TS2769: Overload 2 of 2, '(props: Props, context?: any): FieldFeedbackBeta', gave the following error. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. +!!! 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>' !!! 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>' interface MyPropsProps extends Props { @@ -83,9 +109,14 @@ 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'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(props: Readonly): FieldFeedback2', gave the following error. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. +!!! error TS2769: Type 'void' is not assignable to type 'boolean'. +!!! error TS2769: Overload 2 of 2, '(props: MyPropsProps, context?: any): FieldFeedback2', gave the following error. +!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'. +!!! 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>>' !!! 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>>' // OK diff --git a/tests/baselines/reference/recursiveFunctionTypes.errors.txt b/tests/baselines/reference/recursiveFunctionTypes.errors.txt index c58b98b394932..1d765d4196cde 100644 --- a/tests/baselines/reference/recursiveFunctionTypes.errors.txt +++ b/tests/baselines/reference/recursiveFunctionTypes.errors.txt @@ -11,7 +11,13 @@ tests/cases/compiler/recursiveFunctionTypes.ts(30,10): error TS2394: This overlo 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(42,8): error TS2554: Expected 0-1 arguments, but got 2. -tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of type '""' 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(43,1): 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; }'. + Overload 2 of 4, '(a: number): number', gave the following error. + Argument of type '""' 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; }'. ==== tests/cases/compiler/recursiveFunctionTypes.ts (13 errors) ==== @@ -84,6 +90,12 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of ~ !!! error TS2554: Expected 0-1 arguments, but got 2. f7(""); // ok (function takes an any param) - ~~ -!!! error TS2345: 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: 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: 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: 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; }'. f7(); // ok \ No newline at end of file diff --git a/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt b/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt index cf294de778075..49f3e624768f8 100644 --- a/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt +++ b/tests/baselines/reference/specializedSignatureAsCallbackParameter1.errors.txt @@ -1,5 +1,17 @@ -tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(7,4): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. -tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,4): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. +tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(7,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: string) => 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 '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'. +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'. ==== tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts (2 errors) ==== @@ -10,8 +22,20 @@ tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,4): error TS2 } // both are errors x3(1, (x: string) => 1); - ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(a: number, cb: (x: number) => number): any', gave the following error. +!!! error TS2769: Argument of type '(x: string) => number' is not assignable to parameter of type '(x: number) => number'. +!!! 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'. x3(1, (x: 'hm') => 1); - ~ -!!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. \ No newline at end of file + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(a: number, cb: (x: number) => number): any', gave the following error. +!!! error TS2769: Argument of type '(x: "hm") => number' is not assignable to parameter of type '(x: number) => number'. +!!! 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 diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index cfeb557468525..cd30931bcfe4a 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -1,4 +1,11 @@ -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 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'. + 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'. 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(19,44): error TS2554: Expected 3 arguments, but got 4. @@ -8,8 +15,22 @@ 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 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'. + 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'. +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'. + 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'. 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(50,38): error TS2554: Expected 3 arguments, but got 4. @@ -18,7 +39,14 @@ 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 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'. + 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'. 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(67,24): error TS2554: Expected 3 arguments, but got 4. @@ -39,8 +67,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 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: 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'. let f04 = overloaded.bind(undefined); // typeof overloaded let f05 = generic.bind(undefined); // typeof generic @@ -86,11 +121,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 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: 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'. let f14 = c.foo.bind(undefined); // Error - ~~~~~~~~~ -!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 6, '(this: (this: C, a: number, b: string) => string, thisArg: C): (a: number, b: string) => string', gave the following error. +!!! error TS2769: Argument of type 'undefined' is not assignable to parameter of type 'C'. +!!! error TS2769: Overload 2 of 6, '(this: (this: C, ...args: (string | number)[]) => string, thisArg: C, ...args: (string | number)[]): (...args: (string | number)[]) => 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: (string | number)[]) => string'. +!!! error TS2769: Types of parameters 'a' and 'args' are incompatible. +!!! error TS2769: Type 'string | number' is not assignable to type 'number'. +!!! error TS2769: 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 +176,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 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: 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'. C.call(c, 10, "hello"); C.call(c, 10); // Error diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt index 40a3321fe61a6..3e5720039abc0 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt @@ -1,11 +1,27 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(9,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(10,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(11,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(12,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(13,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(11,9): error TS2769: No overload matches this call. + Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(12,9): error TS2769: No overload matches this call. + Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(13,9): error TS2769: No overload matches this call. + Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. 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 TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,9): 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'. + 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'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,24): error TS2554: Expected 1-3 arguments, but got 4. @@ -27,14 +43,26 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. var c = foo([], 1, 2); // boolean - ~~ -!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + ~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. var d = foo([], 1, true); // boolean (with error) - ~~ -!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + ~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. var e = foo([], 1, "2"); // {} - ~~ -!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + ~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. var f = foo([], 1, 2, 3); // any (with error) ~ !!! error TS2554: Expected 1-3 arguments, but got 4. @@ -43,8 +71,12 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio var v = foo `${1}`; // string var w = foo `${1}${2}`; // boolean var x = foo `${1}${true}`; // boolean (with error) - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~ +!!! 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: 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'. 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 eb7d2f510a8c7..5cd4e6357448f 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt @@ -1,11 +1,27 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(9,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(10,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(11,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(12,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(13,13): error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(11,9): error TS2769: No overload matches this call. + Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(12,9): error TS2769: No overload matches this call. + Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(13,9): error TS2769: No overload matches this call. + Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. + Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. 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 TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(19,9): 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'. + 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'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts(21,24): error TS2554: Expected 1-3 arguments, but got 4. @@ -27,14 +43,26 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. var c = foo([], 1, 2); // boolean - ~~ -!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + ~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. var d = foo([], 1, true); // boolean (with error) - ~~ -!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + ~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. var e = foo([], 1, "2"); // {} - ~~ -!!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. + ~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 4, '(strs: TemplateStringsArray, x: number, y: number): boolean', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. +!!! error TS2769: Overload 2 of 4, '(strs: TemplateStringsArray, x: number, y: string): {}', gave the following error. +!!! error TS2769: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. var f = foo([], 1, 2, 3); // any (with error) ~ !!! error TS2554: Expected 1-3 arguments, but got 4. @@ -43,8 +71,12 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio var v = foo `${1}`; // string var w = foo `${1}${2}`; // boolean var x = foo `${1}${true}`; // boolean (with error) - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~ +!!! 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: 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'. 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 a3be7fbc7f7aa..38631e58b1705 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt @@ -1,8 +1,20 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(9,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(9,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(strs: TemplateStringsArray, s: string): string', gave the following error. + Argument of type '{}' is not assignable to parameter of type 'string'. + Overload 2 of 2, '(strs: TemplateStringsArray, n: number): number', gave the following error. + Argument of type '{}' is not assignable to parameter of type 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(18,4): error TS2339: Property 'foo' does not exist on type 'Date'. 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 TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,18): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(62,1): 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'. + 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'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,1): 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'. + 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'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(69,18): error TS2339: Property 'toFixed' does not exist on type 'string'. @@ -16,8 +28,12 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // No candidate overloads found fn1 `${ {} }`; // Error - ~~ -!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. + ~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(strs: TemplateStringsArray, s: string): string', gave the following error. +!!! error TS2769: Argument of type '{}' is not assignable to parameter of type 'string'. +!!! error TS2769: Overload 2 of 2, '(strs: TemplateStringsArray, n: number): number', gave the following error. +!!! error TS2769: Argument of type '{}' is not assignable to parameter of type 'number'. function fn2(strs: TemplateStringsArray, s: string, n: number): number; function fn2(strs: TemplateStringsArray, n: number, t: T): T; @@ -76,11 +92,19 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 `${ true }${ null }`; - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. fn4 `${ null }${ true }`; - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. // 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 c5063689b51b4..47639b2d6ac59 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.errors.txt @@ -1,8 +1,20 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(9,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(9,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(strs: TemplateStringsArray, s: string): string', gave the following error. + Argument of type '{}' is not assignable to parameter of type 'string'. + Overload 2 of 2, '(strs: TemplateStringsArray, n: number): number', gave the following error. + Argument of type '{}' is not assignable to parameter of type 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(18,4): error TS2339: Property 'foo' does not exist on type 'Date'. 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 TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(63,18): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(62,1): 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'. + 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'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(63,1): 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'. + 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'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(69,18): error TS2551: Property 'toFixed' does not exist on type 'string'. Did you mean 'fixed'? @@ -16,8 +28,12 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // No candidate overloads found fn1 `${ {} }`; // Error - ~~ -!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. + ~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(strs: TemplateStringsArray, s: string): string', gave the following error. +!!! error TS2769: Argument of type '{}' is not assignable to parameter of type 'string'. +!!! error TS2769: Overload 2 of 2, '(strs: TemplateStringsArray, n: number): number', gave the following error. +!!! error TS2769: Argument of type '{}' is not assignable to parameter of type 'number'. function fn2(strs: TemplateStringsArray, s: string, n: number): number; function fn2(strs: TemplateStringsArray, n: number, t: T): T; @@ -76,11 +92,19 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 `${ true }${ null }`; - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. fn4 `${ null }${ true }`; - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. // 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/tsxElementResolution9.errors.txt b/tests/baselines/reference/tsxElementResolution9.errors.txt index acfe7ce9cca97..971d4e3796df2 100644 --- a/tests/baselines/reference/tsxElementResolution9.errors.txt +++ b/tests/baselines/reference/tsxElementResolution9.errors.txt @@ -1,6 +1,18 @@ -tests/cases/conformance/jsx/file.tsx(11,2): error TS2322: Type '{}' is not assignable to type 'number'. -tests/cases/conformance/jsx/file.tsx(18,2): error TS2322: Type '{}' is not assignable to type 'number'. -tests/cases/conformance/jsx/file.tsx(25,2): error TS2322: Type '{ x: number; }' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(11,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(n: string): { x: number; }', gave the following error. + Type '{}' is not assignable to type 'string'. + Overload 2 of 2, '(n: number): { y: string; }', gave the following error. + Type '{}' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(18,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(n: string): { x: number; }', gave the following error. + Type '{}' is not assignable to type 'string'. + Overload 2 of 2, '(n: number): { y: string; }', gave the following error. + Type '{}' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(25,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(n: string): { x: number; }', gave the following error. + Type '{ x: number; }' is not assignable to type 'string'. + Overload 2 of 2, '(n: number): { x: number; y: string; }', gave the following error. + Type '{ x: number; }' is not assignable to type 'number'. ==== tests/cases/conformance/jsx/file.tsx (3 errors) ==== @@ -15,8 +27,12 @@ tests/cases/conformance/jsx/file.tsx(25,2): error TS2322: Type '{ x: number; }' } var Obj1: Obj1; ; // Error, return type is not an object type - ~~~~ -!!! error TS2322: Type '{}' is not assignable to type 'number'. + ~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(n: string): { x: number; }', gave the following error. +!!! error TS2769: Type '{}' is not assignable to type 'string'. +!!! error TS2769: Overload 2 of 2, '(n: number): { y: string; }', gave the following error. +!!! error TS2769: Type '{}' is not assignable to type 'number'. interface Obj2 { (n: string): { x: number }; @@ -24,8 +40,12 @@ tests/cases/conformance/jsx/file.tsx(25,2): error TS2322: Type '{ x: number; }' } var Obj2: Obj2; ; // Error, return type is not an object type - ~~~~ -!!! error TS2322: Type '{}' is not assignable to type 'number'. + ~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(n: string): { x: number; }', gave the following error. +!!! error TS2769: Type '{}' is not assignable to type 'string'. +!!! error TS2769: Overload 2 of 2, '(n: number): { y: string; }', gave the following error. +!!! error TS2769: Type '{}' is not assignable to type 'number'. interface Obj3 { (n: string): { x: number }; @@ -33,6 +53,10 @@ tests/cases/conformance/jsx/file.tsx(25,2): error TS2322: Type '{ x: number; }' } var Obj3: Obj3; ; // OK - ~~~~ -!!! error TS2322: Type '{ x: number; }' is not assignable to type 'number'. + ~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(n: string): { x: number; }', gave the following error. +!!! error TS2769: Type '{ x: number; }' is not assignable to type 'string'. +!!! error TS2769: Overload 2 of 2, '(n: number): { x: number; y: string; }', gave the following error. +!!! error TS2769: Type '{ x: number; }' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt b/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt index 7fe6609cc9615..056bd0b0dd71e 100644 --- a/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt +++ b/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt @@ -1,6 +1,10 @@ tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx(14,14): error TS2322: Type '{}' is not assignable to type 'P'. '{}' is assignable to the constraint of type 'P', but 'P' could be instantiated with a different subtype of constraint '{}'. -tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx(15,14): error TS2322: Type '{}' is not assignable to type 'Readonly

'. +tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx(15,13): error TS2769: No overload matches this call. + Overload 1 of 2, '(props: Readonly

): MyComponent', gave the following error. + Type '{}' is not assignable to type 'Readonly

'. + Overload 2 of 2, '(props: P, context?: any): MyComponent', gave the following error. + Type '{}' is not assignable to type 'Readonly

'. ==== tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx (2 errors) ==== @@ -22,8 +26,12 @@ tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx(15,14): error TS2322: Type !!! error TS2322: Type '{}' is not assignable to type 'P'. !!! error TS2322: '{}' is assignable to the constraint of type 'P', but 'P' could be instantiated with a different subtype of constraint '{}'. let y = ; // should error - ~~~~~~~~~~~ -!!! error TS2322: Type '{}' is not assignable to type 'Readonly

'. + ~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(props: Readonly

): MyComponent', gave the following error. +!!! error TS2769: Type '{}' is not assignable to type 'Readonly

'. +!!! error TS2769: Overload 2 of 2, '(props: P, context?: any): MyComponent', gave the following error. +!!! error TS2769: Type '{}' is not assignable to type 'Readonly

'. let z = // should work let q = // should work diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt index 733bb200e9960..a7983385910d1 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt @@ -1,18 +1,79 @@ -tests/cases/conformance/jsx/file.tsx(12,13): error TS2322: Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. - Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. -tests/cases/conformance/jsx/file.tsx(13,13): error TS2741: Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'. -tests/cases/conformance/jsx/file.tsx(14,31): error TS2322: Type 'true' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(16,13): error TS2322: Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. - Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. -tests/cases/conformance/jsx/file.tsx(17,13): error TS2322: Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'. - Types of property 'yy' are incompatible. - Type 'boolean' is not assignable to type 'number'. -tests/cases/conformance/jsx/file.tsx(25,13): error TS2741: Property 'yy' is missing in type '{ extra-data: true; }' but required in type '{ yy: string; direction?: number; }'. -tests/cases/conformance/jsx/file.tsx(26,40): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/conformance/jsx/file.tsx(33,32): error TS2322: Type 'string' is not assignable to type 'boolean'. -tests/cases/conformance/jsx/file.tsx(34,29): error TS2322: Type 'string' is not assignable to type 'boolean'. -tests/cases/conformance/jsx/file.tsx(35,29): error TS2322: Type 'string' is not assignable to type 'boolean'. -tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/jsx/file.tsx(12,12): error TS2769: No overload matches this call. + Overload 1 of 2, '(): Element', gave the following error. + Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes'. + Property 'extraProp' does not exist on type 'IntrinsicAttributes'. + Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. + Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. +tests/cases/conformance/jsx/file.tsx(13,12): error TS2769: No overload matches this call. + Overload 1 of 2, '(): Element', gave the following error. + Type '{ yy: number; }' is not assignable to type 'IntrinsicAttributes'. + Property 'yy' does not exist on type 'IntrinsicAttributes'. + Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. + Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'. +tests/cases/conformance/jsx/file.tsx(14,12): error TS2769: No overload matches this call. + Overload 1 of 2, '(): Element', gave the following error. + 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'. +tests/cases/conformance/jsx/file.tsx(16,12): 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'. + Property 'y1' does not exist on type 'IntrinsicAttributes'. + Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. + Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. +tests/cases/conformance/jsx/file.tsx(17,12): error TS2769: No overload matches this call. + Overload 1 of 2, '(): Element', gave the following error. + Type '{ yy: boolean; yy1: string; }' has no properties in common with type 'IntrinsicAttributes'. + Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. + Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'. + Types of property 'yy' are incompatible. + Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/jsx/file.tsx(25,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'. + 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. + Overload 1 of 2, '(j: { "extra-data": string; }): Element', gave the following error. + Type '{ yy: string; direction: string; }' is not assignable to type 'IntrinsicAttributes & { "extra-data": string; }'. + Property 'yy' does not exist on type 'IntrinsicAttributes & { "extra-data": string; }'. + Overload 2 of 2, '(n: { yy: string; direction?: number; }): Element', gave the following error. + 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'. + Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. + Type 'true' 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. + Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. + Type '{ y1: string; y2: number; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. + Property 'y3' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. + Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. + Type '{ y1: string; y2: number; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }'. + Property 'y3' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }'. + 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(35,12): error TS2769: No overload matches this call. + Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. + Type '{ y1: string; y2: number; children: string; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. + Property 'children' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. + Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. + Type 'string' is not assignable to type 'Element'. + 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(36,12): error TS2769: No overload matches this call. + Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error. + Type '{ children: string; y1: string; y2: number; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. + Property 'children' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. + Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. + 'TestingOptional' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element'. + 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 (11 errors) ==== @@ -28,27 +89,51 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type 'string' is not // Error const c0 = ; // extra property; - ~~~~~~~~ -!!! error TS2322: Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. -!!! error TS2322: Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. +!!! error TS2769: Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes'. +!!! error TS2769: Property 'extraProp' 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 '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. +!!! error TS2769: Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. const c1 = ; // missing property; - ~~~~~~~~ -!!! error TS2741: Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. +!!! error TS2769: Type '{ yy: number; }' is not assignable to type 'IntrinsicAttributes'. +!!! error TS2769: Property 'yy' does not exist on type 'IntrinsicAttributes'. +!!! error TS2769: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. +!!! error TS2769: Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'. !!! related TS2728 tests/cases/conformance/jsx/file.tsx:3:43: 'yy1' is declared here. const c2 = ; // type incompatible; - ~~~ -!!! error TS2322: Type 'true' is not assignable to type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. +!!! 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'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:43: The expected type comes from property 'yy1' which is declared here on type 'IntrinsicAttributes & { yy: number; yy1: string; }' const c3 = ; // This is OK becuase all attribute are spread const c4 = ; // extra property; - ~~~~~~~~ -!!! error TS2322: Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. -!!! error TS2322: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. +!!! error TS2769: Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes'. +!!! error TS2769: Property 'y1' 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 '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'. +!!! error TS2769: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. const c5 = ; // type incompatible; - ~~~~~~~~ -!!! error TS2322: Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'. -!!! error TS2322: Types of property 'yy' are incompatible. -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(): Element', gave the following error. +!!! error TS2769: Type '{ yy: boolean; yy1: string; }' has no properties in common with type 'IntrinsicAttributes'. +!!! error TS2769: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error. +!!! error TS2769: Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'. +!!! error TS2769: Types of property 'yy' are incompatible. +!!! error TS2769: Type 'boolean' is not assignable to type 'number'. const c6 = ; // Should error as there is extra attribute that doesn't match any. Current it is not const c7 = ; // Should error as there is extra attribute that doesn't match any. Current it is not @@ -57,12 +142,22 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type 'string' is not // Error const d1 = - ~~~~~~~~~~~~~~~ -!!! error TS2741: Property 'yy' is missing in type '{ extra-data: true; }' but required in type '{ yy: string; direction?: number; }'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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; }' !!! related TS2728 tests/cases/conformance/jsx/file.tsx:22:38: 'yy' is declared here. const d2 = - ~~~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 '{ yy: string; direction: string; }' is not assignable to type 'IntrinsicAttributes & { "extra-data": string; }'. +!!! error TS2769: Property 'yy' does not exist on type 'IntrinsicAttributes & { "extra-data": string; }'. +!!! error TS2769: Overload 2 of 2, '(n: { yy: string; direction?: number; }): Element', gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'number'. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:22:50: The expected type comes from property 'direction' which is declared here on type 'IntrinsicAttributes & { yy: string; direction?: number; }' declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element; @@ -71,19 +166,51 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type 'string' is not // Error const e1 = - ~~ -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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: 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; }' +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:29:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }' !!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:64: The expected type comes from property 'y3' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' const e2 = - ~~ -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 '{ y1: string; y2: number; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +!!! error TS2769: Property 'y3' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +!!! error TS2769: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +!!! error TS2769: Type '{ y1: string; y2: number; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }'. +!!! error TS2769: Property 'y3' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }'. +!!! 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:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' const e3 = - ~~ -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 '{ y1: string; y2: number; children: string; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +!!! error TS2769: Property 'children' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +!!! error TS2769: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +!!! error TS2769: Type 'string' is not assignable to type 'Element'. +!!! 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:29:64: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }' !!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' const e4 = Hi - ~~ -!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 '{ children: string; y1: string; y2: number; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +!!! error TS2769: Property 'children' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'. +!!! error TS2769: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error. +!!! error TS2769: 'TestingOptional' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element'. +!!! 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:29:64: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }' !!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' \ No newline at end of file diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt index 9101537a6e976..2b5a6cce92689 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt @@ -1,8 +1,34 @@ -tests/cases/conformance/jsx/file.tsx(48,13): error TS2322: Type '{ children: string; to: string; onClick: (e: any) => void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. - Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. -tests/cases/conformance/jsx/file.tsx(54,51): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(55,68): error TS2322: Type 'true' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(56,24): error TS2322: Type 'true' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(48,12): error TS2769: No overload matches this call. + Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. + Type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. + Property 'to' does not exist on type 'IntrinsicAttributes & ButtonProps'. + Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. + Type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. + Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. + Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. + Type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. + Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. +tests/cases/conformance/jsx/file.tsx(54,12): error TS2769: No overload matches this call. + Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. + Type 'number' is not assignable to type 'string'. + Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. + Type 'number' is not assignable to type 'string'. + Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsx/file.tsx(55,12): 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'. + Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. + Type 'true' 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'. +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'. ==== tests/cases/conformance/jsx/file.tsx (4 errors) ==== @@ -54,23 +80,55 @@ tests/cases/conformance/jsx/file.tsx(56,24): error TS2322: Type 'true' is not as // Error const b0 = {}}>GO; // extra property; - ~~~~~~~~~~ -!!! error TS2322: Type '{ children: string; to: string; onClick: (e: any) => void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. -!!! error TS2322: Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +!!! error TS2769: Type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps'. +!!! error TS2769: Property 'to' does not exist on type 'IntrinsicAttributes & ButtonProps'. +!!! error TS2769: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +!!! error TS2769: Type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'. +!!! error TS2769: Property 'onClick' does not exist on type 'IntrinsicAttributes & LinkProps'. +!!! error TS2769: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. +!!! error TS2769: Type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'. +!!! error TS2769: Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'. const b1 = {}} {...obj0}>Hello world; // extra property; const b2 = ; // extra property const b3 = {}}} />; // extra property const b4 = ; // Should error because Incorrect type; but attributes are any so everything is allowed const b5 = ; // Spread retain method declaration (see GitHub #13365), so now there is an extra attributes const b6 = ; // incorrect type for optional attribute - ~~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & ButtonProps' +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & LinkProps' !!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & HyphenProps' const b7 = ; // incorrect type for optional attribute - ~~~~~~~~~ -!!! error TS2322: Type 'true' is not assignable to type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error. +!!! error TS2769: Type 'true' 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'. +!!! 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' const b8 = ; // incorrect type for specified hyphanated name - ~~~~~~~~~~~ -!!! error TS2322: Type 'true' is not assignable to type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error. +!!! error TS2769: Property 'onClick' is missing in type '{ data-format: true; }' but required in type 'ButtonProps'. +!!! 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'. +!!! 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/tsxStatelessFunctionComponentOverload5.types b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.types index d9b40dad94f48..6a9b770ef483b 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.types +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.types @@ -113,9 +113,9 @@ const b0 = {}}>GO; // ex >{}}>GO : JSX.Element >MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } >to : string ->onClick : (e: any) => void ->(e)=>{} : (e: any) => void ->e : any +>onClick : (e: React.MouseEvent) => void +>(e)=>{} : (e: React.MouseEvent) => void +>e : React.MouseEvent >MainButton : { (buttonProps: ButtonProps): JSX.Element; (linkProps: LinkProps): JSX.Element; (hyphenProps: HyphenProps): JSX.Element; } const b1 = {}} {...obj0}>Hello world; // extra property; diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt index 38d4435a46d8c..edb9ceb1ac63b 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt @@ -1,6 +1,20 @@ -tests/cases/conformance/jsx/file.tsx(9,15): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'. -tests/cases/conformance/jsx/file.tsx(10,15): error TS2322: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'. - Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: unknown; }'. +tests/cases/conformance/jsx/file.tsx(9,14): error TS2769: No overload matches this call. + Overload 1 of 3, '(): Element', gave the following error. + Type '{ a: number; }' is not assignable to type 'IntrinsicAttributes'. + Property 'a' does not exist on type 'IntrinsicAttributes'. + Overload 2 of 3, '(attr: { b: unknown; a: string; "ignore-prop": boolean; }): Element', gave the following error. + Type 'number' is not assignable to type 'string'. + Overload 3 of 3, '(attr: { b: unknown; a: number; }): Element', gave the following error. + Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'. +tests/cases/conformance/jsx/file.tsx(10,14): error TS2769: No overload matches this call. + Overload 1 of 3, '(): Element', gave the following error. + Type 'T & { ignore-prop: true; }' has no properties in common with type 'IntrinsicAttributes'. + Overload 2 of 3, '(attr: { b: unknown; a: string; "ignore-prop": boolean; }): Element', gave the following error. + Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: string; "ignore-prop": boolean; }'. + Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: string; "ignore-prop": boolean; }'. + Overload 3 of 3, '(attr: { b: unknown; a: unknown; }): Element', gave the following error. + Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'. + Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: unknown; }'. ==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== @@ -13,12 +27,28 @@ tests/cases/conformance/jsx/file.tsx(10,15): error TS2322: Type 'T & { ignore-pr // Error function Baz(arg1: T, arg2: U) { let a0 = - ~~~~~~~~~~~~~~~~~ -!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(): Element', gave the following error. +!!! error TS2769: Type '{ a: number; }' is not assignable to type 'IntrinsicAttributes'. +!!! error TS2769: Property 'a' does not exist on type 'IntrinsicAttributes'. +!!! error TS2769: Overload 2 of 3, '(attr: { b: unknown; a: string; "ignore-prop": boolean; }): Element', gave the following error. +!!! error TS2769: Type 'number' is not assignable to type 'string'. +!!! error TS2769: Overload 3 of 3, '(attr: { b: unknown; a: number; }): Element', gave the following error. +!!! error TS2769: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'. +!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:52: The expected type comes from property 'a' which is declared here on type 'IntrinsicAttributes & { b: unknown; a: string; "ignore-prop": boolean; }' !!! related TS2728 tests/cases/conformance/jsx/file.tsx:5:49: 'b' is declared here. let a2 = // missing a - ~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'. -!!! error TS2322: Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: unknown; }'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 3, '(): Element', gave the following error. +!!! error TS2769: Type 'T & { ignore-prop: true; }' has no properties in common with type 'IntrinsicAttributes'. +!!! error TS2769: Overload 2 of 3, '(attr: { b: unknown; a: string; "ignore-prop": boolean; }): Element', gave the following error. +!!! error TS2769: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: string; "ignore-prop": boolean; }'. +!!! error TS2769: Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: string; "ignore-prop": boolean; }'. +!!! error TS2769: Overload 3 of 3, '(attr: { b: unknown; a: unknown; }): Element', gave the following error. +!!! error TS2769: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'. +!!! error TS2769: Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: unknown; }'. +!!! related TS2728 tests/cases/conformance/jsx/file.tsx:4:52: 'a' is declared here. !!! related TS2728 tests/cases/conformance/jsx/file.tsx:5:55: 'a' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/underscoreTest1.errors.txt b/tests/baselines/reference/underscoreTest1.errors.txt index 66fc8961eef58..7bc8e28cf08ec 100644 --- a/tests/baselines/reference/underscoreTest1.errors.txt +++ b/tests/baselines/reference/underscoreTest1.errors.txt @@ -1,5 +1,11 @@ -tests/cases/compiler/underscoreTest1_underscoreTests.ts(26,7): error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type 'Dictionary'. - Index signature is missing in type '(string | number | boolean)[]'. +tests/cases/compiler/underscoreTest1_underscoreTests.ts(26,1): error TS2769: No overload matches this call. + Overload 1 of 2, '(list: (string | number | boolean)[], iterator?: Iterator_, context?: any): boolean', gave the following error. + Argument of type '(value: T) => T' is not assignable to parameter of type 'Iterator_'. + Type 'string | number | boolean' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + Overload 2 of 2, '(list: Dictionary, iterator?: Iterator_, context?: any): boolean', gave the following error. + Argument of type '(string | number | boolean)[]' is not assignable to parameter of type 'Dictionary'. + Index signature is missing in type '(string | number | boolean)[]'. ==== tests/cases/compiler/underscoreTest1_underscoreTests.ts (1 errors) ==== @@ -29,9 +35,15 @@ tests/cases/compiler/underscoreTest1_underscoreTests.ts(26,7): error TS2345: Arg var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); _.all([true, 1, null, 'yes'], _.identity); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type 'Dictionary'. -!!! error TS2345: Index signature is missing in type '(string | number | boolean)[]'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(list: (string | number | boolean)[], iterator?: Iterator_, context?: any): boolean', gave the following error. +!!! error TS2769: Argument of type '(value: T) => T' is not assignable to parameter of type 'Iterator_'. +!!! error TS2769: Type 'string | number | boolean' is not assignable to type 'boolean'. +!!! error TS2769: Type 'string' is not assignable to type 'boolean'. +!!! error TS2769: Overload 2 of 2, '(list: Dictionary, iterator?: Iterator_, context?: any): boolean', gave the following error. +!!! error TS2769: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type 'Dictionary'. +!!! error TS2769: Index signature is missing in type '(string | number | boolean)[]'. _.any([null, 0, 'yes', false]); diff --git a/tests/baselines/reference/unionTypeCallSignatures.errors.txt b/tests/baselines/reference/unionTypeCallSignatures.errors.txt index 2c80ac58cc8f4..a94ec12dc637b 100644 --- a/tests/baselines/reference/unionTypeCallSignatures.errors.txt +++ b/tests/baselines/reference/unionTypeCallSignatures.errors.txt @@ -1,6 +1,14 @@ 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(10,29): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(15,29): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(10,1): 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'. + Overload 2 of 2, '(a: string): string | boolean', gave the following error. + Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(15,1): 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'. + Overload 2 of 2, '(a: string): string | boolean', gave the following error. + Argument of type 'true' 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'. @@ -40,15 +48,23 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. unionOfDifferentReturnType1(true); // error in type of parameter - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. var unionOfDifferentReturnType1: { (a: number): number; (a: string): string; } | { (a: number): Date; (a: string): boolean; }; numOrDate = unionOfDifferentReturnType1(10); strOrBoolean = unionOfDifferentReturnType1("hello"); unionOfDifferentReturnType1(true); // error in type of parameter - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. unionOfDifferentReturnType1(); // error missing parameter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. diff --git a/tests/baselines/reference/unionTypeConstructSignatures.errors.txt b/tests/baselines/reference/unionTypeConstructSignatures.errors.txt index d46f616e53ef0..a9f5937144b02 100644 --- a/tests/baselines/reference/unionTypeConstructSignatures.errors.txt +++ b/tests/baselines/reference/unionTypeConstructSignatures.errors.txt @@ -1,6 +1,14 @@ 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(10,33): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(15,33): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(10,1): 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'. + Overload 2 of 2, '(a: string): string | boolean', gave the following error. + Argument of type 'true' is not assignable to parameter of type 'string'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(15,1): 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'. + Overload 2 of 2, '(a: string): string | boolean', gave the following error. + Argument of type 'true' 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'. @@ -39,15 +47,23 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. new unionOfDifferentReturnType1(true); // error in type of parameter - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. var unionOfDifferentReturnType1: { new (a: number): number; new (a: string): string; } | { new (a: number): Date; new (a: string): boolean; }; numOrDate = new unionOfDifferentReturnType1(10); strOrBoolean = new unionOfDifferentReturnType1("hello"); new unionOfDifferentReturnType1(true); // error in type of parameter - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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: 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'. new unionOfDifferentReturnType1(); // error missing parameter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0.