Introduce flattened error reporting for properties, call signatures, and construct signatures (#33473)

* Introduce flattened error reporting for properties, call signatures, and construct signatures

* Update message, specialize output for argument-less signatures

* Skip leading signature incompatability flattening

* Add return type specialized message
This commit is contained in:
Wesley Wigham 2019-09-23 16:08:44 -07:00 committed by GitHub
parent 6c2ae12559
commit 26caa3793e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 1023 additions and 735 deletions

View File

@ -6,6 +6,7 @@ interface DiagnosticDetails {
code: number;
reportsUnnecessary?: {};
isEarly?: boolean;
elidedInCompatabilityPyramid?: boolean;
}
type InputDiagnosticMessageTable = Map<string, DiagnosticDetails>;
@ -63,14 +64,15 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, inputFil
"// generated from '" + inputFilePathRel + "' by '" + thisFilePathRel.replace(/\\/g, "/") + "'\r\n" +
"/* @internal */\r\n" +
"namespace ts {\r\n" +
" function diag(code: number, category: DiagnosticCategory, key: string, message: string, reportsUnnecessary?: {}): DiagnosticMessage {\r\n" +
" return { code, category, key, message, reportsUnnecessary };\r\n" +
" function diag(code: number, category: DiagnosticCategory, key: string, message: string, reportsUnnecessary?: {}, elidedInCompatabilityPyramid?: boolean): DiagnosticMessage {\r\n" +
" return { code, category, key, message, reportsUnnecessary, elidedInCompatabilityPyramid };\r\n" +
" }\r\n" +
" export const Diagnostics = {\r\n";
messageTable.forEach(({ code, category, reportsUnnecessary }, name) => {
messageTable.forEach(({ code, category, reportsUnnecessary, elidedInCompatabilityPyramid }, name) => {
const propName = convertPropertyName(name);
const argReportsUnnecessary = reportsUnnecessary ? `, /*reportsUnnecessary*/ ${reportsUnnecessary}` : "";
result += ` ${propName}: diag(${code}, DiagnosticCategory.${category}, "${createKey(propName, code)}", ${JSON.stringify(name)}${argReportsUnnecessary}),\r\n`;
const argElidedInCompatabilityPyramid = elidedInCompatabilityPyramid ? `${!reportsUnnecessary ? ", /*reportsUnnecessary*/ undefined" : ""}, /*elidedInCompatabilityPyramid*/ ${elidedInCompatabilityPyramid}` : "";
result += ` ${propName}: diag(${code}, DiagnosticCategory.${category}, "${createKey(propName, code)}", ${JSON.stringify(name)}${argReportsUnnecessary}${argElidedInCompatabilityPyramid}),\r\n`;
});
result += " };\r\n}";

View File

@ -12329,7 +12329,7 @@ namespace ts {
target: Signature,
ignoreReturnTypes: boolean): boolean {
return compareSignaturesRelated(source, target, CallbackCheck.None, ignoreReturnTypes, /*reportErrors*/ false,
/*errorReporter*/ undefined, compareTypesAssignable) !== Ternary.False;
/*errorReporter*/ undefined, /*errorReporter*/ undefined, compareTypesAssignable) !== Ternary.False;
}
type ErrorReporter = (message: DiagnosticMessage, arg0?: string, arg1?: string) => void;
@ -12352,6 +12352,7 @@ namespace ts {
ignoreReturnTypes: boolean,
reportErrors: boolean,
errorReporter: ErrorReporter | undefined,
incompatibleErrorReporter: ((source: Type, target: Type) => void) | undefined,
compareTypes: TypeComparer): Ternary {
// TODO (drosen): De-duplicate code between related functions.
if (source === target) {
@ -12422,7 +12423,7 @@ namespace ts {
(getFalsyFlags(sourceType) & TypeFlags.Nullable) === (getFalsyFlags(targetType) & TypeFlags.Nullable);
const related = callbacks ?
// TODO: GH#18217 It will work if they're both `undefined`, but not if only one is
compareSignaturesRelated(targetSig!, sourceSig!, strictVariance ? CallbackCheck.Strict : CallbackCheck.Bivariant, /*ignoreReturnTypes*/ false, reportErrors, errorReporter, compareTypes) :
compareSignaturesRelated(targetSig!, sourceSig!, strictVariance ? CallbackCheck.Strict : CallbackCheck.Bivariant, /*ignoreReturnTypes*/ false, reportErrors, errorReporter, incompatibleErrorReporter, compareTypes) :
!callbackCheck && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
if (!related) {
if (reportErrors) {
@ -12468,6 +12469,9 @@ namespace ts {
// wouldn't be co-variant for T without this rule.
result &= callbackCheck === CallbackCheck.Bivariant && compareTypes(targetReturnType, sourceReturnType, /*reportErrors*/ false) ||
compareTypes(sourceReturnType, targetReturnType, reportErrors);
if (!result && reportErrors && incompatibleErrorReporter) {
incompatibleErrorReporter(sourceReturnType, targetReturnType);
}
}
}
@ -12677,11 +12681,16 @@ namespace ts {
let depth = 0;
let expandingFlags = ExpandingFlags.None;
let overflow = false;
let overrideNextErrorInfo: DiagnosticMessageChain | undefined;
let overrideNextErrorInfo = 0; // How many `reportRelationError` calls should be skipped in the elaboration pyramid
let lastSkippedInfo: [Type, Type] | undefined;
let incompatibleStack: [DiagnosticMessage, (string | number)?, (string | number)?, (string | number)?, (string | number)?][] = [];
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
const result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage);
if (incompatibleStack.length) {
reportIncompatibleStack();
}
if (overflow) {
const diag = error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
if (errorOutputContainer) {
@ -12726,8 +12735,134 @@ namespace ts {
}
return result !== Ternary.False;
function resetErrorInfo(saved: ReturnType<typeof captureErrorCalculationState>) {
errorInfo = saved.errorInfo;
lastSkippedInfo = saved.lastSkippedInfo;
incompatibleStack = saved.incompatibleStack;
overrideNextErrorInfo = saved.overrideNextErrorInfo;
relatedInfo = saved.relatedInfo;
}
function captureErrorCalculationState() {
return {
errorInfo,
lastSkippedInfo,
incompatibleStack: incompatibleStack.slice(),
overrideNextErrorInfo,
relatedInfo: !relatedInfo ? undefined : relatedInfo.slice() as ([DiagnosticRelatedInformation, ...DiagnosticRelatedInformation[]] | undefined)
};
}
function reportIncompatibleError(message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number) {
overrideNextErrorInfo++; // Suppress the next relation error
lastSkippedInfo = undefined; // Reset skipped info cache
incompatibleStack.push([message, arg0, arg1, arg2, arg3]);
}
function reportIncompatibleStack() {
const stack = incompatibleStack;
incompatibleStack = [];
const info = lastSkippedInfo;
lastSkippedInfo = undefined;
if (stack.length === 1) {
reportError(...stack[0]);
if (info) {
// Actually do the last relation error
reportRelationError(/*headMessage*/ undefined, ...info);
}
return;
}
// The first error will be the innermost, while the last will be the outermost - so by popping off the end,
// we can build from left to right
let path = "";
const secondaryRootErrors: typeof incompatibleStack = [];
while (stack.length) {
const [msg, ...args] = stack.pop()!;
switch (msg.code) {
case Diagnostics.Types_of_property_0_are_incompatible.code: {
// Parenthesize a `new` if there is one
if (path.indexOf("new ") === 0) {
path = `(${path})`;
}
const str = "" + args[0];
// If leading, just print back the arg (irrespective of if it's a valid identifier)
if (path.length === 0) {
path = `${str}`;
}
// Otherwise write a dotted name if possible
else if (isIdentifierText(str, compilerOptions.target)) {
path = `${path}.${str}`;
}
// Failing that, check if the name is already a computed name
else if (str[0] === "[" && str[str.length - 1] === "]") {
path = `${path}${str}`;
}
// And finally write out a computed name as a last resort
else {
path = `${path}[${str}]`;
}
break;
}
case Diagnostics.Call_signature_return_types_0_and_1_are_incompatible.code:
case Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code:
case Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code:
case Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code: {
if (path.length === 0) {
// Don't flatten signature compatability errors at the start of a chain - instead prefer
// to unify (the with no arguments bit is excessive for printback) and print them back
let mappedMsg = msg;
if (msg.code === Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) {
mappedMsg = Diagnostics.Call_signature_return_types_0_and_1_are_incompatible;
}
else if (msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) {
mappedMsg = Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible;
}
secondaryRootErrors.unshift([mappedMsg, args[0], args[1]]);
}
else {
const prefix = (msg.code === Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code ||
msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code)
? "new "
: "";
const params = (msg.code === Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code ||
msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code)
? ""
: "...";
path = `${prefix}${path}(${params})`;
}
break;
}
default:
return Debug.fail(`Unhandled Diagnostic: ${msg.code}`);
}
}
if (path) {
reportError(path[path.length - 1] === ")"
? Diagnostics.The_types_returned_by_0_are_incompatible_between_these_types
: Diagnostics.The_types_of_0_are_incompatible_between_these_types,
path
);
}
else {
// Remove the innermost secondary error as it will duplicate the error already reported by `reportRelationError` on entry
secondaryRootErrors.shift();
}
for (const [msg, ...args] of secondaryRootErrors) {
const originalValue = msg.elidedInCompatabilityPyramid;
msg.elidedInCompatabilityPyramid = false; // Teporarily override elision to ensure error is reported
reportError(msg, ...args);
msg.elidedInCompatabilityPyramid = originalValue;
}
if (info) {
// Actually do the last relation error
reportRelationError(/*headMessage*/ undefined, ...info);
}
}
function reportError(message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): void {
Debug.assert(!!errorNode);
if (incompatibleStack.length) reportIncompatibleStack();
if (message.elidedInCompatabilityPyramid) return;
errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2, arg3);
}
@ -12742,6 +12877,7 @@ namespace ts {
}
function reportRelationError(message: DiagnosticMessage | undefined, source: Type, target: Type) {
if (incompatibleStack.length) reportIncompatibleStack();
const [sourceType, targetType] = getTypeNamesForErrorDisplay(source, target);
if (target.flags & TypeFlags.TypeParameter && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) {
@ -12899,7 +13035,7 @@ namespace ts {
}
let result = Ternary.False;
const saveErrorInfo = errorInfo;
const saveErrorInfo = captureErrorCalculationState();
let isIntersectionConstituent = !!isApparentIntersectionConstituent;
// Note that these checks are specifically ordered to produce correct results. In particular,
@ -12949,7 +13085,7 @@ namespace ts {
}
if (!result && (source.flags & TypeFlags.StructuredOrInstantiable || target.flags & TypeFlags.StructuredOrInstantiable)) {
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
}
}
}
@ -12966,19 +13102,21 @@ namespace ts {
const constraint = getUnionConstraintOfIntersection(<IntersectionType>source, !!(target.flags & TypeFlags.Union));
if (constraint) {
if (result = isRelatedTo(constraint, target, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent)) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
}
}
}
if (!result && reportErrors) {
let maybeSuppress = overrideNextErrorInfo;
overrideNextErrorInfo = undefined;
let maybeSuppress = overrideNextErrorInfo > 0;
if (maybeSuppress) {
overrideNextErrorInfo--;
}
if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Object) {
const currentError = errorInfo;
tryElaborateArrayLikeErrors(source, target, reportErrors);
if (errorInfo !== currentError) {
maybeSuppress = errorInfo;
maybeSuppress = !!errorInfo;
}
}
if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Primitive) {
@ -12998,6 +13136,7 @@ namespace ts {
}
}
if (!headMessage && maybeSuppress) {
lastSkippedInfo = [source, target];
// Used by, eg, missing property checking to replace the top-level message with a more informative one
return result;
}
@ -13439,7 +13578,7 @@ namespace ts {
let result: Ternary;
let originalErrorInfo: DiagnosticMessageChain | undefined;
let varianceCheckFailed = false;
const saveErrorInfo = errorInfo;
const saveErrorInfo = captureErrorCalculationState();
// We limit alias variance probing to only object and conditional types since their alias behavior
// is more predictable than other, interned types, which may or may not have an alias depending on
@ -13531,7 +13670,7 @@ namespace ts {
}
}
originalErrorInfo = errorInfo;
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
}
}
}
@ -13543,7 +13682,7 @@ namespace ts {
result &= isRelatedTo((<IndexedAccessType>source).indexType, (<IndexedAccessType>target).indexType, reportErrors);
}
if (result) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
return result;
}
}
@ -13552,25 +13691,25 @@ namespace ts {
if (!constraint || (source.flags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any)) {
// A type variable with no constraint is not related to the non-primitive object type.
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
return result;
}
}
// hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
else if (result = isRelatedTo(constraint, target, /*reportErrors*/ false, /*headMessage*/ undefined, isIntersectionConstituent)) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
return result;
}
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent)) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
return result;
}
}
}
else if (source.flags & TypeFlags.Index) {
if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
return result;
}
}
@ -13595,7 +13734,7 @@ namespace ts {
result &= isRelatedTo(getFalseTypeFromConditionalType(<ConditionalType>source), getFalseTypeFromConditionalType(<ConditionalType>target), reportErrors);
}
if (result) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
return result;
}
}
@ -13604,14 +13743,14 @@ namespace ts {
const distributiveConstraint = getConstraintOfDistributiveConditionalType(<ConditionalType>source);
if (distributiveConstraint) {
if (result = isRelatedTo(distributiveConstraint, target, reportErrors)) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
return result;
}
}
const defaultConstraint = getDefaultConstraintOfConditionalType(<ConditionalType>source);
if (defaultConstraint) {
if (result = isRelatedTo(defaultConstraint, target, reportErrors)) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
return result;
}
}
@ -13625,7 +13764,7 @@ namespace ts {
if (isGenericMappedType(target)) {
if (isGenericMappedType(source)) {
if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
return result;
}
}
@ -13671,7 +13810,7 @@ namespace ts {
// relates to X. Thus, we include intersection types on the source side here.
if (source.flags & (TypeFlags.Object | TypeFlags.Intersection) && target.flags & TypeFlags.Object) {
// Report structural errors only if we haven't reported any errors yet
const reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
const reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo.errorInfo && !sourceIsPrimitive;
result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined, isIntersectionConstituent);
if (result) {
result &= signaturesRelatedTo(source, target, SignatureKind.Call, reportStructuralErrors);
@ -13686,7 +13825,7 @@ namespace ts {
}
}
if (varianceCheckFailed && result) {
errorInfo = originalErrorInfo || errorInfo || saveErrorInfo; // Use variance error (there is no structural one) and return false
errorInfo = originalErrorInfo || errorInfo || saveErrorInfo.errorInfo; // Use variance error (there is no structural one) and return false
}
else if (result) {
return result;
@ -13718,7 +13857,7 @@ namespace ts {
// We elide the variance-based error elaborations, since those might not be too helpful, since we'll potentially
// be assuming identity of the type parameter.
originalErrorInfo = undefined;
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
return undefined;
}
const allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances);
@ -13746,7 +13885,7 @@ namespace ts {
// comparison unexpectedly succeeds. This can happen when the structural comparison result
// is a Ternary.Maybe for example caused by the recursion depth limiter.
originalErrorInfo = errorInfo;
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
}
}
}
@ -13980,7 +14119,7 @@ namespace ts {
const related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, isIntersectionConstituent);
if (!related) {
if (reportErrors) {
reportError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
reportIncompatibleError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
}
return Ternary.False;
}
@ -14022,8 +14161,8 @@ namespace ts {
if (length(unmatchedProperty.declarations)) {
associateRelatedInfo(createDiagnosticForNode(unmatchedProperty.declarations[0], Diagnostics._0_is_declared_here, propName));
}
if (shouldSkipElaboration) {
overrideNextErrorInfo = errorInfo;
if (shouldSkipElaboration && errorInfo) {
overrideNextErrorInfo++;
}
}
else if (tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ false)) {
@ -14033,8 +14172,8 @@ namespace ts {
else {
reportError(Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), map(props, p => symbolToString(p)).join(", "));
}
if (shouldSkipElaboration) {
overrideNextErrorInfo = errorInfo;
if (shouldSkipElaboration && errorInfo) {
overrideNextErrorInfo++;
}
}
// ELSE: No array like or unmatched property error - just issue top level error (errorInfo = undefined)
@ -14157,7 +14296,8 @@ namespace ts {
}
let result = Ternary.True;
const saveErrorInfo = errorInfo;
const saveErrorInfo = captureErrorCalculationState();
const incompatibleReporter = kind === SignatureKind.Construct ? reportIncompatibleConstructSignatureReturn : reportIncompatibleCallSignatureReturn;
if (getObjectFlags(source) & ObjectFlags.Instantiated && getObjectFlags(target) & ObjectFlags.Instantiated && source.symbol === target.symbol) {
// We have instantiations of the same anonymous type (which typically will be the type of a
@ -14165,7 +14305,7 @@ namespace ts {
// of the much more expensive N * M comparison matrix we explore below. We erase type parameters
// as they are known to always be the same.
for (let i = 0; i < targetSignatures.length; i++) {
const related = signatureRelatedTo(sourceSignatures[i], targetSignatures[i], /*erase*/ true, reportErrors);
const related = signatureRelatedTo(sourceSignatures[i], targetSignatures[i], /*erase*/ true, reportErrors, incompatibleReporter(sourceSignatures[i], targetSignatures[i]));
if (!related) {
return Ternary.False;
}
@ -14179,17 +14319,17 @@ namespace ts {
// this regardless of the number of signatures, but the potential costs are prohibitive due
// to the quadratic nature of the logic below.
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
result = signatureRelatedTo(sourceSignatures[0], targetSignatures[0], eraseGenerics, reportErrors);
result = signatureRelatedTo(sourceSignatures[0], targetSignatures[0], eraseGenerics, reportErrors, incompatibleReporter(sourceSignatures[0], targetSignatures[0]));
}
else {
outer: for (const t of targetSignatures) {
// Only elaborate errors from the first failure
let shouldElaborateErrors = reportErrors;
for (const s of sourceSignatures) {
const related = signatureRelatedTo(s, t, /*erase*/ true, shouldElaborateErrors);
const related = signatureRelatedTo(s, t, /*erase*/ true, shouldElaborateErrors, incompatibleReporter(s, t));
if (related) {
result &= related;
errorInfo = saveErrorInfo;
resetErrorInfo(saveErrorInfo);
continue outer;
}
shouldElaborateErrors = false;
@ -14206,12 +14346,26 @@ namespace ts {
return result;
}
function reportIncompatibleCallSignatureReturn(siga: Signature, sigb: Signature) {
if (siga.parameters.length === 0 && sigb.parameters.length === 0) {
return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target));
}
return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Call_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target));
}
function reportIncompatibleConstructSignatureReturn(siga: Signature, sigb: Signature) {
if (siga.parameters.length === 0 && sigb.parameters.length === 0) {
return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target));
}
return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target));
}
/**
* See signatureAssignableTo, compareSignaturesIdentical
*/
function signatureRelatedTo(source: Signature, target: Signature, erase: boolean, reportErrors: boolean): Ternary {
function signatureRelatedTo(source: Signature, target: Signature, erase: boolean, reportErrors: boolean, incompatibleReporter: (source: Type, target: Type) => void): Ternary {
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target,
CallbackCheck.None, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo);
CallbackCheck.None, /*ignoreReturnTypes*/ false, reportErrors, reportError, incompatibleReporter, isRelatedTo);
}
function signaturesIdenticalTo(source: Type, target: Type, kind: SignatureKind): Ternary {

View File

@ -1040,6 +1040,35 @@
"code": 1357
},
"The types of '{0}' are incompatible between these types.": {
"category": "Error",
"code": 2200
},
"The types returned by '{0}' are incompatible between these types.": {
"category": "Error",
"code": 2201
},
"Call signature return types '{0}' and '{1}' are incompatible.": {
"category": "Error",
"code": 2202,
"elidedInCompatabilityPyramid": true
},
"Construct signature return types '{0}' and '{1}' are incompatible.": {
"category": "Error",
"code": 2203,
"elidedInCompatabilityPyramid": true
},
"Call signatures with no arguments have incompatible return types '{0}' and '{1}'.": {
"category": "Error",
"code": 2204,
"elidedInCompatabilityPyramid": true
},
"Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.": {
"category": "Error",
"code": 2205,
"elidedInCompatabilityPyramid": true
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2300

View File

@ -4631,6 +4631,8 @@ namespace ts {
code: number;
message: string;
reportsUnnecessary?: {};
/* @internal */
elidedInCompatabilityPyramid?: boolean;
}
/**

View File

@ -8,10 +8,9 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(32,5): error TS2739: Type '(number[] | string[])[]' is missing the following properties from type 'tup': 0, 1
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(33,5): error TS2739: Type 'number[]' is missing the following properties from type '[number, number, number]': 0, 1, 2
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'.
Types of property 'pop' are incompatible.
Type '() => string | number' is not assignable to type '() => Number'.
Type 'string | number' is not assignable to type 'Number'.
Type 'string' is not assignable to type 'Number'.
The types returned by 'pop()' are incompatible between these types.
Type 'string | number' is not assignable to type 'Number'.
Type 'string' is not assignable to type 'Number'.
==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (8 errors) ====
@ -67,8 +66,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
var c2: myArray = [...temp1, ...temp]; // Error cannot assign (number|string)[] to number[]
~~
!!! error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => string | number' is not assignable to type '() => Number'.
!!! error TS2322: Type 'string | number' is not assignable to type 'Number'.
!!! error TS2322: Type 'string' is not assignable to type 'Number'.
!!! error TS2322: The types returned by 'pop()' are incompatible between these types.
!!! error TS2322: Type 'string | number' is not assignable to type 'Number'.
!!! error TS2322: Type 'string' is not assignable to type 'Number'.

View File

@ -1,10 +1,9 @@
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error TS2322: Type 'A[]' is not assignable to type 'readonly B[]'.
Property 'b' is missing in type 'A' but required in type 'B'.
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C<A>' is not assignable to type 'readonly B[]'.
Types of property 'concat' are incompatible.
Type '{ (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray<B>[]): B[]; (...items: (B | ConcatArray<B>)[]): B[]; }'.
Type 'A[]' is not assignable to type 'B[]'.
Type 'A' is not assignable to type 'B'.
The types returned by 'concat(...)' are incompatible between these types.
Type 'A[]' is not assignable to type 'B[]'.
Type 'A' is not assignable to type 'B'.
==== tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts (2 errors) ====
@ -32,8 +31,7 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T
rrb = cra; // error: 'A' is not assignable to 'B'
~~~
!!! error TS2322: Type 'C<A>' is not assignable to type 'readonly B[]'.
!!! error TS2322: Types of property 'concat' are incompatible.
!!! error TS2322: Type '{ (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray<B>[]): B[]; (...items: (B | ConcatArray<B>)[]): B[]; }'.
!!! error TS2322: Type 'A[]' is not assignable to type 'B[]'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.
!!! error TS2322: The types returned by 'concat(...)' are incompatible between these types.
!!! error TS2322: Type 'A[]' is not assignable to type 'B[]'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.

View File

@ -1,7 +1,6 @@
tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(14,1): error TS2322: Type 'NotBoolean' is not assignable to type 'Boolean'.
Types of property 'valueOf' are incompatible.
Type '() => Object' is not assignable to type '() => boolean'.
Type 'Object' is not assignable to type 'boolean'.
The types returned by 'valueOf()' are incompatible between these types.
Type 'Object' is not assignable to type 'boolean'.
tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(19,1): error TS2322: Type 'Boolean' is not assignable to type 'boolean'.
'boolean' is a primitive, but 'Boolean' is a wrapper object. Prefer using 'boolean' when possible.
tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(20,1): error TS2322: Type 'NotBoolean' is not assignable to type 'boolean'.
@ -24,9 +23,8 @@ tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(
a = b;
~
!!! error TS2322: Type 'NotBoolean' is not assignable to type 'Boolean'.
!!! error TS2322: Types of property 'valueOf' are incompatible.
!!! error TS2322: Type '() => Object' is not assignable to type '() => boolean'.
!!! error TS2322: Type 'Object' is not assignable to type 'boolean'.
!!! error TS2322: The types returned by 'valueOf()' are incompatible between these types.
!!! error TS2322: Type 'Object' is not assignable to type 'boolean'.
b = a;
b = x;

View File

@ -5,10 +5,9 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1
tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(8,23): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(9,23): error TS1055: Type 'PromiseLike' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(10,23): error TS1055: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
Type 'Thenable' is not assignable to type 'PromiseLike<T>'.
Types of property 'then' are incompatible.
Type '() => void' is not assignable to type '<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => PromiseLike<TResult1 | TResult2>'.
Type 'void' is not assignable to type 'PromiseLike<TResult1 | TResult2>'.
Construct signature return types 'Thenable' and 'PromiseLike<T>' are incompatible.
The types returned by 'then(...)' are incompatible between these types.
Type 'void' is not assignable to type 'PromiseLike<TResult1 | TResult2>'.
tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(17,16): error TS1058: The return type of an async function must either be a valid promise or must not contain a callable 'then' member.
tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(23,25): error TS1320: Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member.
@ -38,10 +37,9 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1
async function fn6(): Thenable { } // error
~~~~~~~~
!!! error TS1055: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
!!! error TS1055: Type 'Thenable' is not assignable to type 'PromiseLike<T>'.
!!! error TS1055: Types of property 'then' are incompatible.
!!! error TS1055: Type '() => void' is not assignable to type '<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => PromiseLike<TResult1 | TResult2>'.
!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike<TResult1 | TResult2>'.
!!! error TS1055: Construct signature return types 'Thenable' and 'PromiseLike<T>' are incompatible.
!!! error TS1055: The types returned by 'then(...)' are incompatible between these types.
!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike<TResult1 | TResult2>'.
async function fn7() { return; } // valid: Promise<void>
async function fn8() { return 1; } // valid: Promise<number>
async function fn9() { return null; } // valid: Promise<any>

View File

@ -4,15 +4,11 @@ tests/cases/compiler/bigintWithLib.ts(16,33): error TS2769: No overload matches
Argument of type 'number[]' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(array: Iterable<bigint>): BigInt64Array', gave the following error.
Argument of type 'number[]' is not assignable to parameter of type 'Iterable<bigint>'.
Types of property '[Symbol.iterator]' are incompatible.
Type '() => IterableIterator<number>' is not assignable to type '() => Iterator<bigint, any, undefined>'.
Type 'IterableIterator<number>' is not assignable to type 'Iterator<bigint, any, undefined>'.
Types of property 'next' are incompatible.
Type '(...args: [] | [undefined]) => IteratorResult<number, any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<bigint, any>'.
Type 'IteratorResult<number, any>' is not assignable to type 'IteratorResult<bigint, any>'.
Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorResult<bigint, any>'.
Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorYieldResult<bigint>'.
Type 'number' is not assignable to type 'bigint'.
The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
Type 'IteratorResult<number, any>' is not assignable to type 'IteratorResult<bigint, any>'.
Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorResult<bigint, any>'.
Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorYieldResult<bigint>'.
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]
@ -55,15 +51,11 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12
!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'number'.
!!! error TS2769: Overload 2 of 3, '(array: Iterable<bigint>): BigInt64Array', gave the following error.
!!! error TS2769: Argument of type 'number[]' is not assignable to parameter of type 'Iterable<bigint>'.
!!! error TS2769: Types of property '[Symbol.iterator]' are incompatible.
!!! error TS2769: Type '() => IterableIterator<number>' is not assignable to type '() => Iterator<bigint, any, undefined>'.
!!! error TS2769: Type 'IterableIterator<number>' is not assignable to type 'Iterator<bigint, any, undefined>'.
!!! error TS2769: Types of property 'next' are incompatible.
!!! error TS2769: Type '(...args: [] | [undefined]) => IteratorResult<number, any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<bigint, any>'.
!!! error TS2769: Type 'IteratorResult<number, any>' is not assignable to type 'IteratorResult<bigint, any>'.
!!! error TS2769: Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorResult<bigint, any>'.
!!! error TS2769: Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorYieldResult<bigint>'.
!!! error TS2769: Type 'number' is not assignable to type 'bigint'.
!!! error TS2769: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
!!! error TS2769: Type 'IteratorResult<number, any>' is not assignable to type 'IteratorResult<bigint, any>'.
!!! error TS2769: Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorResult<bigint, any>'.
!!! error TS2769: Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorYieldResult<bigint>'.
!!! 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]

View File

@ -1,9 +1,8 @@
tests/cases/compiler/booleanAssignment.ts(2,1): error TS2322: Type '1' is not assignable to type 'Boolean'.
tests/cases/compiler/booleanAssignment.ts(3,1): error TS2322: Type '"a"' is not assignable to type 'Boolean'.
tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not assignable to type 'Boolean'.
Types of property 'valueOf' are incompatible.
Type '() => Object' is not assignable to type '() => boolean'.
Type 'Object' is not assignable to type 'boolean'.
The types returned by 'valueOf()' are incompatible between these types.
Type 'Object' is not assignable to type 'boolean'.
==== tests/cases/compiler/booleanAssignment.ts (3 errors) ====
@ -17,9 +16,8 @@ tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not a
b = {}; // Error
~
!!! error TS2322: Type '{}' is not assignable to type 'Boolean'.
!!! error TS2322: Types of property 'valueOf' are incompatible.
!!! error TS2322: Type '() => Object' is not assignable to type '() => boolean'.
!!! error TS2322: Type 'Object' is not assignable to type 'boolean'.
!!! error TS2322: The types returned by 'valueOf()' are incompatible between these types.
!!! error TS2322: Type 'Object' is not assignable to type 'boolean'.
var o = {};
o = b; // OK

View File

@ -1,12 +1,10 @@
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance.ts(57,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'.
Types of property 'a' are incompatible.
Type '(x: number) => string' is not assignable to type '(x: number) => number'.
Type 'string' is not assignable to type 'number'.
The types returned by 'a(...)' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance.ts(63,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'.
Types of property 'a2' are incompatible.
Type '<T>(x: T) => string' is not assignable to type '<T>(x: T) => T'.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'a2(...)' are incompatible between these types.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance.ts (2 errors) ====
@ -69,9 +67,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign
interface I2 extends Base2 {
~~
!!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type '(x: number) => string' is not assignable to type '(x: number) => number'.
!!! error TS2430: Type 'string' is not assignable to type 'number'.
!!! error TS2430: The types returned by 'a(...)' are incompatible between these types.
!!! error TS2430: Type 'string' is not assignable to type 'number'.
// N's
a: (x: number) => string; // error because base returns non-void;
}
@ -80,10 +77,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign
interface I3 extends Base2 {
~~
!!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a2' are incompatible.
!!! error TS2430: Type '<T>(x: T) => string' is not assignable to type '<T>(x: T) => T'.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'a2(...)' are incompatible between these types.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
// N's
a2: <T>(x: T) => string; // error because base returns non-void;
}

View File

@ -27,16 +27,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign
Types of property 'a' are incompatible.
Type 'string' is not assignable to type 'Base'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(100,19): error TS2430: Interface 'I6' incorrectly extends interface 'B'.
Types of property 'a2' are incompatible.
Type '<T>(x: T) => string[]' is not assignable to type '<T>(x: T) => T[]'.
Type 'string[]' is not assignable to type 'T[]'.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'a2(...)' are incompatible between these types.
Type 'string[]' is not assignable to type 'T[]'.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(109,19): error TS2430: Interface 'I7' incorrectly extends interface 'C'.
Types of property 'a2' are incompatible.
Type '<T>(x: T) => T[]' is not assignable to type '<T>(x: T) => string[]'.
Type 'T[]' is not assignable to type 'string[]'.
Type 'T' is not assignable to type 'string'.
The types returned by 'a2(...)' are incompatible between these types.
Type 'T[]' is not assignable to type 'string[]'.
Type 'T' is not assignable to type 'string'.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts (6 errors) ====
@ -174,11 +172,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign
interface I6 extends B {
~~
!!! error TS2430: Interface 'I6' incorrectly extends interface 'B'.
!!! error TS2430: Types of property 'a2' are incompatible.
!!! error TS2430: Type '<T>(x: T) => string[]' is not assignable to type '<T>(x: T) => T[]'.
!!! error TS2430: Type 'string[]' is not assignable to type 'T[]'.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'a2(...)' are incompatible between these types.
!!! error TS2430: Type 'string[]' is not assignable to type 'T[]'.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a2: <T>(x: T) => string[]; // error
}
@ -190,10 +187,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign
interface I7 extends C {
~~
!!! error TS2430: Interface 'I7' incorrectly extends interface 'C'.
!!! error TS2430: Types of property 'a2' are incompatible.
!!! error TS2430: Type '<T>(x: T) => T[]' is not assignable to type '<T>(x: T) => string[]'.
!!! error TS2430: Type 'T[]' is not assignable to type 'string[]'.
!!! error TS2430: Type 'T' is not assignable to type 'string'.
!!! error TS2430: The types returned by 'a2(...)' are incompatible between these types.
!!! error TS2430: Type 'T[]' is not assignable to type 'string[]'.
!!! error TS2430: Type 'T' is not assignable to type 'string'.
a2: <T>(x: T) => T[]; // error
}
}

View File

@ -1,10 +1,8 @@
tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2769: No overload matches this call.
Overload 1 of 2, '(props: Readonly<ResizablePanelProps>): ResizablePanel', gave the following error.
Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly<ResizablePanelProps>'.
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'.
The types of 'children.length' are incompatible between these types.
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<ResizablePanelProps>'.
Types of property 'children' are incompatible.
@ -33,10 +31,8 @@ tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 2, '(props: Readonly<ResizablePanelProps>): ResizablePanel', gave the following error.
!!! error TS2769: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly<ResizablePanelProps>'.
!!! 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: The types of 'children.length' are incompatible between these types.
!!! 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<ResizablePanelProps>'.
!!! error TS2769: Types of property 'children' are incompatible.

View File

@ -1,18 +1,15 @@
tests/cases/compiler/immutable.ts(341,22): error TS2430: Interface 'Keyed<K, V>' incorrectly extends interface 'Collection<K, V>'.
Types of property 'toSeq' are incompatible.
Type '() => Keyed<K, V>' is not assignable to type '() => this'.
Type 'Keyed<K, V>' is not assignable to type 'this'.
'Keyed<K, V>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed<K, V>'.
The types returned by 'toSeq()' are incompatible between these types.
Type 'Keyed<K, V>' is not assignable to type 'this'.
'Keyed<K, V>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed<K, V>'.
tests/cases/compiler/immutable.ts(359,22): error TS2430: Interface 'Indexed<T>' incorrectly extends interface 'Collection<number, T>'.
Types of property 'toSeq' are incompatible.
Type '() => Indexed<T>' is not assignable to type '() => this'.
Type 'Indexed<T>' is not assignable to type 'this'.
'Indexed<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed<T>'.
The types returned by 'toSeq()' are incompatible between these types.
Type 'Indexed<T>' is not assignable to type 'this'.
'Indexed<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed<T>'.
tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set<T>' incorrectly extends interface 'Collection<never, T>'.
Types of property 'toSeq' are incompatible.
Type '() => Set<T>' is not assignable to type '() => this'.
Type 'Set<T>' is not assignable to type 'this'.
'Set<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set<T>'.
The types returned by 'toSeq()' are incompatible between these types.
Type 'Set<T>' is not assignable to type 'this'.
'Set<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set<T>'.
==== tests/cases/compiler/complex.ts (0 errors) ====
@ -380,10 +377,9 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set<T>' inco
export interface Keyed<K, V> extends Collection<K, V> {
~~~~~
!!! error TS2430: Interface 'Keyed<K, V>' incorrectly extends interface 'Collection<K, V>'.
!!! error TS2430: Types of property 'toSeq' are incompatible.
!!! error TS2430: Type '() => Keyed<K, V>' is not assignable to type '() => this'.
!!! error TS2430: Type 'Keyed<K, V>' is not assignable to type 'this'.
!!! error TS2430: 'Keyed<K, V>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed<K, V>'.
!!! error TS2430: The types returned by 'toSeq()' are incompatible between these types.
!!! error TS2430: Type 'Keyed<K, V>' is not assignable to type 'this'.
!!! error TS2430: 'Keyed<K, V>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed<K, V>'.
toJS(): Object;
toJSON(): { [key: string]: V };
toSeq(): Seq.Keyed<K, V>;
@ -404,10 +400,9 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set<T>' inco
export interface Indexed<T> extends Collection<number, T> {
~~~~~~~
!!! error TS2430: Interface 'Indexed<T>' incorrectly extends interface 'Collection<number, T>'.
!!! error TS2430: Types of property 'toSeq' are incompatible.
!!! error TS2430: Type '() => Indexed<T>' is not assignable to type '() => this'.
!!! error TS2430: Type 'Indexed<T>' is not assignable to type 'this'.
!!! error TS2430: 'Indexed<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed<T>'.
!!! error TS2430: The types returned by 'toSeq()' are incompatible between these types.
!!! error TS2430: Type 'Indexed<T>' is not assignable to type 'this'.
!!! error TS2430: 'Indexed<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed<T>'.
toJS(): Array<any>;
toJSON(): Array<T>;
// Reading values
@ -442,10 +437,9 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set<T>' inco
export interface Set<T> extends Collection<never, T> {
~~~
!!! error TS2430: Interface 'Set<T>' incorrectly extends interface 'Collection<never, T>'.
!!! error TS2430: Types of property 'toSeq' are incompatible.
!!! error TS2430: Type '() => Set<T>' is not assignable to type '() => this'.
!!! error TS2430: Type 'Set<T>' is not assignable to type 'this'.
!!! error TS2430: 'Set<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set<T>'.
!!! error TS2430: The types returned by 'toSeq()' are incompatible between these types.
!!! error TS2430: Type 'Set<T>' is not assignable to type 'this'.
!!! error TS2430: 'Set<T>' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set<T>'.
toJS(): Array<any>;
toJSON(): Array<T>;
toSeq(): Seq.Set<T>;

View File

@ -1,12 +1,10 @@
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance.ts(61,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'.
Types of property 'a' are incompatible.
Type 'new (x: number) => string' is not assignable to type 'new (x: number) => number'.
Type 'string' is not assignable to type 'number'.
The types returned by 'new a(...)' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance.ts(67,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'.
Types of property 'a2' are incompatible.
Type 'new <T>(x: T) => string' is not assignable to type 'new <T>(x: T) => T'.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'new a2(...)' are incompatible between these types.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance.ts (2 errors) ====
@ -73,9 +71,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc
interface I2 extends Base2 {
~~
!!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type 'new (x: number) => string' is not assignable to type 'new (x: number) => number'.
!!! error TS2430: Type 'string' is not assignable to type 'number'.
!!! error TS2430: The types returned by 'new a(...)' are incompatible between these types.
!!! error TS2430: Type 'string' is not assignable to type 'number'.
// N's
a: new (x: number) => string; // error because base returns non-void;
}
@ -84,10 +81,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc
interface I3 extends Base2 {
~~
!!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a2' are incompatible.
!!! error TS2430: Type 'new <T>(x: T) => string' is not assignable to type 'new <T>(x: T) => T'.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'new a2(...)' are incompatible between these types.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
// N's
a2: new <T>(x: T) => string; // error because base returns non-void;
}

View File

@ -27,16 +27,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc
Types of property 'a' are incompatible.
Type 'string' is not assignable to type 'Base'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(86,19): error TS2430: Interface 'I6' incorrectly extends interface 'B'.
Types of property 'a2' are incompatible.
Type 'new <T>(x: T) => string[]' is not assignable to type 'new <T>(x: T) => T[]'.
Type 'string[]' is not assignable to type 'T[]'.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'new a2(...)' are incompatible between these types.
Type 'string[]' is not assignable to type 'T[]'.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(95,19): error TS2430: Interface 'I7' incorrectly extends interface 'C'.
Types of property 'a2' are incompatible.
Type 'new <T>(x: T) => T[]' is not assignable to type 'new <T>(x: T) => string[]'.
Type 'T[]' is not assignable to type 'string[]'.
Type 'T' is not assignable to type 'string'.
The types returned by 'new a2(...)' are incompatible between these types.
Type 'T[]' is not assignable to type 'string[]'.
Type 'T' is not assignable to type 'string'.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts (6 errors) ====
@ -160,11 +158,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc
interface I6 extends B {
~~
!!! error TS2430: Interface 'I6' incorrectly extends interface 'B'.
!!! error TS2430: Types of property 'a2' are incompatible.
!!! error TS2430: Type 'new <T>(x: T) => string[]' is not assignable to type 'new <T>(x: T) => T[]'.
!!! error TS2430: Type 'string[]' is not assignable to type 'T[]'.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'new a2(...)' are incompatible between these types.
!!! error TS2430: Type 'string[]' is not assignable to type 'T[]'.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a2: new <T>(x: T) => string[]; // error
}
@ -176,10 +173,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc
interface I7 extends C {
~~
!!! error TS2430: Interface 'I7' incorrectly extends interface 'C'.
!!! error TS2430: Types of property 'a2' are incompatible.
!!! error TS2430: Type 'new <T>(x: T) => T[]' is not assignable to type 'new <T>(x: T) => string[]'.
!!! error TS2430: Type 'T[]' is not assignable to type 'string[]'.
!!! error TS2430: Type 'T' is not assignable to type 'string'.
!!! error TS2430: The types returned by 'new a2(...)' are incompatible between these types.
!!! error TS2430: Type 'T[]' is not assignable to type 'string[]'.
!!! error TS2430: Type 'T' is not assignable to type 'string'.
a2: new <T>(x: T) => T[]; // error
}

View File

@ -10,9 +10,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covarian
Type 'A' is not assignable to type 'B'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts(43,5): error TS2322: Type 'AList2' is not assignable to type 'BList2'.
Types of property 'forEach' are incompatible.
Type '(cb: (item: A) => boolean) => void' is not assignable to type '(cb: (item: A) => void) => void'.
Types of parameters 'cb' and 'cb' are incompatible.
Type 'void' is not assignable to type 'boolean'.
Types of parameters 'cb' and 'cb' are incompatible.
Type 'void' is not assignable to type 'boolean'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts(56,5): error TS2322: Type 'AList3' is not assignable to type 'BList3'.
Types of property 'forEach' are incompatible.
Type '(cb: (item: A) => void) => void' is not assignable to type '(cb: (item: A, context: any) => void) => void'.
@ -86,9 +85,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covarian
~
!!! error TS2322: Type 'AList2' is not assignable to type 'BList2'.
!!! error TS2322: Types of property 'forEach' are incompatible.
!!! error TS2322: Type '(cb: (item: A) => boolean) => void' is not assignable to type '(cb: (item: A) => void) => void'.
!!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible.
!!! error TS2322: Type 'void' is not assignable to type 'boolean'.
!!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible.
!!! error TS2322: Type 'void' is not assignable to type 'boolean'.
}
interface AList3 {

View File

@ -1,7 +1,6 @@
tests/cases/conformance/decorators/decoratorCallGeneric.ts(7,2): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type 'I<C>'.
Types of property 'm' are incompatible.
Type '() => void' is not assignable to type '() => C'.
Type 'void' is not assignable to type 'C'.
The types returned by 'm()' are incompatible between these types.
Type 'void' is not assignable to type 'C'.
==== tests/cases/conformance/decorators/decoratorCallGeneric.ts (1 errors) ====
@ -14,9 +13,8 @@ tests/cases/conformance/decorators/decoratorCallGeneric.ts(7,2): error TS2345: A
@dec
~~~
!!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type 'I<C>'.
!!! error TS2345: Types of property 'm' are incompatible.
!!! error TS2345: Type '() => void' is not assignable to type '() => C'.
!!! error TS2345: Type 'void' is not assignable to type 'C'.
!!! error TS2345: The types returned by 'm()' are incompatible between these types.
!!! error TS2345: Type 'void' is not assignable to type 'C'.
class C {
_brand: any;
static m() {}

View File

@ -1,10 +1,8 @@
tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts(21,33): error TS2322: Type '{ INVALID_PROP_NAME: string; ariaLabel: string; }' is not assignable to type 'ITestProps'.
Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'.
tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts(27,34): error TS2326: Types of property 'icon' are incompatible.
Type '{ props: { INVALID_PROP_NAME: string; ariaLabel: string; }; }' is not assignable to type 'NestedProp<ITestProps>'.
Types of property 'props' are incompatible.
Type '{ INVALID_PROP_NAME: string; ariaLabel: string; }' is not assignable to type 'ITestProps'.
Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'.
tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts(27,34): error TS2200: The types of 'icon.props' are incompatible between these types.
Type '{ INVALID_PROP_NAME: string; ariaLabel: string; }' is not assignable to type 'ITestProps'.
Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'.
==== tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts (2 errors) ====
@ -40,9 +38,7 @@ tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts(27,34
TestComponent2({icon: { props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } }});
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2326: Types of property 'icon' are incompatible.
!!! error TS2326: Type '{ props: { INVALID_PROP_NAME: string; ariaLabel: string; }; }' is not assignable to type 'NestedProp<ITestProps>'.
!!! error TS2326: Types of property 'props' are incompatible.
!!! error TS2326: Type '{ INVALID_PROP_NAME: string; ariaLabel: string; }' is not assignable to type 'ITestProps'.
!!! error TS2326: Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'.
!!! error TS2200: The types of 'icon.props' are incompatible between these types.
!!! error TS2200: Type '{ INVALID_PROP_NAME: string; ariaLabel: string; }' is not assignable to type 'ITestProps'.
!!! error TS2200: Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'.

View File

@ -0,0 +1,32 @@
tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts(3,1): error TS2322: Type '{ a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }; }'.
The types of 'a.b.c.d.e.f().g' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts(15,1): error TS2322: Type '{ a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }; }'.
The types of '(new a.b.c.d.e.f()).g' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
==== tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts (2 errors) ====
let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } };
let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } };
x = y;
~
!!! error TS2322: Type '{ a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }; }'.
!!! error TS2322: The types of 'a.b.c.d.e.f().g' are incompatible between these types.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
class Ctor1 {
g = "ok"
}
class Ctor2 {
g = 12;
}
let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } };
let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } };
x2 = y2;
~~
!!! error TS2322: Type '{ a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; }' is not assignable to type '{ a: { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }; }'.
!!! error TS2322: The types of '(new a.b.c.d.e.f()).g' are incompatible between these types.
!!! error TS2322: Type 'number' is not assignable to type 'string'.

View File

@ -0,0 +1,36 @@
//// [deeplyNestedAssignabilityErrorsCombined.ts]
let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } };
let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } };
x = y;
class Ctor1 {
g = "ok"
}
class Ctor2 {
g = 12;
}
let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } };
let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } };
x2 = y2;
//// [deeplyNestedAssignabilityErrorsCombined.js]
var x = { a: { b: { c: { d: { e: { f: function () { return { g: "hello" }; } } } } } } };
var y = { a: { b: { c: { d: { e: { f: function () { return { g: 12345 }; } } } } } } };
x = y;
var Ctor1 = /** @class */ (function () {
function Ctor1() {
this.g = "ok";
}
return Ctor1;
}());
var Ctor2 = /** @class */ (function () {
function Ctor2() {
this.g = 12;
}
return Ctor2;
}());
var x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } };
var y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } };
x2 = y2;

View File

@ -0,0 +1,63 @@
=== tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts ===
let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } };
>x : Symbol(x, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 3))
>a : Symbol(a, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 9))
>b : Symbol(b, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 14))
>c : Symbol(c, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 19))
>d : Symbol(d, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 24))
>e : Symbol(e, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 29))
>f : Symbol(f, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 34))
>g : Symbol(g, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 49))
let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } };
>y : Symbol(y, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 3))
>a : Symbol(a, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 9))
>b : Symbol(b, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 14))
>c : Symbol(c, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 19))
>d : Symbol(d, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 24))
>e : Symbol(e, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 29))
>f : Symbol(f, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 34))
>g : Symbol(g, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 49))
x = y;
>x : Symbol(x, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 0, 3))
>y : Symbol(y, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 1, 3))
class Ctor1 {
>Ctor1 : Symbol(Ctor1, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 2, 6))
g = "ok"
>g : Symbol(Ctor1.g, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 4, 13))
}
class Ctor2 {
>Ctor2 : Symbol(Ctor2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 6, 1))
g = 12;
>g : Symbol(Ctor2.g, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 8, 13))
}
let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } };
>x2 : Symbol(x2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 3))
>a : Symbol(a, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 10))
>b : Symbol(b, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 15))
>c : Symbol(c, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 20))
>d : Symbol(d, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 25))
>e : Symbol(e, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 30))
>f : Symbol(f, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 35))
>Ctor1 : Symbol(Ctor1, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 2, 6))
let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } };
>y2 : Symbol(y2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 3))
>a : Symbol(a, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 10))
>b : Symbol(b, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 15))
>c : Symbol(c, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 20))
>d : Symbol(d, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 25))
>e : Symbol(e, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 30))
>f : Symbol(f, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 35))
>Ctor2 : Symbol(Ctor2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 6, 1))
x2 = y2;
>x2 : Symbol(x2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 12, 3))
>y2 : Symbol(y2, Decl(deeplyNestedAssignabilityErrorsCombined.ts, 13, 3))

View File

@ -0,0 +1,95 @@
=== tests/cases/compiler/deeplyNestedAssignabilityErrorsCombined.ts ===
let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } };
>x : { a: { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }; }
>{ a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } } : { a: { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }; }
>a : { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }
>{ b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } : { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }
>b : { c: { d: { e: { f(): { g: string; }; }; }; }; }
>{ c: { d: { e: { f() { return { g: "hello" }; } } } } } : { c: { d: { e: { f(): { g: string; }; }; }; }; }
>c : { d: { e: { f(): { g: string; }; }; }; }
>{ d: { e: { f() { return { g: "hello" }; } } } } : { d: { e: { f(): { g: string; }; }; }; }
>d : { e: { f(): { g: string; }; }; }
>{ e: { f() { return { g: "hello" }; } } } : { e: { f(): { g: string; }; }; }
>e : { f(): { g: string; }; }
>{ f() { return { g: "hello" }; } } : { f(): { g: string; }; }
>f : () => { g: string; }
>{ g: "hello" } : { g: string; }
>g : string
>"hello" : "hello"
let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } };
>y : { a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; }
>{ a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } } : { a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; }
>a : { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }
>{ b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } : { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }
>b : { c: { d: { e: { f(): { g: number; }; }; }; }; }
>{ c: { d: { e: { f() { return { g: 12345 }; } } } } } : { c: { d: { e: { f(): { g: number; }; }; }; }; }
>c : { d: { e: { f(): { g: number; }; }; }; }
>{ d: { e: { f() { return { g: 12345 }; } } } } : { d: { e: { f(): { g: number; }; }; }; }
>d : { e: { f(): { g: number; }; }; }
>{ e: { f() { return { g: 12345 }; } } } : { e: { f(): { g: number; }; }; }
>e : { f(): { g: number; }; }
>{ f() { return { g: 12345 }; } } : { f(): { g: number; }; }
>f : () => { g: number; }
>{ g: 12345 } : { g: number; }
>g : number
>12345 : 12345
x = y;
>x = y : { a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; }
>x : { a: { b: { c: { d: { e: { f(): { g: string; }; }; }; }; }; }; }
>y : { a: { b: { c: { d: { e: { f(): { g: number; }; }; }; }; }; }; }
class Ctor1 {
>Ctor1 : Ctor1
g = "ok"
>g : string
>"ok" : "ok"
}
class Ctor2 {
>Ctor2 : Ctor2
g = 12;
>g : number
>12 : 12
}
let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } };
>x2 : { a: { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }; }
>{ a: { b: { c: { d: { e: { f: Ctor1 } } } } } } : { a: { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }; }
>a : { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }
>{ b: { c: { d: { e: { f: Ctor1 } } } } } : { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }
>b : { c: { d: { e: { f: typeof Ctor1; }; }; }; }
>{ c: { d: { e: { f: Ctor1 } } } } : { c: { d: { e: { f: typeof Ctor1; }; }; }; }
>c : { d: { e: { f: typeof Ctor1; }; }; }
>{ d: { e: { f: Ctor1 } } } : { d: { e: { f: typeof Ctor1; }; }; }
>d : { e: { f: typeof Ctor1; }; }
>{ e: { f: Ctor1 } } : { e: { f: typeof Ctor1; }; }
>e : { f: typeof Ctor1; }
>{ f: Ctor1 } : { f: typeof Ctor1; }
>f : typeof Ctor1
>Ctor1 : typeof Ctor1
let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } };
>y2 : { a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; }
>{ a: { b: { c: { d: { e: { f: Ctor2 } } } } } } : { a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; }
>a : { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }
>{ b: { c: { d: { e: { f: Ctor2 } } } } } : { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }
>b : { c: { d: { e: { f: typeof Ctor2; }; }; }; }
>{ c: { d: { e: { f: Ctor2 } } } } : { c: { d: { e: { f: typeof Ctor2; }; }; }; }
>c : { d: { e: { f: typeof Ctor2; }; }; }
>{ d: { e: { f: Ctor2 } } } : { d: { e: { f: typeof Ctor2; }; }; }
>d : { e: { f: typeof Ctor2; }; }
>{ e: { f: Ctor2 } } : { e: { f: typeof Ctor2; }; }
>e : { f: typeof Ctor2; }
>{ f: Ctor2 } : { f: typeof Ctor2; }
>f : typeof Ctor2
>Ctor2 : typeof Ctor2
x2 = y2;
>x2 = y2 : { a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; }
>x2 : { a: { b: { c: { d: { e: { f: typeof Ctor1; }; }; }; }; }; }
>y2 : { a: { b: { c: { d: { e: { f: typeof Ctor2; }; }; }; }; }; }

View File

@ -1,9 +1,7 @@
tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(4,1): error TS2322: Type '{ foo: { bar: number | undefined; }; }' is not assignable to type '{ foo: { bar: string | null; } | undefined; }'.
Types of property 'foo' are incompatible.
Type '{ bar: number | undefined; }' is not assignable to type '{ bar: string | null; }'.
Types of property 'bar' are incompatible.
Type 'number | undefined' is not assignable to type 'string | null'.
Type 'undefined' is not assignable to type 'string | null'.
The types of 'foo.bar' are incompatible between these types.
Type 'number | undefined' is not assignable to type 'string | null'.
Type 'undefined' is not assignable to type 'string | null'.
tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(6,1): error TS2322: Type '{ foo: { bar: string | null; } | undefined; } | null | undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'.
Type 'undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'.
@ -15,11 +13,9 @@ tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(6,1): error TS2322:
x = y;
~
!!! error TS2322: Type '{ foo: { bar: number | undefined; }; }' is not assignable to type '{ foo: { bar: string | null; } | undefined; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type '{ bar: number | undefined; }' is not assignable to type '{ bar: string | null; }'.
!!! error TS2322: Types of property 'bar' are incompatible.
!!! error TS2322: Type 'number | undefined' is not assignable to type 'string | null'.
!!! error TS2322: Type 'undefined' is not assignable to type 'string | null'.
!!! error TS2322: The types of 'foo.bar' are incompatible between these types.
!!! error TS2322: Type 'number | undefined' is not assignable to type 'string | null'.
!!! error TS2322: Type 'undefined' is not assignable to type 'string | null'.
y = x;
~

View File

@ -17,9 +17,8 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(48,32): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(50,5): error TS2322: Type 'typeof N' is not assignable to type 'typeof M'.
Types of property 'A' are incompatible.
Type 'typeof N.A' is not assignable to type 'typeof M.A'.
Property 'name' is missing in type 'N.A' but required in type 'M.A'.
The types returned by 'new A()' are incompatible between these types.
Property 'name' is missing in type 'N.A' but required in type 'M.A'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(51,5): error TS2322: Type 'N.A' is not assignable to type 'M.A'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'.
Type 'boolean' is not assignable to type 'string'.
@ -112,9 +111,8 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd
var aModule: typeof M = N;
~~~~~~~
!!! error TS2322: Type 'typeof N' is not assignable to type 'typeof M'.
!!! error TS2322: Types of property 'A' are incompatible.
!!! error TS2322: Type 'typeof N.A' is not assignable to type 'typeof M.A'.
!!! error TS2322: Property 'name' is missing in type 'N.A' but required in type 'M.A'.
!!! error TS2322: The types returned by 'new A()' are incompatible between these types.
!!! error TS2322: Property 'name' is missing in type 'N.A' but required in type 'M.A'.
!!! related TS2728 tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts:20:9: 'name' is declared here.
var aClassInModule: M.A = new N.A();
~~~~~~~~~~~~~~

View File

@ -1,7 +1,6 @@
tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(7,7): error TS2720: Class 'D' incorrectly implements class 'C<number>'. Did you mean to extend 'C<number>' and inherit its members as a subclass?
Types of property 'bar' are incompatible.
Type '() => string' is not assignable to type '() => number'.
Type 'string' is not assignable to type 'number'.
The types returned by 'bar()' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(12,5): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(16,5): error TS2322: Type 'string' is not assignable to type 'number'.
@ -16,9 +15,8 @@ tests/cases/compiler/extendAndImplementTheSameBaseType2.ts(16,5): error TS2322:
class D extends C<string> implements C<number> {
~
!!! error TS2720: Class 'D' incorrectly implements class 'C<number>'. Did you mean to extend 'C<number>' and inherit its members as a subclass?
!!! error TS2720: Types of property 'bar' are incompatible.
!!! error TS2720: Type '() => string' is not assignable to type '() => number'.
!!! error TS2720: Type 'string' is not assignable to type 'number'.
!!! error TS2720: The types returned by 'bar()' are incompatible between these types.
!!! error TS2720: Type 'string' is not assignable to type 'number'.
baz() { }
}

View File

@ -1,18 +1,14 @@
tests/cases/conformance/es6/for-ofStatements/for-of39.ts(1,11): error TS2769: No overload matches this call.
Overload 1 of 3, '(iterable: Iterable<readonly [string, boolean]>): Map<string, boolean>', gave the following error.
Argument of type '([string, number] | [string, true])[]' is not assignable to parameter of type 'Iterable<readonly [string, boolean]>'.
Types of property '[Symbol.iterator]' are incompatible.
Type '() => IterableIterator<[string, number] | [string, true]>' is not assignable to type '() => Iterator<readonly [string, boolean], any, undefined>'.
Type 'IterableIterator<[string, number] | [string, true]>' is not assignable to type 'Iterator<readonly [string, boolean], any, undefined>'.
Types of property 'next' are incompatible.
Type '(...args: [] | [undefined]) => IteratorResult<[string, number] | [string, true], any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<readonly [string, boolean], any>'.
Type 'IteratorResult<[string, number] | [string, true], any>' is not assignable to type 'IteratorResult<readonly [string, boolean], any>'.
Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult<readonly [string, boolean], any>'.
Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult<readonly [string, boolean]>'.
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'.
The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
Type 'IteratorResult<[string, number] | [string, true], any>' is not assignable to type 'IteratorResult<readonly [string, boolean], any>'.
Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult<readonly [string, boolean], any>'.
Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult<readonly [string, boolean]>'.
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<string, boolean>', gave the following error.
Type 'number' is not assignable to type 'boolean'.
@ -23,18 +19,14 @@ tests/cases/conformance/es6/for-ofStatements/for-of39.ts(1,11): error TS2769: No
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 3, '(iterable: Iterable<readonly [string, boolean]>): Map<string, boolean>', gave the following error.
!!! error TS2769: Argument of type '([string, number] | [string, true])[]' is not assignable to parameter of type 'Iterable<readonly [string, boolean]>'.
!!! error TS2769: Types of property '[Symbol.iterator]' are incompatible.
!!! error TS2769: Type '() => IterableIterator<[string, number] | [string, true]>' is not assignable to type '() => Iterator<readonly [string, boolean], any, undefined>'.
!!! error TS2769: Type 'IterableIterator<[string, number] | [string, true]>' is not assignable to type 'Iterator<readonly [string, boolean], any, undefined>'.
!!! 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<readonly [string, boolean], any>'.
!!! error TS2769: Type 'IteratorResult<[string, number] | [string, true], any>' is not assignable to type 'IteratorResult<readonly [string, boolean], any>'.
!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult<readonly [string, boolean], any>'.
!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult<readonly [string, boolean]>'.
!!! 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: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
!!! error TS2769: Type 'IteratorResult<[string, number] | [string, true], any>' is not assignable to type 'IteratorResult<readonly [string, boolean], any>'.
!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorResult<readonly [string, boolean], any>'.
!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult<readonly [string, boolean]>'.
!!! 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<string, boolean>', gave the following error.
!!! error TS2769: Type 'number' is not assignable to type 'boolean'.
for (var [k, v] of map) {

View File

@ -1,15 +1,11 @@
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck25.ts(4,5): error TS2322: Type '() => Generator<Bar | Baz, void, undefined>' is not assignable to type '() => Iterable<Foo>'.
Type 'Generator<Bar | Baz, void, undefined>' is not assignable to type 'Iterable<Foo>'.
Types of property '[Symbol.iterator]' are incompatible.
Type '() => Generator<Bar | Baz, void, undefined>' is not assignable to type '() => Iterator<Foo, any, undefined>'.
Type 'Generator<Bar | Baz, void, undefined>' is not assignable to type 'Iterator<Foo, any, undefined>'.
Types of property 'next' are incompatible.
Type '(...args: [] | [undefined]) => IteratorResult<Bar | Baz, void>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<Foo, any>'.
Type 'IteratorResult<Bar | Baz, void>' is not assignable to type 'IteratorResult<Foo, any>'.
Type 'IteratorYieldResult<Bar | Baz>' is not assignable to type 'IteratorResult<Foo, any>'.
Type 'IteratorYieldResult<Bar | Baz>' is not assignable to type 'IteratorYieldResult<Foo>'.
Type 'Bar | Baz' is not assignable to type 'Foo'.
Property 'x' is missing in type 'Baz' but required in type 'Foo'.
Call signature return types 'Generator<Bar | Baz, void, undefined>' and 'Iterable<Foo>' are incompatible.
The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
Type 'IteratorResult<Bar | Baz, void>' is not assignable to type 'IteratorResult<Foo, any>'.
Type 'IteratorYieldResult<Bar | Baz>' is not assignable to type 'IteratorResult<Foo, any>'.
Type 'IteratorYieldResult<Bar | Baz>' is not assignable to type 'IteratorYieldResult<Foo>'.
Type 'Bar | Baz' is not assignable to type 'Foo'.
Property 'x' is missing in type 'Baz' but required in type 'Foo'.
==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck25.ts (1 errors) ====
@ -19,17 +15,13 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck25.ts(4,5): error
var g3: () => Iterable<Foo> = function* () {
~~
!!! error TS2322: Type '() => Generator<Bar | Baz, void, undefined>' is not assignable to type '() => Iterable<Foo>'.
!!! error TS2322: Type 'Generator<Bar | Baz, void, undefined>' is not assignable to type 'Iterable<Foo>'.
!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible.
!!! error TS2322: Type '() => Generator<Bar | Baz, void, undefined>' is not assignable to type '() => Iterator<Foo, any, undefined>'.
!!! error TS2322: Type 'Generator<Bar | Baz, void, undefined>' is not assignable to type 'Iterator<Foo, any, undefined>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '(...args: [] | [undefined]) => IteratorResult<Bar | Baz, void>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<Foo, any>'.
!!! error TS2322: Type 'IteratorResult<Bar | Baz, void>' is not assignable to type 'IteratorResult<Foo, any>'.
!!! error TS2322: Type 'IteratorYieldResult<Bar | Baz>' is not assignable to type 'IteratorResult<Foo, any>'.
!!! error TS2322: Type 'IteratorYieldResult<Bar | Baz>' is not assignable to type 'IteratorYieldResult<Foo>'.
!!! error TS2322: Type 'Bar | Baz' is not assignable to type 'Foo'.
!!! error TS2322: Property 'x' is missing in type 'Baz' but required in type 'Foo'.
!!! error TS2322: Call signature return types 'Generator<Bar | Baz, void, undefined>' and 'Iterable<Foo>' are incompatible.
!!! error TS2322: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
!!! error TS2322: Type 'IteratorResult<Bar | Baz, void>' is not assignable to type 'IteratorResult<Foo, any>'.
!!! error TS2322: Type 'IteratorYieldResult<Bar | Baz>' is not assignable to type 'IteratorResult<Foo, any>'.
!!! error TS2322: Type 'IteratorYieldResult<Bar | Baz>' is not assignable to type 'IteratorYieldResult<Foo>'.
!!! error TS2322: Type 'Bar | Baz' is not assignable to type 'Foo'.
!!! error TS2322: Property 'x' is missing in type 'Baz' but required in type 'Foo'.
!!! related TS2728 tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck25.ts:1:13: 'x' is declared here.
yield;
yield new Bar;

View File

@ -1,11 +1,10 @@
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(24,61): error TS2345: Argument of type '(state: State) => Generator<number, State, undefined>' is not assignable to parameter of type '(a: State) => IterableIterator<State>'.
Type 'Generator<number, State, undefined>' is not assignable to type 'IterableIterator<State>'.
Types of property 'next' are incompatible.
Type '(...args: [] | [undefined]) => IteratorResult<number, State>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<State, any>'.
Type 'IteratorResult<number, State>' is not assignable to type 'IteratorResult<State, any>'.
Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorResult<State, any>'.
Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorYieldResult<State>'.
Type 'number' is not assignable to type 'State'.
Call signature return types 'Generator<number, State, undefined>' and 'IterableIterator<State>' are incompatible.
The types returned by 'next(...)' are incompatible between these types.
Type 'IteratorResult<number, State>' is not assignable to type 'IteratorResult<State, any>'.
Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorResult<State, any>'.
Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorYieldResult<State>'.
Type 'number' is not assignable to type 'State'.
==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts (1 errors) ====
@ -35,13 +34,12 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(24,61): err
export const Nothing: Strategy<State> = strategy("Nothing", function* (state: State) {
~~~~~~~~
!!! error TS2345: Argument of type '(state: State) => Generator<number, State, undefined>' is not assignable to parameter of type '(a: State) => IterableIterator<State>'.
!!! error TS2345: Type 'Generator<number, State, undefined>' is not assignable to type 'IterableIterator<State>'.
!!! error TS2345: Types of property 'next' are incompatible.
!!! error TS2345: Type '(...args: [] | [undefined]) => IteratorResult<number, State>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<State, any>'.
!!! error TS2345: Type 'IteratorResult<number, State>' is not assignable to type 'IteratorResult<State, any>'.
!!! error TS2345: Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorResult<State, any>'.
!!! error TS2345: Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorYieldResult<State>'.
!!! error TS2345: Type 'number' is not assignable to type 'State'.
!!! error TS2345: Call signature return types 'Generator<number, State, undefined>' and 'IterableIterator<State>' are incompatible.
!!! error TS2345: The types returned by 'next(...)' are incompatible between these types.
!!! error TS2345: Type 'IteratorResult<number, State>' is not assignable to type 'IteratorResult<State, any>'.
!!! error TS2345: Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorResult<State, any>'.
!!! error TS2345: Type 'IteratorYieldResult<number>' is not assignable to type 'IteratorYieldResult<State>'.
!!! error TS2345: Type 'number' is not assignable to type 'State'.
yield 1;
return state;
});

View File

@ -1,10 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck8.ts(2,17): error TS2322: Type 'Generator<string, any, undefined>' is not assignable to type 'BadGenerator'.
Types of property 'next' are incompatible.
Type '(...args: [] | [undefined]) => IteratorResult<string, any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<number, any>'.
Type 'IteratorResult<string, any>' is not assignable to type 'IteratorResult<number, any>'.
Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorResult<number, any>'.
Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorYieldResult<number>'.
Type 'string' is not assignable to type 'number'.
The types returned by 'next(...)' are incompatible between these types.
Type 'IteratorResult<string, any>' is not assignable to type 'IteratorResult<number, any>'.
Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorResult<number, any>'.
Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorYieldResult<number>'.
Type 'string' is not assignable to type 'number'.
==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck8.ts (1 errors) ====
@ -12,9 +11,8 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck8.ts(2,17): error
function* g3(): BadGenerator { }
~~~~~~~~~~~~
!!! error TS2322: Type 'Generator<string, any, undefined>' is not assignable to type 'BadGenerator'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '(...args: [] | [undefined]) => IteratorResult<string, any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<number, any>'.
!!! error TS2322: Type 'IteratorResult<string, any>' is not assignable to type 'IteratorResult<number, any>'.
!!! error TS2322: Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorResult<number, any>'.
!!! error TS2322: Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorYieldResult<number>'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
!!! error TS2322: The types returned by 'next(...)' are incompatible between these types.
!!! error TS2322: Type 'IteratorResult<string, any>' is not assignable to type 'IteratorResult<number, any>'.
!!! error TS2322: Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorResult<number, any>'.
!!! error TS2322: Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorYieldResult<number>'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.

View File

@ -1,8 +1,7 @@
tests/cases/compiler/generics4.ts(7,1): error TS2322: Type 'C<Y>' is not assignable to type 'C<X>'.
Type 'Y' is not assignable to type 'X'.
Types of property 'f' are incompatible.
Type '() => boolean' is not assignable to type '() => string'.
Type 'boolean' is not assignable to type 'string'.
The types returned by 'f()' are incompatible between these types.
Type 'boolean' is not assignable to type 'string'.
==== tests/cases/compiler/generics4.ts (1 errors) ====
@ -16,6 +15,5 @@ tests/cases/compiler/generics4.ts(7,1): error TS2322: Type 'C<Y>' is not assigna
~
!!! error TS2322: Type 'C<Y>' is not assignable to type 'C<X>'.
!!! error TS2322: Type 'Y' is not assignable to type 'X'.
!!! error TS2322: Types of property 'f' are incompatible.
!!! error TS2322: Type '() => boolean' is not assignable to type '() => string'.
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
!!! error TS2322: The types returned by 'f()' are incompatible between these types.
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.

View File

@ -12,14 +12,12 @@ tests/cases/compiler/incompatibleTypes.ts(34,12): error TS2416: Property 'p1' in
tests/cases/compiler/incompatibleTypes.ts(42,5): 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'.
The types returned by 'p1()' are incompatible between these types.
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'.
The types returned by 'p1(...)' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/incompatibleTypes.ts(49,7): 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; }'.
@ -95,14 +93,12 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) =>
!!! 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: The types returned by 'p1()' are incompatible between these types.
!!! 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'.
!!! error TS2769: The types returned by 'p1(...)' are incompatible between these types.
!!! error TS2769: Type 'string' is not assignable to type 'number'.
function of1(n: { a: { a: string; }; b: string; }): number;

View File

@ -1,7 +1,6 @@
tests/cases/compiler/inheritedModuleMembersForClodule.ts(7,7): error TS2417: Class static side 'typeof D' incorrectly extends base class static side 'typeof C'.
Types of property 'foo' are incompatible.
Type '() => number' is not assignable to type '() => string'.
Type 'number' is not assignable to type 'string'.
The types returned by 'foo()' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
==== tests/cases/compiler/inheritedModuleMembersForClodule.ts (1 errors) ====
@ -14,9 +13,8 @@ tests/cases/compiler/inheritedModuleMembersForClodule.ts(7,7): error TS2417: Cla
class D extends C {
~
!!! error TS2417: Class static side 'typeof D' incorrectly extends base class static side 'typeof C'.
!!! error TS2417: Types of property 'foo' are incompatible.
!!! error TS2417: Type '() => number' is not assignable to type '() => string'.
!!! error TS2417: Type 'number' is not assignable to type 'string'.
!!! error TS2417: The types returned by 'foo()' are incompatible between these types.
!!! error TS2417: Type 'number' is not assignable to type 'string'.
}
module D {

View File

@ -1,8 +1,6 @@
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatHidesBaseProperty2.ts(5,11): error TS2430: Interface 'Derived' incorrectly extends interface 'Base'.
Types of property 'x' are incompatible.
Type '{ a: string; }' is not assignable to type '{ a: number; }'.
Types of property 'a' are incompatible.
Type 'string' is not assignable to type 'number'.
The types of 'x.a' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatHidesBaseProperty2.ts (1 errors) ====
@ -13,10 +11,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatHidesBaseP
interface Derived extends Base { // error
~~~~~~~
!!! error TS2430: Interface 'Derived' incorrectly extends interface 'Base'.
!!! error TS2430: Types of property 'x' are incompatible.
!!! error TS2430: Type '{ a: string; }' is not assignable to type '{ a: number; }'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type 'string' is not assignable to type 'number'.
!!! error TS2430: The types of 'x.a' are incompatible between these types.
!!! error TS2430: Type 'string' is not assignable to type 'number'.
x: {
a: string;
};

View File

@ -1,20 +1,14 @@
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(21,11): error TS2430: Interface 'Derived2' incorrectly extends interface 'Base2'.
Types of property 'x' are incompatible.
Type '{ a: string; b: number; }' is not assignable to type '{ b: string; }'.
Types of property 'b' are incompatible.
Type 'number' is not assignable to type 'string'.
The types of 'x.b' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(52,15): error TS2320: Interface 'Derived3<T>' cannot simultaneously extend types 'Base1<number>' and 'Base2<number>'.
Named property 'x' of types 'Base1<number>' and 'Base2<number>' are not identical.
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4<T>' incorrectly extends interface 'Base1<number>'.
Types of property 'x' are incompatible.
Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }'.
Types of property 'a' are incompatible.
Type 'T' is not assignable to type 'number'.
The types of 'x.a' are incompatible between these types.
Type 'T' is not assignable to type 'number'.
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4<T>' incorrectly extends interface 'Base2<number>'.
Types of property 'x' are incompatible.
Type '{ a: T; b: T; }' is not assignable to type '{ b: number; }'.
Types of property 'b' are incompatible.
Type 'T' is not assignable to type 'number'.
The types of 'x.b' are incompatible between these types.
Type 'T' is not assignable to type 'number'.
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(60,15): error TS2430: Interface 'Derived5<T>' incorrectly extends interface 'Base1<T>'.
Types of property 'x' are incompatible.
Type 'T' is not assignable to type '{ a: T; }'.
@ -47,10 +41,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa
interface Derived2 extends Base1, Base2 { // error
~~~~~~~~
!!! error TS2430: Interface 'Derived2' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'x' are incompatible.
!!! error TS2430: Type '{ a: string; b: number; }' is not assignable to type '{ b: string; }'.
!!! error TS2430: Types of property 'b' are incompatible.
!!! error TS2430: Type 'number' is not assignable to type 'string'.
!!! error TS2430: The types of 'x.b' are incompatible between these types.
!!! error TS2430: Type 'number' is not assignable to type 'string'.
x: {
a: string; b: number;
}
@ -89,16 +81,12 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa
interface Derived4<T> extends Base1<number>, Base2<number> { // error
~~~~~~~~
!!! error TS2430: Interface 'Derived4<T>' incorrectly extends interface 'Base1<number>'.
!!! error TS2430: Types of property 'x' are incompatible.
!!! error TS2430: Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type 'T' is not assignable to type 'number'.
!!! error TS2430: The types of 'x.a' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'number'.
~~~~~~~~
!!! error TS2430: Interface 'Derived4<T>' incorrectly extends interface 'Base2<number>'.
!!! error TS2430: Types of property 'x' are incompatible.
!!! error TS2430: Type '{ a: T; b: T; }' is not assignable to type '{ b: number; }'.
!!! error TS2430: Types of property 'b' are incompatible.
!!! error TS2430: Type 'T' is not assignable to type 'number'.
!!! error TS2430: The types of 'x.b' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'number'.
x: {
a: T; b: T;
}

View File

@ -1,8 +1,6 @@
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes2.ts(17,11): error TS2430: Interface 'Derived2' incorrectly extends interface 'Base'.
Types of property 'x' are incompatible.
Type '{ a: number; b: string; }' is not assignable to type '{ a?: string; b: string; }'.
Types of property 'a' are incompatible.
Type 'number' is not assignable to type 'string'.
The types of 'x.a' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes2.ts (1 errors) ====
@ -25,10 +23,8 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa
interface Derived2 extends Base, Base2 { // error
~~~~~~~~
!!! error TS2430: Interface 'Derived2' incorrectly extends interface 'Base'.
!!! error TS2430: Types of property 'x' are incompatible.
!!! error TS2430: Type '{ a: number; b: string; }' is not assignable to type '{ a?: string; b: string; }'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type 'number' is not assignable to type 'string'.
!!! error TS2430: The types of 'x.a' are incompatible between these types.
!!! error TS2430: Type 'number' is not assignable to type 'string'.
x: { a: number; b: string }
}

View File

@ -1,13 +1,7 @@
tests/cases/compiler/invariantGenericErrorElaboration.ts(3,7): error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'.
Types of property 'constraint' are incompatible.
Type 'Constraint<Num>' is not assignable to type 'Constraint<Runtype<any>>'.
Types of property 'constraint' are incompatible.
Type 'Constraint<Constraint<Num>>' is not assignable to type 'Constraint<Constraint<Runtype<any>>>'.
Types of property 'constraint' are incompatible.
Type 'Constraint<Constraint<Constraint<Num>>>' is not assignable to type 'Constraint<Constraint<Constraint<Runtype<any>>>>'.
Type 'Constraint<Constraint<Runtype<any>>>' is not assignable to type 'Constraint<Constraint<Num>>'.
Types of property 'underlying' are incompatible.
Type 'Constraint<Runtype<any>>' is not assignable to type 'Constraint<Num>'.
The types of 'constraint.constraint.constraint' are incompatible between these types.
Type 'Constraint<Constraint<Constraint<Num>>>' is not assignable to type 'Constraint<Constraint<Constraint<Runtype<any>>>>'.
Type 'Constraint<Runtype<any>>' is not assignable to type 'Constraint<Num>'.
tests/cases/compiler/invariantGenericErrorElaboration.ts(4,19): error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'.
@ -17,16 +11,9 @@ tests/cases/compiler/invariantGenericErrorElaboration.ts(4,19): error TS2322: Ty
const wat: Runtype<any> = Num;
~~~
!!! error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'.
!!! error TS2322: Types of property 'constraint' are incompatible.
!!! error TS2322: Type 'Constraint<Num>' is not assignable to type 'Constraint<Runtype<any>>'.
!!! error TS2322: Types of property 'constraint' are incompatible.
!!! error TS2322: Type 'Constraint<Constraint<Num>>' is not assignable to type 'Constraint<Constraint<Runtype<any>>>'.
!!! error TS2322: Types of property 'constraint' are incompatible.
!!! error TS2322: Type 'Constraint<Constraint<Constraint<Num>>>' is not assignable to type 'Constraint<Constraint<Constraint<Runtype<any>>>>'.
!!! error TS2322: Type 'Constraint<Constraint<Runtype<any>>>' is not assignable to type 'Constraint<Constraint<Num>>'.
!!! error TS2322: Types of property 'underlying' are incompatible.
!!! error TS2322: Type 'Constraint<Runtype<any>>' is not assignable to type 'Constraint<Num>'.
!!! related TS2728 tests/cases/compiler/invariantGenericErrorElaboration.ts:12:3: 'tag' is declared here.
!!! error TS2322: The types of 'constraint.constraint.constraint' are incompatible between these types.
!!! error TS2322: Type 'Constraint<Constraint<Constraint<Num>>>' is not assignable to type 'Constraint<Constraint<Constraint<Runtype<any>>>>'.
!!! error TS2322: Type 'Constraint<Runtype<any>>' is not assignable to type 'Constraint<Num>'.
const Foo = Obj({ foo: Num })
~~~
!!! error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'.

View File

@ -1,18 +1,14 @@
tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts(2,24): error TS2769: No overload matches this call.
Overload 1 of 3, '(iterable: Iterable<readonly [string, number]>): Map<string, number>', gave the following error.
Argument of type '([string, number] | [string, boolean])[]' is not assignable to parameter of type 'Iterable<readonly [string, number]>'.
Types of property '[Symbol.iterator]' are incompatible.
Type '() => IterableIterator<[string, number] | [string, boolean]>' is not assignable to type '() => Iterator<readonly [string, number], any, undefined>'.
Type 'IterableIterator<[string, number] | [string, boolean]>' is not assignable to type 'Iterator<readonly [string, number], any, undefined>'.
Types of property 'next' are incompatible.
Type '(...args: [] | [undefined]) => IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<readonly [string, number], any>'.
Type 'IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type 'IteratorResult<readonly [string, number], any>'.
Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult<readonly [string, number], any>'.
Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult<readonly [string, number]>'.
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'.
The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
Type 'IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type 'IteratorResult<readonly [string, number], any>'.
Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult<readonly [string, number], any>'.
Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult<readonly [string, number]>'.
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<string, number>', gave the following error.
Type 'true' is not assignable to type 'number'.
@ -24,17 +20,13 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts(2,24): error
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 3, '(iterable: Iterable<readonly [string, number]>): Map<string, number>', gave the following error.
!!! error TS2769: Argument of type '([string, number] | [string, boolean])[]' is not assignable to parameter of type 'Iterable<readonly [string, number]>'.
!!! error TS2769: Types of property '[Symbol.iterator]' are incompatible.
!!! error TS2769: Type '() => IterableIterator<[string, number] | [string, boolean]>' is not assignable to type '() => Iterator<readonly [string, number], any, undefined>'.
!!! error TS2769: Type 'IterableIterator<[string, number] | [string, boolean]>' is not assignable to type 'Iterator<readonly [string, number], any, undefined>'.
!!! 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<readonly [string, number], any>'.
!!! error TS2769: Type 'IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type 'IteratorResult<readonly [string, number], any>'.
!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult<readonly [string, number], any>'.
!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult<readonly [string, number]>'.
!!! 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: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
!!! error TS2769: Type 'IteratorResult<[string, number] | [string, boolean], any>' is not assignable to type 'IteratorResult<readonly [string, number], any>'.
!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorResult<readonly [string, number], any>'.
!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult<readonly [string, number]>'.
!!! 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<string, number>', gave the following error.
!!! error TS2769: Type 'true' is not assignable to type 'number'.

View File

@ -1,10 +1,9 @@
tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS2769: No overload matches this call.
Overload 1 of 2, '(...items: ConcatArray<number>[]): number[]', gave the following error.
Argument of type 'symbol[]' is not assignable to parameter of type 'ConcatArray<number>'.
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'.
The types returned by 'slice(...)' are incompatible between these types.
Type 'symbol[]' is not assignable to type 'number[]'.
Type 'symbol' is not assignable to type 'number'.
Overload 2 of 2, '(...items: (number | ConcatArray<number>)[]): number[]', gave the following error.
Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray<number>'.
Type 'symbol[]' is not assignable to type 'ConcatArray<number>'.
@ -30,10 +29,9 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS276
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 2, '(...items: ConcatArray<number>[]): number[]', gave the following error.
!!! error TS2769: Argument of type 'symbol[]' is not assignable to parameter of type 'ConcatArray<number>'.
!!! 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: The types returned by 'slice(...)' are incompatible between these types.
!!! error TS2769: Type 'symbol[]' is not assignable to type 'number[]'.
!!! error TS2769: Type 'symbol' is not assignable to type 'number'.
!!! error TS2769: Overload 2 of 2, '(...items: (number | ConcatArray<number>)[]): number[]', gave the following error.
!!! error TS2769: Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray<number>'.
!!! error TS2769: Type 'symbol[]' is not assignable to type 'ConcatArray<number>'.

View File

@ -1,7 +1,6 @@
tests/cases/compiler/test.ts(4,5): error TS2322: Type 'PassportStatic' is not assignable to type 'Passport'.
Types of property 'use' are incompatible.
Type '() => PassportStatic' is not assignable to type '() => this'.
Type 'PassportStatic' is not assignable to type 'this'.
The types returned by 'use()' are incompatible between these types.
Type 'PassportStatic' is not assignable to type 'this'.
==== tests/cases/compiler/passport.d.ts (0 errors) ====
@ -27,6 +26,5 @@ tests/cases/compiler/test.ts(4,5): error TS2322: Type 'PassportStatic' is not as
let p: Passport = passport.use();
~
!!! error TS2322: Type 'PassportStatic' is not assignable to type 'Passport'.
!!! error TS2322: Types of property 'use' are incompatible.
!!! error TS2322: Type '() => PassportStatic' is not assignable to type '() => this'.
!!! error TS2322: Type 'PassportStatic' is not assignable to type 'this'.
!!! error TS2322: The types returned by 'use()' are incompatible between these types.
!!! error TS2322: Type 'PassportStatic' is not assignable to type 'this'.

View File

@ -1,9 +1,7 @@
tests/cases/compiler/multiLineErrors.ts(3,22): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
tests/cases/compiler/multiLineErrors.ts(21,1): error TS2322: Type 'A2' is not assignable to type 'A1'.
Types of property 'x' are incompatible.
Type '{ y: string; }' is not assignable to type '{ y: number; }'.
Types of property 'y' are incompatible.
Type 'string' is not assignable to type 'number'.
The types of 'x.y' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
==== tests/cases/compiler/multiLineErrors.ts (2 errors) ====
@ -35,8 +33,6 @@ tests/cases/compiler/multiLineErrors.ts(21,1): error TS2322: Type 'A2' is not as
t1 = t2;
~~
!!! error TS2322: Type 'A2' is not assignable to type 'A1'.
!!! error TS2322: Types of property 'x' are incompatible.
!!! error TS2322: Type '{ y: string; }' is not assignable to type '{ y: number; }'.
!!! error TS2322: Types of property 'y' are incompatible.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
!!! error TS2322: The types of 'x.y' are incompatible between these types.
!!! error TS2322: Type 'string' is not assignable to type 'number'.

View File

@ -1,9 +1,8 @@
tests/cases/compiler/mutuallyRecursiveCallbacks.ts(7,1): error TS2322: Type '<T>(bar: Bar<T>) => void' is not assignable to type 'Bar<{}>'.
Types of parameters 'bar' and 'foo' are incompatible.
Types of parameters 'bar' and 'foo' are incompatible.
Type 'Foo<unknown>' is not assignable to type 'Bar<{}>'.
Types of parameters 'bar' and 'foo' are incompatible.
Type 'void' is not assignable to type 'Foo<unknown>'.
Types of parameters 'bar' and 'foo' are incompatible.
Type 'void' is not assignable to type 'Foo<unknown>'.
==== tests/cases/compiler/mutuallyRecursiveCallbacks.ts (1 errors) ====
@ -18,7 +17,6 @@ tests/cases/compiler/mutuallyRecursiveCallbacks.ts(7,1): error TS2322: Type '<T>
!!! error TS2322: Type '<T>(bar: Bar<T>) => void' is not assignable to type 'Bar<{}>'.
!!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible.
!!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible.
!!! error TS2322: Type 'Foo<unknown>' is not assignable to type 'Bar<{}>'.
!!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible.
!!! error TS2322: Type 'void' is not assignable to type 'Foo<unknown>'.
!!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible.
!!! error TS2322: Type 'void' is not assignable to type 'Foo<unknown>'.

View File

@ -0,0 +1,20 @@
tests/cases/compiler/nestedCallbackErrorNotFlattened.ts(6,1): error TS2322: Type '() => () => () => () => number' is not assignable to type '() => () => () => () => string'.
Call signature return types '() => () => () => number' and '() => () => () => string' are incompatible.
Call signature return types '() => () => number' and '() => () => string' are incompatible.
Call signature return types '() => number' and '() => string' are incompatible.
Type 'number' is not assignable to type 'string'.
==== tests/cases/compiler/nestedCallbackErrorNotFlattened.ts (1 errors) ====
type Cb<T> = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made
// which means the comparison will definitely be structural, rather than by variance
declare const x: Cb<Cb<Cb<Cb<number>>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check
declare let y: Cb<Cb<Cb<Cb<string>>>>;
y = x;
~
!!! error TS2322: Type '() => () => () => () => number' is not assignable to type '() => () => () => () => string'.
!!! error TS2322: Call signature return types '() => () => () => number' and '() => () => () => string' are incompatible.
!!! error TS2322: Call signature return types '() => () => number' and '() => () => string' are incompatible.
!!! error TS2322: Call signature return types '() => number' and '() => string' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string'.

View File

@ -0,0 +1,11 @@
//// [nestedCallbackErrorNotFlattened.ts]
type Cb<T> = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made
// which means the comparison will definitely be structural, rather than by variance
declare const x: Cb<Cb<Cb<Cb<number>>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check
declare let y: Cb<Cb<Cb<Cb<string>>>>;
y = x;
//// [nestedCallbackErrorNotFlattened.js]
"use strict";
y = x;

View File

@ -0,0 +1,27 @@
=== tests/cases/compiler/nestedCallbackErrorNotFlattened.ts ===
type Cb<T> = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made
>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0))
>T : Symbol(T, Decl(nestedCallbackErrorNotFlattened.ts, 0, 8))
>noAlias : Symbol(noAlias, Decl(nestedCallbackErrorNotFlattened.ts, 0, 14))
>T : Symbol(T, Decl(nestedCallbackErrorNotFlattened.ts, 0, 8))
// which means the comparison will definitely be structural, rather than by variance
declare const x: Cb<Cb<Cb<Cb<number>>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check
>x : Symbol(x, Decl(nestedCallbackErrorNotFlattened.ts, 3, 13))
>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0))
>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0))
>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0))
>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0))
declare let y: Cb<Cb<Cb<Cb<string>>>>;
>y : Symbol(y, Decl(nestedCallbackErrorNotFlattened.ts, 4, 11))
>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0))
>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0))
>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0))
>Cb : Symbol(Cb, Decl(nestedCallbackErrorNotFlattened.ts, 0, 0))
y = x;
>y : Symbol(y, Decl(nestedCallbackErrorNotFlattened.ts, 4, 11))
>x : Symbol(x, Decl(nestedCallbackErrorNotFlattened.ts, 3, 13))

View File

@ -0,0 +1,18 @@
=== tests/cases/compiler/nestedCallbackErrorNotFlattened.ts ===
type Cb<T> = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made
>Cb : () => T
>noAlias : () => T
// which means the comparison will definitely be structural, rather than by variance
declare const x: Cb<Cb<Cb<Cb<number>>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check
>x : () => () => () => () => number
declare let y: Cb<Cb<Cb<Cb<string>>>>;
>y : () => () => () => () => string
y = x;
>y = x : () => () => () => () => number
>y : () => () => () => () => string
>x : () => () => () => () => number

View File

@ -1,17 +1,14 @@
tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts(10,9): error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'Style'.
Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'StyleArray'.
Types of property 'pop' are incompatible.
Type '() => { foo: string; jj: number; }[][]' is not assignable to type '() => Style'.
Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'.
Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'.
Types of property 'pop' are incompatible.
Type '() => { foo: string; jj: number; }[]' is not assignable to type '() => Style'.
Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'.
Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'.
Types of property 'pop' are incompatible.
Type '() => { foo: string; jj: number; }' is not assignable to type '() => Style'.
Type '{ foo: string; jj: number; }' is not assignable to type 'Style'.
Object literal may only specify known properties, and 'jj' does not exist in type 'Style'.
The types returned by 'pop()' are incompatible between these types.
Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'.
Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'.
The types returned by 'pop()' are incompatible between these types.
Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'.
Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'.
The types returned by 'pop()' are incompatible between these types.
Type '{ foo: string; jj: number; }' is not assignable to type 'Style'.
Object literal may only specify known properties, and 'jj' does not exist in type 'Style'.
==== tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts (1 errors) ====
@ -28,18 +25,15 @@ tests/cases/compiler/nestedRecursiveArraysOrObjectsError01.ts(10,9): error TS232
~~~~~
!!! error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[][][]' is not assignable to type 'StyleArray'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => { foo: string; jj: number; }[][]' is not assignable to type '() => Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => { foo: string; jj: number; }[]' is not assignable to type '() => Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'.
!!! error TS2322: Types of property 'pop' are incompatible.
!!! error TS2322: Type '() => { foo: string; jj: number; }' is not assignable to type '() => Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }' is not assignable to type 'Style'.
!!! error TS2322: Object literal may only specify known properties, and 'jj' does not exist in type 'Style'.
!!! error TS2322: The types returned by 'pop()' are incompatible between these types.
!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[][]' is not assignable to type 'StyleArray'.
!!! error TS2322: The types returned by 'pop()' are incompatible between these types.
!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }[]' is not assignable to type 'StyleArray'.
!!! error TS2322: The types returned by 'pop()' are incompatible between these types.
!!! error TS2322: Type '{ foo: string; jj: number; }' is not assignable to type 'Style'.
!!! error TS2322: Object literal may only specify known properties, and 'jj' does not exist in type 'Style'.
}]]
];

View File

@ -1,15 +1,12 @@
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts(7,1): error TS2322: Type 'I' is not assignable to type 'Object'.
Types of property 'toString' are incompatible.
Type '() => void' is not assignable to type '() => string'.
Type 'void' is not assignable to type 'string'.
The types returned by 'toString()' are incompatible between these types.
Type 'void' is not assignable to type 'string'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts(14,1): error TS2322: Type 'C' is not assignable to type 'Object'.
Types of property 'toString' are incompatible.
Type '() => void' is not assignable to type '() => string'.
Type 'void' is not assignable to type 'string'.
The types returned by 'toString()' are incompatible between these types.
Type 'void' is not assignable to type 'string'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts(20,1): error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'.
Types of property 'toString' are incompatible.
Type '() => void' is not assignable to type '() => string'.
Type 'void' is not assignable to type 'string'.
The types returned by 'toString()' are incompatible between these types.
Type 'void' is not assignable to type 'string'.
==== tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts (3 errors) ====
@ -22,9 +19,8 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC
o = i; // error
~
!!! error TS2322: Type 'I' is not assignable to type 'Object'.
!!! error TS2322: Types of property 'toString' are incompatible.
!!! error TS2322: Type '() => void' is not assignable to type '() => string'.
!!! error TS2322: Type 'void' is not assignable to type 'string'.
!!! error TS2322: The types returned by 'toString()' are incompatible between these types.
!!! error TS2322: Type 'void' is not assignable to type 'string'.
i = o; // ok
class C {
@ -34,9 +30,8 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC
o = c; // error
~
!!! error TS2322: Type 'C' is not assignable to type 'Object'.
!!! error TS2322: Types of property 'toString' are incompatible.
!!! error TS2322: Type '() => void' is not assignable to type '() => string'.
!!! error TS2322: Type 'void' is not assignable to type 'string'.
!!! error TS2322: The types returned by 'toString()' are incompatible between these types.
!!! error TS2322: Type 'void' is not assignable to type 'string'.
c = o; // ok
var a = {
@ -45,7 +40,6 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC
o = a; // error
~
!!! error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'.
!!! error TS2322: Types of property 'toString' are incompatible.
!!! error TS2322: Type '() => void' is not assignable to type '() => string'.
!!! error TS2322: Type 'void' is not assignable to type 'string'.
!!! error TS2322: The types returned by 'toString()' are incompatible between these types.
!!! error TS2322: Type 'void' is not assignable to type 'string'.
a = o; // ok

View File

@ -1,25 +1,18 @@
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(7,1): error TS2322: Type 'I' is not assignable to type 'Object'.
Types of property 'toString' are incompatible.
Type '() => number' is not assignable to type '() => string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Types of property 'toString' are incompatible.
Type '() => string' is not assignable to type '() => number'.
Type 'string' is not assignable to type 'number'.
The types returned by 'toString()' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(8,1): error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
The types returned by 'toString()' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(14,1): error TS2322: Type 'C' is not assignable to type 'Object'.
Types of property 'toString' are incompatible.
Type '() => number' is not assignable to type '() => string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(15,1): error TS2322: Type 'Object' is not assignable to type 'C'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Types of property 'toString' are incompatible.
Type '() => string' is not assignable to type '() => number'.
Type 'string' is not assignable to type 'number'.
The types returned by 'toString()' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(15,1): error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
The types returned by 'toString()' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(20,1): error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'.
Types of property 'toString' are incompatible.
Type '() => void' is not assignable to type '() => string'.
Type 'void' is not assignable to type 'string'.
The types returned by 'toString()' are incompatible between these types.
Type 'void' is not assignable to type 'string'.
==== tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts (5 errors) ====
@ -32,16 +25,13 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC
o = i; // error
~
!!! error TS2322: Type 'I' is not assignable to type 'Object'.
!!! error TS2322: Types of property 'toString' are incompatible.
!!! error TS2322: Type '() => number' is not assignable to type '() => string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
!!! error TS2322: The types returned by 'toString()' are incompatible between these types.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
i = o; // error
~
!!! error TS2322: Type 'Object' is not assignable to type 'I'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2322: Types of property 'toString' are incompatible.
!!! error TS2322: Type '() => string' is not assignable to type '() => number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
!!! error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2696: The types returned by 'toString()' are incompatible between these types.
!!! error TS2696: Type 'string' is not assignable to type 'number'.
class C {
toString(): number { return 1; }
@ -50,16 +40,13 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC
o = c; // error
~
!!! error TS2322: Type 'C' is not assignable to type 'Object'.
!!! error TS2322: Types of property 'toString' are incompatible.
!!! error TS2322: Type '() => number' is not assignable to type '() => string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
!!! error TS2322: The types returned by 'toString()' are incompatible between these types.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
c = o; // error
~
!!! error TS2322: Type 'Object' is not assignable to type 'C'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2322: Types of property 'toString' are incompatible.
!!! error TS2322: Type '() => string' is not assignable to type '() => number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
!!! error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2696: The types returned by 'toString()' are incompatible between these types.
!!! error TS2696: Type 'string' is not assignable to type 'number'.
var a = {
toString: () => { }
@ -67,7 +54,6 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC
o = a; // error
~
!!! error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'.
!!! error TS2322: Types of property 'toString' are incompatible.
!!! error TS2322: Type '() => void' is not assignable to type '() => string'.
!!! error TS2322: Type 'void' is not assignable to type 'string'.
!!! error TS2322: The types returned by 'toString()' are incompatible between these types.
!!! error TS2322: Type 'void' is not assignable to type 'string'.
a = o; // ok

View File

@ -122,8 +122,8 @@ tests/cases/compiler/promisePermutations.ts(159,21): error TS2769: No overload m
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<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
Types of property 'then' are incompatible.
Call signature return types 'Promise<number>' and 'IPromise<string>' are incompatible.
The types of 'then' are incompatible between these types.
Type '{ <TResult1 = number, TResult2 = never>(onfulfilled?: (value: number) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }' is not assignable to type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }'.
Types of parameters 'onfulfilled' and 'success' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
@ -481,8 +481,8 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m
!!! error TS2769: No overload matches this call.
!!! error TS2769: The last overload gave the following error.
!!! error TS2769: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2769: Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
!!! error TS2769: Types of property 'then' are incompatible.
!!! error TS2769: Call signature return types 'Promise<number>' and 'IPromise<string>' are incompatible.
!!! error TS2769: The types of 'then' are incompatible between these types.
!!! error TS2769: Type '{ <TResult1 = number, TResult2 = never>(onfulfilled?: (value: number) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }' is not assignable to type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }'.
!!! error TS2769: Types of parameters 'onfulfilled' and 'success' are incompatible.
!!! error TS2769: Types of parameters 'value' and 'value' are incompatible.

View File

@ -80,8 +80,8 @@ tests/cases/compiler/promisePermutations2.ts(158,21): error TS2345: Argument of
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
Types of property 'then' are incompatible.
Call signature return types 'Promise<number>' and 'IPromise<string>' are incompatible.
The types of 'then' are incompatible between these types.
Type '{ <TResult1 = number, TResult2 = never>(onfulfilled?: (value: number) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }' is not assignable to type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }'.
Types of parameters 'onfulfilled' and 'success' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
@ -376,8 +376,8 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of
var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // ok
~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
!!! error TS2345: Types of property 'then' are incompatible.
!!! error TS2345: Call signature return types 'Promise<number>' and 'IPromise<string>' are incompatible.
!!! error TS2345: The types of 'then' are incompatible between these types.
!!! error TS2345: Type '{ <TResult1 = number, TResult2 = never>(onfulfilled?: (value: number) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }' is not assignable to type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }'.
!!! error TS2345: Types of parameters 'onfulfilled' and 'success' are incompatible.
!!! error TS2345: Types of parameters 'value' and 'value' are incompatible.

View File

@ -101,8 +101,8 @@ tests/cases/compiler/promisePermutations3.ts(158,21): error TS2769: No overload
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<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
Types of property 'then' are incompatible.
Call signature return types 'Promise<number>' and 'IPromise<string>' are incompatible.
The types of 'then' are incompatible between these types.
Type '{ <TResult1 = number, TResult2 = never>(onfulfilled?: (value: number) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }' is not assignable to type '<U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise<U>'.
Types of parameters 'onfulfilled' and 'success' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
@ -429,8 +429,8 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
!!! error TS2769: No overload matches this call.
!!! error TS2769: The last overload gave the following error.
!!! error TS2769: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2769: Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
!!! error TS2769: Types of property 'then' are incompatible.
!!! error TS2769: Call signature return types 'Promise<number>' and 'IPromise<string>' are incompatible.
!!! error TS2769: The types of 'then' are incompatible between these types.
!!! error TS2769: Type '{ <TResult1 = number, TResult2 = never>(onfulfilled?: (value: number) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }' is not assignable to type '<U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise<U>'.
!!! error TS2769: Types of parameters 'onfulfilled' and 'success' are incompatible.
!!! error TS2769: Types of parameters 'value' and 'value' are incompatible.

View File

@ -5,10 +5,9 @@ tests/cases/compiler/promiseTypeInference.ts(10,39): error TS2769: No overload m
Type 'IPromise<number>' is not assignable to type 'number | PromiseLike<number>'.
Type 'IPromise<number>' is not assignable to type 'PromiseLike<number>'.
Types of property 'then' are incompatible.
Type '<U>(success?: (value: number) => IPromise<U>) => IPromise<U>' is not assignable to type '<TResult1 = number, TResult2 = never>(onfulfilled?: (value: number) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => PromiseLike<TResult1 | TResult2>'.
Types of parameters 'success' and 'onfulfilled' are incompatible.
Type 'TResult1 | PromiseLike<TResult1>' is not assignable to type 'IPromise<TResult1 | TResult2>'.
Type 'TResult1' is not assignable to type 'IPromise<TResult1 | TResult2>'.
Types of parameters 'success' and 'onfulfilled' are incompatible.
Type 'TResult1 | PromiseLike<TResult1>' is not assignable to type 'IPromise<TResult1 | TResult2>'.
Type 'TResult1' is not assignable to type 'IPromise<TResult1 | TResult2>'.
==== tests/cases/compiler/promiseTypeInference.ts (1 errors) ====
@ -30,10 +29,9 @@ tests/cases/compiler/promiseTypeInference.ts(10,39): error TS2769: No overload m
!!! error TS2769: Type 'IPromise<number>' is not assignable to type 'number | PromiseLike<number>'.
!!! error TS2769: Type 'IPromise<number>' is not assignable to type 'PromiseLike<number>'.
!!! error TS2769: Types of property 'then' are incompatible.
!!! error TS2769: Type '<U>(success?: (value: number) => IPromise<U>) => IPromise<U>' is not assignable to type '<TResult1 = number, TResult2 = never>(onfulfilled?: (value: number) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => PromiseLike<TResult1 | TResult2>'.
!!! error TS2769: Types of parameters 'success' and 'onfulfilled' are incompatible.
!!! error TS2769: Type 'TResult1 | PromiseLike<TResult1>' is not assignable to type 'IPromise<TResult1 | TResult2>'.
!!! error TS2769: Type 'TResult1' is not assignable to type 'IPromise<TResult1 | TResult2>'.
!!! error TS2769: Types of parameters 'success' and 'onfulfilled' are incompatible.
!!! error TS2769: Type 'TResult1 | PromiseLike<TResult1>' is not assignable to type 'IPromise<TResult1 | TResult2>'.
!!! error TS2769: Type 'TResult1' is not assignable to type 'IPromise<TResult1 | TResult2>'.
!!! 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.

View File

@ -69,9 +69,8 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(126,1): error TS2322: Type 'Cr
tests/cases/compiler/strictFunctionTypesErrors.ts(127,1): error TS2322: Type 'Crate<Animal>' is not assignable to type 'Crate<Dog>'.
Types of property 'item' are incompatible.
Type 'Animal' is not assignable to type 'Dog'.
tests/cases/compiler/strictFunctionTypesErrors.ts(133,1): error TS2322: Type '(f: (x: Dog) => Dog) => void' is not assignable to type '(f: (x: Animal) => Animal) => void'.
Types of parameters 'f' and 'f' are incompatible.
Type 'Animal' is not assignable to type 'Dog'.
tests/cases/compiler/strictFunctionTypesErrors.ts(133,1): error TS2328: Types of parameters 'f' and 'f' are incompatible.
Type 'Animal' is not assignable to type 'Dog'.
tests/cases/compiler/strictFunctionTypesErrors.ts(134,1): error TS2322: Type '(f: (x: Animal) => Animal) => void' is not assignable to type '(f: (x: Dog) => Dog) => void'.
Types of parameters 'f' and 'f' are incompatible.
Types of parameters 'x' and 'x' are incompatible.
@ -324,9 +323,8 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(155,5): error TS2322: Type '(c
declare let fc2: (f: (x: Dog) => Dog) => void;
fc1 = fc2; // Error
~~~
!!! error TS2322: Type '(f: (x: Dog) => Dog) => void' is not assignable to type '(f: (x: Animal) => Animal) => void'.
!!! error TS2322: Types of parameters 'f' and 'f' are incompatible.
!!! error TS2322: Type 'Animal' is not assignable to type 'Dog'.
!!! error TS2328: Types of parameters 'f' and 'f' are incompatible.
!!! error TS2328: Type 'Animal' is not assignable to type 'Dog'.
fc2 = fc1; // Error
~~~
!!! error TS2322: Type '(f: (x: Animal) => Animal) => void' is not assignable to type '(f: (x: Dog) => Dog) => void'.

View File

@ -1,12 +1,10 @@
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts(70,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'.
Types of property 'a' are incompatible.
Type '(x: string) => string' is not assignable to type '{ (x: "a"): number; (x: string): number; }'.
Type 'string' is not assignable to type 'number'.
The types returned by 'a(...)' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts(76,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'.
Types of property 'a2' are incompatible.
Type '<T>(x: T) => string' is not assignable to type '<T>(x: T) => T'.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'a2(...)' are incompatible between these types.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts (2 errors) ====
@ -82,9 +80,8 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I2 extends Base2 {
~~
!!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type '(x: string) => string' is not assignable to type '{ (x: "a"): number; (x: string): number; }'.
!!! error TS2430: Type 'string' is not assignable to type 'number'.
!!! error TS2430: The types returned by 'a(...)' are incompatible between these types.
!!! error TS2430: Type 'string' is not assignable to type 'number'.
// N's
a: (x: string) => string; // error because base returns non-void;
}
@ -93,10 +90,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I3 extends Base2 {
~~
!!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a2' are incompatible.
!!! error TS2430: Type '<T>(x: T) => string' is not assignable to type '<T>(x: T) => T'.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'a2(...)' are incompatible between these types.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
// N's
a2: <T>(x: T) => string; // error because base returns non-void;
}

View File

@ -1,12 +1,10 @@
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithSpecializedSignatures.ts(70,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'.
Types of property 'a' are incompatible.
Type 'new (x: string) => string' is not assignable to type '{ new (x: "a"): number; new (x: string): number; }'.
Type 'string' is not assignable to type 'number'.
The types returned by 'new a(...)' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithSpecializedSignatures.ts(76,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'.
Types of property 'a2' are incompatible.
Type 'new <T>(x: T) => string' is not assignable to type 'new <T>(x: T) => T'.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'new a2(...)' are incompatible between these types.
Type 'string' is not assignable to type 'T'.
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithSpecializedSignatures.ts (2 errors) ====
@ -82,9 +80,8 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I2 extends Base2 {
~~
!!! error TS2430: Interface 'I2' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type 'new (x: string) => string' is not assignable to type '{ new (x: "a"): number; new (x: string): number; }'.
!!! error TS2430: Type 'string' is not assignable to type 'number'.
!!! error TS2430: The types returned by 'new a(...)' are incompatible between these types.
!!! error TS2430: Type 'string' is not assignable to type 'number'.
// N's
a: new (x: string) => string; // error because base returns non-void;
}
@ -93,10 +90,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I3 extends Base2 {
~~
!!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a2' are incompatible.
!!! error TS2430: Type 'new <T>(x: T) => string' is not assignable to type 'new <T>(x: T) => T'.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'new a2(...)' are incompatible between these types.
!!! error TS2430: Type 'string' is not assignable to type 'T'.
!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
// N's
a2: new <T>(x: T) => string; // error because base returns non-void;
}

View File

@ -5,23 +5,20 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
Types of property 'a3' are incompatible.
Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(100,15): error TS2430: Interface 'I1<T>' incorrectly extends interface 'Base2'.
Types of property 'a' are incompatible.
Type '() => T' is not assignable to type '<T>() => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'a()' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(104,15): error TS2430: Interface 'I2<T>' incorrectly extends interface 'Base2'.
Types of property 'a' are incompatible.
Type '(x?: T) => T' is not assignable to type '<T>() => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'a(...)' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(108,15): error TS2430: Interface 'I3<T>' incorrectly extends interface 'Base2'.
Types of property 'a' are incompatible.
Type '(x: T) => T' is not assignable to type '<T>() => T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(113,15): error TS2430: Interface 'I4<T>' incorrectly extends interface 'Base2'.
Types of property 'a2' are incompatible.
Type '() => T' is not assignable to type '<T>(x?: T) => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'a2(...)' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(117,15): error TS2430: Interface 'I5<T>' incorrectly extends interface 'Base2'.
Types of property 'a2' are incompatible.
Type '(x?: T) => T' is not assignable to type '<T>(x?: T) => T'.
@ -35,10 +32,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(126,15): error TS2430: Interface 'I7<T>' incorrectly extends interface 'Base2'.
Types of property 'a3' are incompatible.
Type '() => T' is not assignable to type '<T>(x: T) => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'a3(...)' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(130,15): error TS2430: Interface 'I8<T>' incorrectly extends interface 'Base2'.
Types of property 'a3' are incompatible.
Type '(x?: T) => T' is not assignable to type '<T>(x: T) => T'.
@ -55,10 +51,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
Types of property 'a3' are incompatible.
Type '(x: T, y: T) => T' is not assignable to type '<T>(x: T) => T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(143,15): error TS2430: Interface 'I11<T>' incorrectly extends interface 'Base2'.
Types of property 'a4' are incompatible.
Type '() => T' is not assignable to type '<T>(x: T, y?: T) => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'a4(...)' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(147,15): error TS2430: Interface 'I12<T>' incorrectly extends interface 'Base2'.
Types of property 'a4' are incompatible.
Type '(x?: T, y?: T) => T' is not assignable to type '<T>(x: T, y?: T) => T'.
@ -78,10 +73,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(160,15): error TS2430: Interface 'I15<T>' incorrectly extends interface 'Base2'.
Types of property 'a5' are incompatible.
Type '() => T' is not assignable to type '<T>(x?: T, y?: T) => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'a5(...)' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(164,15): error TS2430: Interface 'I16<T>' incorrectly extends interface 'Base2'.
Types of property 'a5' are incompatible.
Type '(x?: T, y?: T) => T' is not assignable to type '<T>(x?: T, y?: T) => T'.
@ -219,20 +213,18 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I1<T> extends Base2 {
~~
!!! error TS2430: Interface 'I1<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type '() => T' is not assignable to type '<T>() => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'a()' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a: () => T;
}
interface I2<T> extends Base2 {
~~
!!! error TS2430: Interface 'I2<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type '(x?: T) => T' is not assignable to type '<T>() => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'a(...)' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a: (x?: T) => T;
}
@ -248,10 +240,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I4<T> extends Base2 {
~~
!!! error TS2430: Interface 'I4<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a2' are incompatible.
!!! error TS2430: Type '() => T' is not assignable to type '<T>(x?: T) => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'a2(...)' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a2: () => T;
}
@ -281,10 +272,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I7<T> extends Base2 {
~~
!!! error TS2430: Interface 'I7<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a3' are incompatible.
!!! error TS2430: Type '() => T' is not assignable to type '<T>(x: T) => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'a3(...)' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a3: () => T;
}
@ -322,10 +312,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I11<T> extends Base2 {
~~~
!!! error TS2430: Interface 'I11<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a4' are incompatible.
!!! error TS2430: Type '() => T' is not assignable to type '<T>(x: T, y?: T) => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'a4(...)' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a4: () => T;
}
@ -366,10 +355,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I15<T> extends Base2 {
~~~
!!! error TS2430: Interface 'I15<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a5' are incompatible.
!!! error TS2430: Type '() => T' is not assignable to type '<T>(x?: T, y?: T) => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'a5(...)' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a5: () => T;
}

View File

@ -5,23 +5,20 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
Types of property 'a3' are incompatible.
Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(100,15): error TS2430: Interface 'I1<T>' incorrectly extends interface 'Base2'.
Types of property 'a' are incompatible.
Type 'new () => T' is not assignable to type 'new <T>() => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'new a()' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(104,15): error TS2430: Interface 'I2<T>' incorrectly extends interface 'Base2'.
Types of property 'a' are incompatible.
Type 'new (x?: T) => T' is not assignable to type 'new <T>() => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'new a(...)' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(108,15): error TS2430: Interface 'I3<T>' incorrectly extends interface 'Base2'.
Types of property 'a' are incompatible.
Type 'new (x: T) => T' is not assignable to type 'new <T>() => T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(113,15): error TS2430: Interface 'I4<T>' incorrectly extends interface 'Base2'.
Types of property 'a2' are incompatible.
Type 'new () => T' is not assignable to type 'new <T>(x?: T) => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'new a2(...)' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(117,15): error TS2430: Interface 'I5<T>' incorrectly extends interface 'Base2'.
Types of property 'a2' are incompatible.
Type 'new (x?: T) => T' is not assignable to type 'new <T>(x?: T) => T'.
@ -35,10 +32,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(126,15): error TS2430: Interface 'I7<T>' incorrectly extends interface 'Base2'.
Types of property 'a3' are incompatible.
Type 'new () => T' is not assignable to type 'new <T>(x: T) => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'new a3(...)' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(130,15): error TS2430: Interface 'I8<T>' incorrectly extends interface 'Base2'.
Types of property 'a3' are incompatible.
Type 'new (x?: T) => T' is not assignable to type 'new <T>(x: T) => T'.
@ -55,10 +51,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
Types of property 'a3' are incompatible.
Type 'new (x: T, y: T) => T' is not assignable to type 'new <T>(x: T) => T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(143,15): error TS2430: Interface 'I11<T>' incorrectly extends interface 'Base2'.
Types of property 'a4' are incompatible.
Type 'new () => T' is not assignable to type 'new <T>(x: T, y?: T) => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'new a4(...)' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(147,15): error TS2430: Interface 'I12<T>' incorrectly extends interface 'Base2'.
Types of property 'a4' are incompatible.
Type 'new (x?: T, y?: T) => T' is not assignable to type 'new <T>(x: T, y?: T) => T'.
@ -78,10 +73,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(160,15): error TS2430: Interface 'I15<T>' incorrectly extends interface 'Base2'.
Types of property 'a5' are incompatible.
Type 'new () => T' is not assignable to type 'new <T>(x?: T, y?: T) => T'.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
The types returned by 'new a5(...)' are incompatible between these types.
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(164,15): error TS2430: Interface 'I16<T>' incorrectly extends interface 'Base2'.
Types of property 'a5' are incompatible.
Type 'new (x?: T, y?: T) => T' is not assignable to type 'new <T>(x?: T, y?: T) => T'.
@ -219,20 +213,18 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I1<T> extends Base2 {
~~
!!! error TS2430: Interface 'I1<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type 'new () => T' is not assignable to type 'new <T>() => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'new a()' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a: new () => T;
}
interface I2<T> extends Base2 {
~~
!!! error TS2430: Interface 'I2<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a' are incompatible.
!!! error TS2430: Type 'new (x?: T) => T' is not assignable to type 'new <T>() => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'new a(...)' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a: new (x?: T) => T;
}
@ -248,10 +240,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I4<T> extends Base2 {
~~
!!! error TS2430: Interface 'I4<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a2' are incompatible.
!!! error TS2430: Type 'new () => T' is not assignable to type 'new <T>(x?: T) => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'new a2(...)' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a2: new () => T;
}
@ -281,10 +272,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I7<T> extends Base2 {
~~
!!! error TS2430: Interface 'I7<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a3' are incompatible.
!!! error TS2430: Type 'new () => T' is not assignable to type 'new <T>(x: T) => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'new a3(...)' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a3: new () => T;
}
@ -322,10 +312,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I11<T> extends Base2 {
~~~
!!! error TS2430: Interface 'I11<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a4' are incompatible.
!!! error TS2430: Type 'new () => T' is not assignable to type 'new <T>(x: T, y?: T) => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'new a4(...)' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a4: new () => T;
}
@ -366,10 +355,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
interface I15<T> extends Base2 {
~~~
!!! error TS2430: Interface 'I15<T>' incorrectly extends interface 'Base2'.
!!! error TS2430: Types of property 'a5' are incompatible.
!!! error TS2430: Type 'new () => T' is not assignable to type 'new <T>(x?: T, y?: T) => T'.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
!!! error TS2430: The types returned by 'new a5(...)' are incompatible between these types.
!!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
a5: new () => T;
}

View File

@ -1,9 +1,9 @@
tests/cases/compiler/typeParameterArgumentEquivalence5.ts(4,5): error TS2322: Type '() => (item: any) => T' is not assignable to type '() => (item: any) => U'.
Type '(item: any) => T' is not assignable to type '(item: any) => U'.
Call signature return types '(item: any) => T' and '(item: any) => U' are incompatible.
Type 'T' is not assignable to type 'U'.
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'.
tests/cases/compiler/typeParameterArgumentEquivalence5.ts(5,5): error TS2322: Type '() => (item: any) => U' is not assignable to type '() => (item: any) => T'.
Type '(item: any) => U' is not assignable to type '(item: any) => T'.
Call signature return types '(item: any) => U' and '(item: any) => T' are incompatible.
Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
@ -15,13 +15,13 @@ tests/cases/compiler/typeParameterArgumentEquivalence5.ts(5,5): error TS2322: Ty
x = y; // Should be an error
~
!!! error TS2322: Type '() => (item: any) => T' is not assignable to type '() => (item: any) => U'.
!!! error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => U'.
!!! error TS2322: Call signature return types '(item: any) => T' and '(item: any) => U' are incompatible.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'.
y = x; // Shound be an error
~
!!! error TS2322: Type '() => (item: any) => U' is not assignable to type '() => (item: any) => T'.
!!! error TS2322: Type '(item: any) => U' is not assignable to type '(item: any) => T'.
!!! error TS2322: Call signature return types '(item: any) => U' and '(item: any) => T' are incompatible.
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
}

View File

@ -1,39 +1,29 @@
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(2,12): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(8,12): error TS2504: Type 'Promise<number[]>' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(10,7): error TS2322: Type '() => AsyncGenerator<string, void, undefined>' is not assignable to type '() => AsyncIterableIterator<number>'.
Type 'AsyncGenerator<string, void, undefined>' is not assignable to type 'AsyncIterableIterator<number>'.
Types of property 'next' are incompatible.
Type '(...args: [] | [undefined]) => Promise<IteratorResult<string, void>>' is not assignable to type '(...args: [] | [undefined]) => Promise<IteratorResult<number, any>>'.
Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
Type 'IteratorResult<string, void>' is not assignable to type 'IteratorResult<number, any>'.
Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorResult<number, any>'.
Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorYieldResult<number>'.
Type 'string' is not assignable to type 'number'.
Call signature return types 'AsyncGenerator<string, void, undefined>' and 'AsyncIterableIterator<number>' are incompatible.
The types returned by 'next(...)' are incompatible between these types.
Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
Type 'IteratorResult<string, void>' is not assignable to type 'IteratorResult<number, any>'.
Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorResult<number, any>'.
Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorYieldResult<number>'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(13,7): error TS2322: Type '() => AsyncGenerator<string, void, undefined>' is not assignable to type '() => AsyncIterableIterator<number>'.
Type 'AsyncGenerator<string, void, undefined>' is not assignable to type 'AsyncIterableIterator<number>'.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(16,7): error TS2322: Type '() => AsyncGenerator<string, void, unknown>' is not assignable to type '() => AsyncIterableIterator<number>'.
Type 'AsyncGenerator<string, void, unknown>' is not assignable to type 'AsyncIterableIterator<number>'.
Types of property 'next' are incompatible.
Type '(...args: [] | [unknown]) => Promise<IteratorResult<string, void>>' is not assignable to type '(...args: [] | [undefined]) => Promise<IteratorResult<number, any>>'.
Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
Call signature return types 'AsyncGenerator<string, void, unknown>' and 'AsyncIterableIterator<number>' are incompatible.
The types returned by 'next(...)' are incompatible between these types.
Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(19,7): error TS2322: Type '() => AsyncGenerator<string, void, undefined>' is not assignable to type '() => AsyncIterable<number>'.
Type 'AsyncGenerator<string, void, undefined>' is not assignable to type 'AsyncIterable<number>'.
Types of property '[Symbol.asyncIterator]' are incompatible.
Type '() => AsyncGenerator<string, void, undefined>' is not assignable to type '() => AsyncIterator<number, any, undefined>'.
Type 'AsyncGenerator<string, void, undefined>' is not assignable to type 'AsyncIterator<number, any, undefined>'.
Types of property 'next' are incompatible.
Type '(...args: [] | [undefined]) => Promise<IteratorResult<string, void>>' is not assignable to type '(...args: [] | [undefined]) => Promise<IteratorResult<number, any>>'.
Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
Call signature return types 'AsyncGenerator<string, void, undefined>' and 'AsyncIterable<number>' are incompatible.
The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types.
Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(22,7): error TS2322: Type '() => AsyncGenerator<string, void, undefined>' is not assignable to type '() => AsyncIterable<number>'.
Type 'AsyncGenerator<string, void, undefined>' is not assignable to type 'AsyncIterable<number>'.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(25,7): error TS2322: Type '() => AsyncGenerator<string, void, unknown>' is not assignable to type '() => AsyncIterable<number>'.
Type 'AsyncGenerator<string, void, unknown>' is not assignable to type 'AsyncIterable<number>'.
Types of property '[Symbol.asyncIterator]' are incompatible.
Type '() => AsyncGenerator<string, void, unknown>' is not assignable to type '() => AsyncIterator<number, any, undefined>'.
Type 'AsyncGenerator<string, void, unknown>' is not assignable to type 'AsyncIterator<number, any, undefined>'.
Types of property 'next' are incompatible.
Type '(...args: [] | [unknown]) => Promise<IteratorResult<string, void>>' is not assignable to type '(...args: [] | [undefined]) => Promise<IteratorResult<number, any>>'.
Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
Call signature return types 'AsyncGenerator<string, void, unknown>' and 'AsyncIterable<number>' are incompatible.
The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types.
Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(28,7): error TS2322: Type '() => AsyncGenerator<string, void, undefined>' is not assignable to type '() => AsyncIterator<number, any, undefined>'.
Type 'AsyncGenerator<string, void, undefined>' is not assignable to type 'AsyncIterator<number, any, undefined>'.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(31,7): error TS2322: Type '() => AsyncGenerator<string, void, undefined>' is not assignable to type '() => AsyncIterator<number, any, undefined>'.
@ -52,10 +42,9 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(64,42): error TS2741: Property '[Symbol.iterator]' is missing in type 'AsyncGenerator<number, any, undefined>' but required in type 'IterableIterator<number>'.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(67,42): error TS2741: Property '[Symbol.iterator]' is missing in type 'AsyncGenerator<any, any, any>' but required in type 'Iterable<number>'.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(70,42): error TS2322: Type 'AsyncGenerator<number, any, undefined>' is not assignable to type 'Iterator<number, any, undefined>'.
Types of property 'next' are incompatible.
Type '(...args: [] | [undefined]) => Promise<IteratorResult<number, any>>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<number, any>'.
Type 'Promise<IteratorResult<number, any>>' is not assignable to type 'IteratorResult<number, any>'.
Property 'value' is missing in type 'Promise<IteratorResult<number, any>>' but required in type 'IteratorYieldResult<number>'.
The types returned by 'next(...)' are incompatible between these types.
Type 'Promise<IteratorResult<number, any>>' is not assignable to type 'IteratorResult<number, any>'.
Property 'value' is missing in type 'Promise<IteratorResult<number, any>>' but required in type 'IteratorYieldResult<number>'.
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(74,12): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
@ -77,14 +66,13 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(
const assignability1: () => AsyncIterableIterator<number> = async function * () {
~~~~~~~~~~~~~~
!!! error TS2322: Type '() => AsyncGenerator<string, void, undefined>' is not assignable to type '() => AsyncIterableIterator<number>'.
!!! error TS2322: Type 'AsyncGenerator<string, void, undefined>' is not assignable to type 'AsyncIterableIterator<number>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '(...args: [] | [undefined]) => Promise<IteratorResult<string, void>>' is not assignable to type '(...args: [] | [undefined]) => Promise<IteratorResult<number, any>>'.
!!! error TS2322: Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
!!! error TS2322: Type 'IteratorResult<string, void>' is not assignable to type 'IteratorResult<number, any>'.
!!! error TS2322: Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorResult<number, any>'.
!!! error TS2322: Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorYieldResult<number>'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
!!! error TS2322: Call signature return types 'AsyncGenerator<string, void, undefined>' and 'AsyncIterableIterator<number>' are incompatible.
!!! error TS2322: The types returned by 'next(...)' are incompatible between these types.
!!! error TS2322: Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
!!! error TS2322: Type 'IteratorResult<string, void>' is not assignable to type 'IteratorResult<number, any>'.
!!! error TS2322: Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorResult<number, any>'.
!!! error TS2322: Type 'IteratorYieldResult<string>' is not assignable to type 'IteratorYieldResult<number>'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
yield "a";
};
const assignability2: () => AsyncIterableIterator<number> = async function * () {
@ -96,22 +84,17 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(
const assignability3: () => AsyncIterableIterator<number> = async function * () {
~~~~~~~~~~~~~~
!!! error TS2322: Type '() => AsyncGenerator<string, void, unknown>' is not assignable to type '() => AsyncIterableIterator<number>'.
!!! error TS2322: Type 'AsyncGenerator<string, void, unknown>' is not assignable to type 'AsyncIterableIterator<number>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '(...args: [] | [unknown]) => Promise<IteratorResult<string, void>>' is not assignable to type '(...args: [] | [undefined]) => Promise<IteratorResult<number, any>>'.
!!! error TS2322: Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
!!! error TS2322: Call signature return types 'AsyncGenerator<string, void, unknown>' and 'AsyncIterableIterator<number>' are incompatible.
!!! error TS2322: The types returned by 'next(...)' are incompatible between these types.
!!! error TS2322: Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
yield* (async function * () { yield "a"; })();
};
const assignability4: () => AsyncIterable<number> = async function * () {
~~~~~~~~~~~~~~
!!! error TS2322: Type '() => AsyncGenerator<string, void, undefined>' is not assignable to type '() => AsyncIterable<number>'.
!!! error TS2322: Type 'AsyncGenerator<string, void, undefined>' is not assignable to type 'AsyncIterable<number>'.
!!! error TS2322: Types of property '[Symbol.asyncIterator]' are incompatible.
!!! error TS2322: Type '() => AsyncGenerator<string, void, undefined>' is not assignable to type '() => AsyncIterator<number, any, undefined>'.
!!! error TS2322: Type 'AsyncGenerator<string, void, undefined>' is not assignable to type 'AsyncIterator<number, any, undefined>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '(...args: [] | [undefined]) => Promise<IteratorResult<string, void>>' is not assignable to type '(...args: [] | [undefined]) => Promise<IteratorResult<number, any>>'.
!!! error TS2322: Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
!!! error TS2322: Call signature return types 'AsyncGenerator<string, void, undefined>' and 'AsyncIterable<number>' are incompatible.
!!! error TS2322: The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types.
!!! error TS2322: Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
yield "a";
};
const assignability5: () => AsyncIterable<number> = async function * () {
@ -123,13 +106,9 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(
const assignability6: () => AsyncIterable<number> = async function * () {
~~~~~~~~~~~~~~
!!! error TS2322: Type '() => AsyncGenerator<string, void, unknown>' is not assignable to type '() => AsyncIterable<number>'.
!!! error TS2322: Type 'AsyncGenerator<string, void, unknown>' is not assignable to type 'AsyncIterable<number>'.
!!! error TS2322: Types of property '[Symbol.asyncIterator]' are incompatible.
!!! error TS2322: Type '() => AsyncGenerator<string, void, unknown>' is not assignable to type '() => AsyncIterator<number, any, undefined>'.
!!! error TS2322: Type 'AsyncGenerator<string, void, unknown>' is not assignable to type 'AsyncIterator<number, any, undefined>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '(...args: [] | [unknown]) => Promise<IteratorResult<string, void>>' is not assignable to type '(...args: [] | [undefined]) => Promise<IteratorResult<number, any>>'.
!!! error TS2322: Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
!!! error TS2322: Call signature return types 'AsyncGenerator<string, void, unknown>' and 'AsyncIterable<number>' are incompatible.
!!! error TS2322: The types returned by '[Symbol.asyncIterator]().next(...)' are incompatible between these types.
!!! error TS2322: Type 'Promise<IteratorResult<string, void>>' is not assignable to type 'Promise<IteratorResult<number, any>>'.
yield* (async function * () { yield "a"; })();
};
const assignability7: () => AsyncIterator<number> = async function * () {
@ -210,10 +189,9 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2018.2.ts(
async function * explicitReturnType12(): Iterator<number> {
~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'AsyncGenerator<number, any, undefined>' is not assignable to type 'Iterator<number, any, undefined>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '(...args: [] | [undefined]) => Promise<IteratorResult<number, any>>' is not assignable to type '(...args: [] | [undefined]) => IteratorResult<number, any>'.
!!! error TS2322: Type 'Promise<IteratorResult<number, any>>' is not assignable to type 'IteratorResult<number, any>'.
!!! error TS2322: Property 'value' is missing in type 'Promise<IteratorResult<number, any>>' but required in type 'IteratorYieldResult<number>'.
!!! error TS2322: The types returned by 'next(...)' are incompatible between these types.
!!! error TS2322: Type 'Promise<IteratorResult<number, any>>' is not assignable to type 'IteratorResult<number, any>'.
!!! error TS2322: Property 'value' is missing in type 'Promise<IteratorResult<number, any>>' but required in type 'IteratorYieldResult<number>'.
!!! related TS2728 /.ts/lib.es2015.iterable.d.ts:33:5: 'value' is declared here.
yield 1;
}

View File

@ -0,0 +1,15 @@
let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } };
let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } };
x = y;
class Ctor1 {
g = "ok"
}
class Ctor2 {
g = 12;
}
let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } };
let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } };
x2 = y2;

View File

@ -0,0 +1,7 @@
// @strict: true
type Cb<T> = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made
// which means the comparison will definitely be structural, rather than by variance
declare const x: Cb<Cb<Cb<Cb<number>>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check
declare let y: Cb<Cb<Cb<Cb<string>>>>;
y = x;