mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Put error spans deep on nested object literals (#25140)
* Add ncie deep elaborations * Nice stuff * Modify tuple error to use length error mroe often * Accept good baselines * Accept meh baselines * Fix literal types * Calculate elaborations like it was the very first time again~ * Use tristate for enum relationship to ensure elaborations are printed at least once * Update message text, nits * move some functions back to where they were * Add test of deep JSX elaboration * Add elaboration test with parenthesized expressions, comma expressions, and assignments * Move check to allow elaborations on more anonymous types * Fix nits * Add specialized error to elaborations of nonliteral computed named-members * Update error message
This commit is contained in:
+189
-49
@@ -598,7 +598,7 @@ namespace ts {
|
||||
const definitelyAssignableRelation = createMap<RelationComparisonResult>();
|
||||
const comparableRelation = createMap<RelationComparisonResult>();
|
||||
const identityRelation = createMap<RelationComparisonResult>();
|
||||
const enumRelation = createMap<boolean>();
|
||||
const enumRelation = createMap<RelationComparisonResult>();
|
||||
|
||||
type TypeSystemEntity = Symbol | Type | Signature;
|
||||
|
||||
@@ -10135,8 +10135,163 @@ namespace ts {
|
||||
return isTypeComparableTo(type1, type2) || isTypeComparableTo(type2, type1);
|
||||
}
|
||||
|
||||
function checkTypeAssignableTo(source: Type, target: Type, errorNode: Node | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined): boolean {
|
||||
return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain);
|
||||
function checkTypeAssignableTo(source: Type, target: Type, errorNode: Node | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined, errorOutputObject?: { error?: Diagnostic }): boolean {
|
||||
return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain, errorOutputObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like `checkTypeAssignableTo`, but if it would issue an error, instead performs structural comparisons of the types using the given expression node to
|
||||
* attempt to issue more specific errors on, for example, specific object literal properties or tuple members.
|
||||
*/
|
||||
function checkTypeAssignableToAndOptionallyElaborate(source: Type, target: Type, errorNode: Node | undefined, expr: Expression | undefined, headMessage?: DiagnosticMessage, containingMessageChain?: () => DiagnosticMessageChain | undefined): boolean {
|
||||
if (isTypeAssignableTo(source, target)) return true;
|
||||
if (!elaborateError(expr, source, target)) {
|
||||
return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function elaborateError(node: Expression | undefined, source: Type, target: Type): boolean {
|
||||
if (!node) return false;
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.JsxExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return elaborateError((node as ParenthesizedExpression | JsxExpression).expression, source, target);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
switch ((node as BinaryExpression).operatorToken.kind) {
|
||||
case SyntaxKind.EqualsToken:
|
||||
case SyntaxKind.CommaToken:
|
||||
return elaborateError((node as BinaryExpression).right, source, target);
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return elaborateObjectLiteral(node as ObjectLiteralExpression, source, target);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return elaborateArrayLiteral(node as ArrayLiteralExpression, source, target);
|
||||
case SyntaxKind.JsxAttributes:
|
||||
return elaborateJsxAttributes(node as JsxAttributes, source, target);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
type ElaborationIterator = IterableIterator<{ errorNode: Node, innerExpression: Expression | undefined, nameType: Type, errorMessage?: DiagnosticMessage | undefined }>;
|
||||
/**
|
||||
* For every element returned from the iterator, checks that element to issue an error on a property of that element's type
|
||||
* If that element would issue an error, we first attempt to dive into that element's inner expression and issue a more specific error by recuring into `elaborateError`
|
||||
* Otherwise, we issue an error on _every_ element which fail the assignability check
|
||||
*/
|
||||
function elaborateElementwise(iterator: ElaborationIterator, source: Type, target: Type) {
|
||||
// Assignability failure - check each prop individually, and if that fails, fall back on the bad error span
|
||||
let reportedError = false;
|
||||
for (let status = iterator.next(); !status.done; status = iterator.next()) {
|
||||
const { errorNode: prop, innerExpression: next, nameType, errorMessage } = status.value;
|
||||
const sourcePropType = getIndexedAccessType(source, nameType);
|
||||
const targetPropType = getIndexedAccessType(target, nameType);
|
||||
if (!isTypeAssignableTo(sourcePropType, targetPropType)) {
|
||||
const elaborated = next && elaborateError(next, sourcePropType, targetPropType);
|
||||
if (elaborated) {
|
||||
reportedError = true;
|
||||
}
|
||||
else {
|
||||
// Issue error on the prop itself, since the prop couldn't elaborate the error
|
||||
const resultObj: { error?: Diagnostic } = {};
|
||||
// Use the expression type, if available
|
||||
const specificSource = next ? checkExpressionForMutableLocation(next, CheckMode.Normal, sourcePropType) : sourcePropType;
|
||||
const result = checkTypeAssignableTo(specificSource, targetPropType, prop, errorMessage, /*containingChain*/ undefined, resultObj);
|
||||
if (result && specificSource !== sourcePropType) {
|
||||
// If for whatever reason the expression type doesn't yield an error, make sure we still issue an error on the sourcePropType
|
||||
checkTypeAssignableTo(sourcePropType, targetPropType, prop, errorMessage, /*containingChain*/ undefined, resultObj);
|
||||
}
|
||||
if (resultObj.error) {
|
||||
const reportedDiag = resultObj.error;
|
||||
const propertyName = isTypeUsableAsLateBoundName(nameType) ? getLateBoundNameFromType(nameType) : undefined;
|
||||
const targetProp = propertyName !== undefined ? getPropertyOfType(target, propertyName) : undefined;
|
||||
|
||||
let issuedElaboration = false;
|
||||
if (!targetProp) {
|
||||
const indexInfo = isTypeAssignableToKind(nameType, TypeFlags.NumberLike) && getIndexInfoOfType(target, IndexKind.Number) ||
|
||||
getIndexInfoOfType(target, IndexKind.String) ||
|
||||
undefined;
|
||||
if (indexInfo && indexInfo.declaration) {
|
||||
issuedElaboration = true;
|
||||
addRelatedInfo(reportedDiag, createDiagnosticForNode(indexInfo.declaration, Diagnostics.The_expected_type_comes_from_this_index_signature));
|
||||
}
|
||||
}
|
||||
|
||||
if (!issuedElaboration && (length(targetProp && targetProp.declarations) || length(target.symbol && target.symbol.declarations))) {
|
||||
addRelatedInfo(reportedDiag, createDiagnosticForNode(
|
||||
targetProp ? targetProp.declarations[0] : target.symbol.declarations[0],
|
||||
Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1,
|
||||
propertyName && !(nameType.flags & TypeFlags.UniqueESSymbol) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType),
|
||||
typeToString(target)
|
||||
));
|
||||
}
|
||||
}
|
||||
reportedError = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return reportedError;
|
||||
}
|
||||
|
||||
function *generateJsxAttributes(node: JsxAttributes): ElaborationIterator {
|
||||
if (!length(node.properties)) return;
|
||||
for (const prop of node.properties) {
|
||||
if (isJsxSpreadAttribute(prop)) continue;
|
||||
yield { errorNode: prop.name, innerExpression: prop.initializer, nameType: getLiteralType(idText(prop.name)) };
|
||||
}
|
||||
}
|
||||
|
||||
function elaborateJsxAttributes(node: JsxAttributes, source: Type, target: Type) {
|
||||
return elaborateElementwise(generateJsxAttributes(node), source, target);
|
||||
}
|
||||
|
||||
function *generateLimitedTupleElements(node: ArrayLiteralExpression, target: Type): ElaborationIterator {
|
||||
const len = length(node.elements);
|
||||
if (!len) return;
|
||||
for (let i = 0; i < len; i++) {
|
||||
// Skip elements which do not exist in the target - a length error on the tuple overall is likely better than an error on a mismatched index signature
|
||||
if (isTupleLikeType(target) && !getPropertyOfType(target, ("" + i) as __String)) continue;
|
||||
const elem = node.elements[i];
|
||||
if (isOmittedExpression(elem)) continue;
|
||||
const nameType = getLiteralType(i);
|
||||
yield { errorNode: elem, innerExpression: elem, nameType };
|
||||
}
|
||||
}
|
||||
|
||||
function elaborateArrayLiteral(node: ArrayLiteralExpression, source: Type, target: Type) {
|
||||
if (isTupleLikeType(source)) {
|
||||
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function *generateObjectLiteralElements(node: ObjectLiteralExpression): ElaborationIterator {
|
||||
if (!length(node.properties)) return;
|
||||
for (const prop of node.properties) {
|
||||
if (isSpreadAssignment(prop)) continue;
|
||||
const type = getLiteralTypeFromPropertyName(getSymbolOfNode(prop), TypeFlags.StringOrNumberLiteralOrUnique);
|
||||
if (!type || (type.flags & TypeFlags.Never)) {
|
||||
continue;
|
||||
}
|
||||
switch (prop.kind) {
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
yield { errorNode: prop.name, innerExpression: undefined, nameType: type };
|
||||
break;
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
yield { errorNode: prop.name, innerExpression: prop.initializer, nameType: type, errorMessage: isComputedNonLiteralName(prop.name) ? Diagnostics.Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1 : undefined };
|
||||
break;
|
||||
default:
|
||||
Debug.assertNever(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function elaborateObjectLiteral(node: ObjectLiteralExpression, source: Type, target: Type) {
|
||||
return elaborateElementwise(generateObjectLiteralElements(node), source, target);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -10351,11 +10506,11 @@ namespace ts {
|
||||
}
|
||||
const id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol);
|
||||
const relation = enumRelation.get(id);
|
||||
if (relation !== undefined) {
|
||||
return relation;
|
||||
if (relation !== undefined && !(relation === RelationComparisonResult.Failed && errorReporter)) {
|
||||
return relation === RelationComparisonResult.Succeeded;
|
||||
}
|
||||
if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & SymbolFlags.RegularEnum) || !(targetSymbol.flags & SymbolFlags.RegularEnum)) {
|
||||
enumRelation.set(id, false);
|
||||
enumRelation.set(id, RelationComparisonResult.FailedAndReported);
|
||||
return false;
|
||||
}
|
||||
const targetEnumType = getTypeOfSymbol(targetSymbol);
|
||||
@@ -10366,13 +10521,16 @@ namespace ts {
|
||||
if (errorReporter) {
|
||||
errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property),
|
||||
typeToString(getDeclaredTypeOfSymbol(targetSymbol), /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType));
|
||||
enumRelation.set(id, RelationComparisonResult.FailedAndReported);
|
||||
}
|
||||
else {
|
||||
enumRelation.set(id, RelationComparisonResult.Failed);
|
||||
}
|
||||
enumRelation.set(id, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
enumRelation.set(id, true);
|
||||
enumRelation.set(id, RelationComparisonResult.Succeeded);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10457,7 +10615,9 @@ namespace ts {
|
||||
relation: Map<RelationComparisonResult>,
|
||||
errorNode: Node | undefined,
|
||||
headMessage?: DiagnosticMessage,
|
||||
containingMessageChain?: () => DiagnosticMessageChain | undefined): boolean {
|
||||
containingMessageChain?: () => DiagnosticMessageChain | undefined,
|
||||
errorOutputContainer?: { error?: Diagnostic }
|
||||
): boolean {
|
||||
|
||||
let errorInfo: DiagnosticMessageChain | undefined;
|
||||
let maybeKeys: string[];
|
||||
@@ -10497,7 +10657,11 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
diagnostics.add(createDiagnosticForNodeFromMessageChain(errorNode!, errorInfo, relatedInformation)); // TODO: GH#18217
|
||||
const diag = createDiagnosticForNodeFromMessageChain(errorNode!, errorInfo, relatedInformation);
|
||||
if (errorOutputContainer) {
|
||||
errorOutputContainer.error = diag;
|
||||
}
|
||||
diagnostics.add(diag); // TODO: GH#18217
|
||||
}
|
||||
return result !== Ternary.False;
|
||||
|
||||
@@ -11019,9 +11183,8 @@ namespace ts {
|
||||
const related = relation.get(id);
|
||||
if (related !== undefined) {
|
||||
if (reportErrors && related === RelationComparisonResult.Failed) {
|
||||
// We are elaborating errors and the cached result is an unreported failure. Record the result as a reported
|
||||
// failure and continue computing the relation such that errors get reported.
|
||||
relation.set(id, RelationComparisonResult.FailedAndReported);
|
||||
// We are elaborating errors and the cached result is an unreported failure. The result will be reported
|
||||
// as a failure, and should be updated as a reported failure by the bottom of this function.
|
||||
}
|
||||
else {
|
||||
return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False;
|
||||
@@ -15636,7 +15799,7 @@ namespace ts {
|
||||
const discriminatingType = checkExpression(prop.initializer);
|
||||
for (const type of (contextualType as UnionType).types) {
|
||||
const targetType = getTypeOfPropertyOfType(type, prop.symbol.escapedName);
|
||||
if (targetType && checkTypeAssignableTo(discriminatingType, targetType, /*errorNode*/ undefined)) {
|
||||
if (targetType && isTypeAssignableTo(discriminatingType, targetType)) {
|
||||
if (match) {
|
||||
if (type === match) continue; // Finding multiple fields which discriminate to the same type is fine
|
||||
match = undefined;
|
||||
@@ -17153,30 +17316,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else if (!isSourceAttributeTypeAssignableToTarget) {
|
||||
// Assignability failure - check each prop individually, and if that fails, fall back on the bad error span
|
||||
if (length(openingLikeElement.attributes.properties)) {
|
||||
let reportedError = false;
|
||||
for (const prop of openingLikeElement.attributes.properties) {
|
||||
if (isJsxSpreadAttribute(prop)) continue;
|
||||
const name = idText(prop.name);
|
||||
const sourcePropType = getIndexedAccessType(sourceAttributesType, getLiteralType(name));
|
||||
const targetPropType = getIndexedAccessType(targetAttributesType, getLiteralType(name));
|
||||
const rootChain = () => chainDiagnosticMessages(
|
||||
/*details*/ undefined,
|
||||
Diagnostics.Types_of_property_0_are_incompatible,
|
||||
name,
|
||||
);
|
||||
if (!checkTypeAssignableTo(sourcePropType, targetPropType, prop, /*headMessage*/ undefined, rootChain)) {
|
||||
reportedError = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (reportedError) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Report fallback error on just the component name
|
||||
checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.tagName);
|
||||
checkTypeAssignableToAndOptionallyElaborate(sourceAttributesType, targetAttributesType, openingLikeElement.tagName, openingLikeElement.attributes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20160,10 +20300,10 @@ namespace ts {
|
||||
if (returnOrPromisedType) {
|
||||
if ((functionFlags & FunctionFlags.AsyncGenerator) === FunctionFlags.Async) { // Async function
|
||||
const awaitedType = checkAwaitedType(exprType, node.body, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
|
||||
checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body);
|
||||
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, node.body, node.body);
|
||||
}
|
||||
else { // Normal function
|
||||
checkTypeAssignableTo(exprType, returnOrPromisedType, node.body);
|
||||
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, node.body, node.body);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20581,7 +20721,7 @@ namespace ts {
|
||||
Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
|
||||
Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
|
||||
if (checkReferenceExpression(target, error)) {
|
||||
checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined);
|
||||
checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target);
|
||||
}
|
||||
return sourceType;
|
||||
}
|
||||
@@ -20880,7 +21020,7 @@ namespace ts {
|
||||
if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)
|
||||
&& (!isIdentifier(left) || unescapeLeadingUnderscores(left.escapedText) !== "exports")) {
|
||||
// to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported
|
||||
checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined);
|
||||
checkTypeAssignableToAndOptionallyElaborate(valueType, leftType, left, right);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20992,7 +21132,7 @@ namespace ts {
|
||||
const returnType = getEffectiveReturnTypeNode(func);
|
||||
if (returnType) {
|
||||
const signatureElementType = getIteratedTypeOfGenerator(getTypeFromTypeNode(returnType), isAsync) || anyType;
|
||||
checkTypeAssignableTo(yieldedType, signatureElementType, node.expression || node, /*headMessage*/ undefined);
|
||||
checkTypeAssignableToAndOptionallyElaborate(yieldedType, signatureElementType, node.expression || node, node.expression);
|
||||
}
|
||||
|
||||
// Both yield and yield* expressions have type 'any'
|
||||
@@ -23713,7 +23853,7 @@ namespace ts {
|
||||
checkNonNullType(initializerType, node);
|
||||
}
|
||||
else {
|
||||
checkTypeAssignableTo(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined);
|
||||
checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer);
|
||||
}
|
||||
checkParameterInitializer(node);
|
||||
}
|
||||
@@ -23731,7 +23871,7 @@ namespace ts {
|
||||
(initializer.properties.length === 0 || isPrototypeAccess(node.name)) &&
|
||||
hasEntries(symbol.exports);
|
||||
if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== SyntaxKind.ForInStatement) {
|
||||
checkTypeAssignableTo(checkExpressionCached(initializer), type, node, /*headMessage*/ undefined);
|
||||
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined);
|
||||
checkParameterInitializer(node);
|
||||
}
|
||||
}
|
||||
@@ -23747,7 +23887,7 @@ namespace ts {
|
||||
errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType);
|
||||
}
|
||||
if (node.initializer) {
|
||||
checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined);
|
||||
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, /*headMessage*/ undefined);
|
||||
}
|
||||
if (!areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) {
|
||||
error(getNameOfDeclaration(symbol.valueDeclaration), Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name));
|
||||
@@ -23920,7 +24060,7 @@ namespace ts {
|
||||
// because we accessed properties from anyType, or it may have led to an error inside
|
||||
// getElementTypeOfIterable.
|
||||
if (iteratedType) {
|
||||
checkTypeAssignableTo(iteratedType, leftType, varExpr, /*headMessage*/ undefined);
|
||||
checkTypeAssignableToAndOptionallyElaborate(iteratedType, leftType, varExpr, node.expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24364,7 +24504,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else if (func.kind === SyntaxKind.Constructor) {
|
||||
if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) {
|
||||
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
|
||||
error(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
|
||||
}
|
||||
}
|
||||
@@ -24380,7 +24520,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
checkTypeAssignableTo(exprType, returnType, node);
|
||||
checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1452,6 +1452,10 @@
|
||||
"category": "Error",
|
||||
"code": 2417
|
||||
},
|
||||
"Type of computed property's value is '{0}', which is not assignable to type '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2418
|
||||
},
|
||||
"Class '{0}' incorrectly implements interface '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 2420
|
||||
@@ -3754,6 +3758,15 @@
|
||||
"code": 6371
|
||||
},
|
||||
|
||||
"The expected type comes from property '{0}' which is declared here on type '{1}'": {
|
||||
"category": "Message",
|
||||
"code": 6500
|
||||
},
|
||||
"The expected type comes from this index signature.": {
|
||||
"category": "Message",
|
||||
"code": 6501
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
"code": 7005
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"pretty": true,
|
||||
"lib": ["es5"],
|
||||
"lib": ["es2015"],
|
||||
"target": "es5",
|
||||
|
||||
"declaration": true,
|
||||
|
||||
@@ -5193,6 +5193,7 @@ declare namespace ts {
|
||||
Class_0_incorrectly_extends_base_class_1: DiagnosticMessage;
|
||||
Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2: DiagnosticMessage;
|
||||
Class_static_side_0_incorrectly_extends_base_class_static_side_1: DiagnosticMessage;
|
||||
Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1: DiagnosticMessage;
|
||||
Class_0_incorrectly_implements_interface_1: DiagnosticMessage;
|
||||
A_class_may_only_implement_another_class_or_interface: DiagnosticMessage;
|
||||
Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: DiagnosticMessage;
|
||||
@@ -5765,6 +5766,8 @@ declare namespace ts {
|
||||
Option_build_must_be_the_first_command_line_argument: DiagnosticMessage;
|
||||
Options_0_and_1_cannot_be_combined: DiagnosticMessage;
|
||||
Skipping_clean_because_not_all_projects_could_be_located: DiagnosticMessage;
|
||||
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: DiagnosticMessage;
|
||||
The_expected_type_comes_from_this_index_signature: DiagnosticMessage;
|
||||
Variable_0_implicitly_has_an_1_type: DiagnosticMessage;
|
||||
Parameter_0_implicitly_has_an_1_type: DiagnosticMessage;
|
||||
Member_0_implicitly_has_an_1_type: DiagnosticMessage;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(10,5): error TS2322: Type '[]' is not assignable to type '[any, any, any]'.
|
||||
Property '0' is missing in type '[]'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,5): error TS2322: Type '[string, number, boolean]' is not assignable to type '[boolean, string, number]'.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,38): error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,48): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,51): error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'.
|
||||
Types of property 'length' are incompatible.
|
||||
Type '4' is not assignable to type '2'.
|
||||
@@ -18,7 +19,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
|
||||
'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (6 errors) ====
|
||||
==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (8 errors) ====
|
||||
// Each element expression in a non-empty array literal is processed as follows:
|
||||
// - If the array literal contains no spread elements, and if the array literal is contextually typed (section 4.19)
|
||||
// by a type T and T has a property with the numeric name N, where N is the index of the element expression in the array literal,
|
||||
@@ -33,9 +34,12 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
|
||||
!!! error TS2322: Type '[]' is not assignable to type '[any, any, any]'.
|
||||
!!! error TS2322: Property '0' is missing in type '[]'.
|
||||
var a1: [boolean, string, number] = ["string", 1, true]; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '[string, number, boolean]' is not assignable to type '[boolean, string, number]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~~~
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
|
||||
// The resulting type an array literal expression is determined as follows:
|
||||
// - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1),
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
tests/cases/compiler/assignmentToObjectAndFunction.ts(1,5): error TS2322: Type '{ toString: number; }' is not assignable to type 'Object'.
|
||||
Types of property 'toString' are incompatible.
|
||||
Type 'number' is not assignable to type '() => string'.
|
||||
tests/cases/compiler/assignmentToObjectAndFunction.ts(1,24): error TS2322: Type 'number' is not assignable to type '() => string'.
|
||||
tests/cases/compiler/assignmentToObjectAndFunction.ts(8,5): error TS2322: Type '{}' is not assignable to type 'Function'.
|
||||
Property 'apply' is missing in type '{}'.
|
||||
tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type 'typeof bad' is not assignable to type 'Function'.
|
||||
@@ -10,10 +8,9 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type
|
||||
|
||||
==== tests/cases/compiler/assignmentToObjectAndFunction.ts (3 errors) ====
|
||||
var errObj: Object = { toString: 0 }; // Error, incompatible toString
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '{ toString: number; }' 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'.
|
||||
!!! related TS6500 /.ts/lib.es5.d.ts:125:5: The expected type comes from property 'toString' which is declared here on type 'Object'
|
||||
var goodObj: Object = {
|
||||
toString(x?) {
|
||||
return "";
|
||||
|
||||
@@ -6,15 +6,9 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(17,1): error TS2539: Cannot assign to 'M' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(18,2): error TS2539: Cannot assign to 'M' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(25,5): error TS2539: Cannot assign to 'M3' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(31,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(32,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(33,1): error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(31,11): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(32,13): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(33,13): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(37,1): error TS2539: Cannot assign to 'fn' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(38,2): error TS2539: Cannot assign to 'fn' because it is not a variable.
|
||||
tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts(43,5): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
@@ -78,20 +72,17 @@ tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesize
|
||||
(M2.M3) = { x: 3 }; // OK
|
||||
|
||||
M2.M3 = { x: '' }; // Error
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
|
||||
!!! error TS2322: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts:22:20: The expected type comes from property 'x' which is declared here on type 'typeof M3'
|
||||
(M2).M3 = { x: '' }; // Error
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
|
||||
!!! error TS2322: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts:22:20: The expected type comes from property 'x' which is declared here on type 'typeof M3'
|
||||
(M2.M3) = { x: '' }; // Error
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '{ x: string; }' is not assignable to type 'typeof M3'.
|
||||
!!! error TS2322: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/expressions/valuesAndReferences/assignmentToParenthesizedIdentifiers.ts:22:20: The expected type comes from property 'x' which is declared here on type 'typeof M3'
|
||||
|
||||
|
||||
function fn() { }
|
||||
|
||||
@@ -5,7 +5,6 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(8,5): error TS2416: Prop
|
||||
Types of property 'n' are incompatible.
|
||||
Type 'string | Derived' is not assignable to type 'string | Base'.
|
||||
Type 'Derived' is not assignable to type 'string | Base'.
|
||||
Type 'Derived' is not assignable to type 'Base'.
|
||||
tests/cases/compiler/baseClassImprovedMismatchErrors.ts(9,5): error TS2416: Property 'fn' in type 'Derived' is not assignable to the same property in base type 'Base'.
|
||||
Type '() => string | number' is not assignable to type '() => number'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
@@ -17,7 +16,6 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(14,5): error TS2416: Pro
|
||||
Types of property 'n' are incompatible.
|
||||
Type 'string | DerivedInterface' is not assignable to type 'string | Base'.
|
||||
Type 'DerivedInterface' is not assignable to type 'string | Base'.
|
||||
Type 'DerivedInterface' is not assignable to type 'Base'.
|
||||
tests/cases/compiler/baseClassImprovedMismatchErrors.ts(15,5): error TS2416: Property 'fn' in type 'DerivedInterface' is not assignable to the same property in base type 'Base'.
|
||||
Type '() => string | number' is not assignable to type '() => number'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
@@ -41,7 +39,6 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(15,5): error TS2416: Pro
|
||||
!!! error TS2416: Types of property 'n' are incompatible.
|
||||
!!! error TS2416: Type 'string | Derived' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: Type 'Derived' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: Type 'Derived' is not assignable to type 'Base'.
|
||||
fn() {
|
||||
~~
|
||||
!!! error TS2416: Property 'fn' in type 'Derived' is not assignable to the same property in base type 'Base'.
|
||||
@@ -61,7 +58,6 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(15,5): error TS2416: Pro
|
||||
!!! error TS2416: Types of property 'n' are incompatible.
|
||||
!!! error TS2416: Type 'string | DerivedInterface' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: Type 'DerivedInterface' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: Type 'DerivedInterface' is not assignable to type 'Base'.
|
||||
fn() {
|
||||
~~
|
||||
!!! error TS2416: Property 'fn' in type 'DerivedInterface' is not assignable to the same property in base type 'Base'.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
tests/cases/conformance/jsx/file.tsx(13,54): error TS2326: Types of property 'nextValues' are incompatible.
|
||||
Type '(a: { x: string; }) => string' is not assignable to type '(cur: { x: string; }) => { x: string; }'.
|
||||
Type 'string' is not assignable to type '{ x: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(13,54): error TS2322: Type '(a: { x: string; }) => string' is not assignable to type '(cur: { x: string; }) => { x: string; }'.
|
||||
Type 'string' is not assignable to type '{ x: string; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
|
||||
@@ -17,7 +16,7 @@ tests/cases/conformance/jsx/file.tsx(13,54): error TS2326: Types of property 'ne
|
||||
let b = <GenericComponent initialValues={12} nextValues={a => a} />; // No error - Values should be reinstantiated with `number` (since `object` is a default, not a constraint)
|
||||
let c = <GenericComponent initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} />; // No Error
|
||||
let d = <GenericComponent initialValues={{ x: "y" }} nextValues={a => a.x} />; // Error - `string` is not assignable to `{x: string}`
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'nextValues' are incompatible.
|
||||
!!! error TS2326: Type '(a: { x: string; }) => string' is not assignable to type '(cur: { x: string; }) => { x: string; }'.
|
||||
!!! error TS2326: Type 'string' is not assignable to type '{ x: string; }'.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '(a: { x: string; }) => string' is not assignable to type '(cur: { x: string; }) => { x: string; }'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '{ x: string; }'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:13:54: The expected type comes from property 'nextValues' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<GenericComponent<{ initialValues: { x: string; }; nextValues: {}; }, { x: string; }>> & { initialValues: { x: string; }; nextValues: {}; } & BaseProps<{ x: string; }> & { children?: ReactNode; }'
|
||||
@@ -1,21 +1,20 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'.
|
||||
Index signatures are incompatible.
|
||||
Type 'string | number' is not assignable to type 'boolean'.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(7,5): error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(8,5): error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (2 errors) ====
|
||||
interface I {
|
||||
[s: string]: boolean;
|
||||
[s: number]: boolean;
|
||||
}
|
||||
|
||||
var o: I = {
|
||||
~
|
||||
!!! error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
[""+"foo"]: "",
|
||||
~~~~~~~~~~
|
||||
!!! error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'.
|
||||
!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts:2:5: The expected type comes from this index signature.
|
||||
[""+"bar"]: 0
|
||||
~~~~~~~~~~
|
||||
!!! error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'.
|
||||
!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts:2:5: The expected type comes from this index signature.
|
||||
}
|
||||
@@ -1,21 +1,20 @@
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'.
|
||||
Index signatures are incompatible.
|
||||
Type 'string | number' is not assignable to type 'boolean'.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(7,5): error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(8,5): error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts (2 errors) ====
|
||||
interface I {
|
||||
[s: string]: boolean;
|
||||
[s: number]: boolean;
|
||||
}
|
||||
|
||||
var o: I = {
|
||||
~
|
||||
!!! error TS2322: Type '{ [x: string]: string | number; }' is not assignable to type 'I'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
[""+"foo"]: "",
|
||||
~~~~~~~~~~
|
||||
!!! error TS2418: Type of computed property's value is 'string', which is not assignable to type 'boolean'.
|
||||
!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts:2:5: The expected type comes from this index signature.
|
||||
[""+"bar"]: 0
|
||||
~~~~~~~~~~
|
||||
!!! error TS2418: Type of computed property's value is 'number', which is not assignable to type 'boolean'.
|
||||
!!! related TS6501 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts:2:5: The expected type comes from this index signature.
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2322: Type '1' is not assignable to type 'D'.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2322: Type '{ x: number; }' is not assignable to type 'F<T>'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'T'.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,18): error TS2322: Type 'number' is not assignable to type 'T'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts (4 errors) ====
|
||||
@@ -38,11 +36,10 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl
|
||||
constructor() {
|
||||
return { x: 1 }; // error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ x: number; }' is not assignable to type 'F<T>'.
|
||||
!!! error TS2322: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'T'.
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'T'.
|
||||
!!! related TS6500 tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts:24:5: The expected type comes from property 'x' which is declared here on type 'F<T>'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
tests/cases/compiler/contextualTypeAny.ts(3,5): error TS2322: Type '{ p: string; q: any; }' is not assignable to type '{ [s: string]: number; }'.
|
||||
Property 'p' is incompatible with index signature.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/contextualTypeAny.ts(3,38): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTypeAny.ts (1 errors) ====
|
||||
var x: any;
|
||||
|
||||
var obj: { [s: string]: number } = { p: "", q: x };
|
||||
~~~
|
||||
!!! error TS2322: Type '{ p: string; q: any; }' is not assignable to type '{ [s: string]: number; }'.
|
||||
!!! error TS2322: Property 'p' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6501 tests/cases/compiler/contextualTypeAny.ts:3:12: The expected type comes from this index signature.
|
||||
|
||||
var arr: number[] = ["", x];
|
||||
@@ -2,9 +2,8 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS232
|
||||
Types of property 'length' are incompatible.
|
||||
Type '3' is not assignable to type '2'.
|
||||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(15,1): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
|
||||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(18,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'.
|
||||
Type '{}' is not assignable to type '{ a: string; }'.
|
||||
Property 'a' is missing in type '{}'.
|
||||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(18,17): error TS2322: Type '{}' is not assignable to type '{ a: string; }'.
|
||||
Property 'a' is missing in type '{}'.
|
||||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(19,1): error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]'.
|
||||
Property '2' is missing in type '[number, string]'.
|
||||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(20,5): error TS2322: Type '[string, string, number]' is not assignable to type '[string, string]'.
|
||||
@@ -45,10 +44,9 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(25,1): error TS23
|
||||
|
||||
// error
|
||||
objNumTuple = [ {}, 5];
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'.
|
||||
!!! error TS2322: Type '{}' is not assignable to type '{ a: string; }'.
|
||||
!!! error TS2322: Property 'a' is missing in type '{}'.
|
||||
~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type '{ a: string; }'.
|
||||
!!! error TS2322: Property 'a' is missing in type '{}'.
|
||||
numStrBoolTuple = numStrTuple;
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '[number, string]' is not assignable to type '[number, string, boolean]'.
|
||||
|
||||
@@ -21,12 +21,10 @@ tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(
|
||||
Types of property 'prop' are incompatible.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(57,5): error TS2322: Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I11 | I21'.
|
||||
Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I21'.
|
||||
Types of property 'commonMethodDifferentReturnType' are incompatible.
|
||||
Type '(a: string, b: number) => string | number' is not assignable to type '(a: string, b: number) => number'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(58,5): error TS2322: Type '(a: string, b: number) => string | number' is not assignable to type '((a: string, b: number) => string) | ((a: string, b: number) => number)'.
|
||||
Type '(a: string, b: number) => string | number' is not assignable to type '(a: string, b: number) => number'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts (6 errors) ====
|
||||
@@ -115,12 +113,11 @@ tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(
|
||||
};
|
||||
var strOrNumber: string | number;
|
||||
var i11Ori21: I11 | I21 = { // Like i1 and i2 both
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I11 | I21'.
|
||||
!!! error TS2322: Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I21'.
|
||||
!!! error TS2322: Types of property 'commonMethodDifferentReturnType' are incompatible.
|
||||
!!! error TS2322: Type '(a: string, b: number) => string | number' is not assignable to type '(a: string, b: number) => number'.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
commonMethodDifferentReturnType: (a, b) => strOrNumber,
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(a: string, b: number) => string | number' is not assignable to type '((a: string, b: number) => string) | ((a: string, b: number) => number)'.
|
||||
!!! error TS2322: Type '(a: string, b: number) => string | number' is not assignable to type '(a: string, b: number) => number'.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts:35:5: The expected type comes from property 'commonMethodDifferentReturnType' which is declared here on type 'I11 | I21'
|
||||
};
|
||||
@@ -4,14 +4,11 @@ tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTyp
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(6,25): error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(11,23): error TS2322: Type '{ show: (v: number) => number; }' is not assignable to type 'Show'.
|
||||
Types of property 'show' are incompatible.
|
||||
Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(11,40): error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(16,23): error TS2322: Type '(arg: string) => number' is not assignable to type '(s: string) => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(21,14): error TS2322: Type '[number, number]' is not assignable to type '[string, number]'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(21,22): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(26,14): error TS2322: Type '"baz"' is not assignable to type '"foo" | "bar"'.
|
||||
|
||||
|
||||
@@ -36,11 +33,10 @@ tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTyp
|
||||
nested: Show
|
||||
}
|
||||
function ff({ nested: nestedRename = { show: v => v } }: Nested) {}
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ show: (v: number) => number; }' is not assignable to type 'Show'.
|
||||
!!! error TS2322: Types of property 'show' are incompatible.
|
||||
!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~~~
|
||||
!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts:2:5: The expected type comes from property 'show' which is declared here on type 'Show'
|
||||
|
||||
interface StringIdentity {
|
||||
stringIdentity(s: string): string;
|
||||
@@ -54,9 +50,8 @@ tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTyp
|
||||
prop: [string, number];
|
||||
}
|
||||
function g({ prop = [101, 1234] }: Tuples) {}
|
||||
~~~~
|
||||
!!! error TS2322: Type '[number, number]' is not assignable to type '[string, number]'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
interface StringUnion {
|
||||
prop: "foo" | "bar";
|
||||
|
||||
+8
-10
@@ -1,7 +1,5 @@
|
||||
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(15,15): error TS2326: Types of property 'foo' are incompatible.
|
||||
Type '"f"' is not assignable to type '"A" | "B" | "C"'.
|
||||
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(16,15): error TS2326: Types of property 'foo' are incompatible.
|
||||
Type '"f"' is not assignable to type '"A" | "B" | "C"'.
|
||||
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(15,15): error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
|
||||
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(16,15): error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx (2 errors) ====
|
||||
@@ -20,10 +18,10 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStr
|
||||
<FooComponent foo="A" />;
|
||||
|
||||
<FooComponent foo={"f"} />;
|
||||
~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'foo' are incompatible.
|
||||
!!! error TS2326: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
|
||||
~~~
|
||||
!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
|
||||
!!! related TS6500 tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx:10:32: The expected type comes from property 'foo' which is declared here on type '{ foo: "A" | "B" | "C"; }'
|
||||
<FooComponent foo="f" />;
|
||||
~~~~~~~
|
||||
!!! error TS2326: Types of property 'foo' are incompatible.
|
||||
!!! error TS2326: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
|
||||
~~~
|
||||
!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
|
||||
!!! related TS6500 tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx:10:32: The expected type comes from property 'foo' which is declared here on type '{ foo: "A" | "B" | "C"; }'
|
||||
@@ -0,0 +1,61 @@
|
||||
[96mtests/cases/compiler/deeplyNestedAssignabilityIssue.ts[0m:[93m22[0m:[93m17[0m - [91merror[0m[90m TS2322: [0mType '{}' is not assignable to type 'A'.
|
||||
Property 'a' is missing in type '{}'.
|
||||
|
||||
[30;47m22[0m thing: {}
|
||||
[30;47m [0m [91m ~~~~~[0m
|
||||
|
||||
[96mtests/cases/compiler/deeplyNestedAssignabilityIssue.ts[0m:[93m9[0m:[93m17[0m
|
||||
[30;47m9[0m thing: A;
|
||||
[30;47m [0m [96m ~~~~~[0m
|
||||
The expected type comes from property 'thing' which is declared here on type '{ thing: A; }'
|
||||
[96mtests/cases/compiler/deeplyNestedAssignabilityIssue.ts[0m:[93m25[0m:[93m17[0m - [91merror[0m[90m TS2322: [0mType '{}' is not assignable to type 'A'.
|
||||
Property 'a' is missing in type '{}'.
|
||||
|
||||
[30;47m25[0m another: {}
|
||||
[30;47m [0m [91m ~~~~~~~[0m
|
||||
|
||||
[96mtests/cases/compiler/deeplyNestedAssignabilityIssue.ts[0m:[93m12[0m:[93m17[0m
|
||||
[30;47m12[0m another: A;
|
||||
[30;47m [0m [96m ~~~~~~~[0m
|
||||
The expected type comes from property 'another' which is declared here on type '{ another: A; }'
|
||||
|
||||
|
||||
==== tests/cases/compiler/deeplyNestedAssignabilityIssue.ts (2 errors) ====
|
||||
interface A {
|
||||
a: number;
|
||||
}
|
||||
|
||||
interface Large {
|
||||
something: {
|
||||
another: {
|
||||
more: {
|
||||
thing: A;
|
||||
}
|
||||
yetstill: {
|
||||
another: A;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const x: Large = {
|
||||
something: {
|
||||
another: {
|
||||
more: {
|
||||
thing: {}
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'A'.
|
||||
!!! error TS2322: Property 'a' is missing in type '{}'.
|
||||
!!! related TS6500 tests/cases/compiler/deeplyNestedAssignabilityIssue.ts:9:17: The expected type comes from property 'thing' which is declared here on type '{ thing: A; }'
|
||||
},
|
||||
yetstill: {
|
||||
another: {}
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'A'.
|
||||
!!! error TS2322: Property 'a' is missing in type '{}'.
|
||||
!!! related TS6500 tests/cases/compiler/deeplyNestedAssignabilityIssue.ts:12:17: The expected type comes from property 'another' which is declared here on type '{ another: A; }'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
//// [deeplyNestedAssignabilityIssue.ts]
|
||||
interface A {
|
||||
a: number;
|
||||
}
|
||||
|
||||
interface Large {
|
||||
something: {
|
||||
another: {
|
||||
more: {
|
||||
thing: A;
|
||||
}
|
||||
yetstill: {
|
||||
another: A;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const x: Large = {
|
||||
something: {
|
||||
another: {
|
||||
more: {
|
||||
thing: {}
|
||||
},
|
||||
yetstill: {
|
||||
another: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [deeplyNestedAssignabilityIssue.js]
|
||||
var x = {
|
||||
something: {
|
||||
another: {
|
||||
more: {
|
||||
thing: {}
|
||||
},
|
||||
yetstill: {
|
||||
another: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
=== tests/cases/compiler/deeplyNestedAssignabilityIssue.ts ===
|
||||
interface A {
|
||||
>A : Symbol(A, Decl(deeplyNestedAssignabilityIssue.ts, 0, 0))
|
||||
|
||||
a: number;
|
||||
>a : Symbol(A.a, Decl(deeplyNestedAssignabilityIssue.ts, 0, 13))
|
||||
}
|
||||
|
||||
interface Large {
|
||||
>Large : Symbol(Large, Decl(deeplyNestedAssignabilityIssue.ts, 2, 1))
|
||||
|
||||
something: {
|
||||
>something : Symbol(Large.something, Decl(deeplyNestedAssignabilityIssue.ts, 4, 17))
|
||||
|
||||
another: {
|
||||
>another : Symbol(another, Decl(deeplyNestedAssignabilityIssue.ts, 5, 16))
|
||||
|
||||
more: {
|
||||
>more : Symbol(more, Decl(deeplyNestedAssignabilityIssue.ts, 6, 18))
|
||||
|
||||
thing: A;
|
||||
>thing : Symbol(thing, Decl(deeplyNestedAssignabilityIssue.ts, 7, 19))
|
||||
>A : Symbol(A, Decl(deeplyNestedAssignabilityIssue.ts, 0, 0))
|
||||
}
|
||||
yetstill: {
|
||||
>yetstill : Symbol(yetstill, Decl(deeplyNestedAssignabilityIssue.ts, 9, 13))
|
||||
|
||||
another: A;
|
||||
>another : Symbol(another, Decl(deeplyNestedAssignabilityIssue.ts, 10, 23))
|
||||
>A : Symbol(A, Decl(deeplyNestedAssignabilityIssue.ts, 0, 0))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const x: Large = {
|
||||
>x : Symbol(x, Decl(deeplyNestedAssignabilityIssue.ts, 17, 5))
|
||||
>Large : Symbol(Large, Decl(deeplyNestedAssignabilityIssue.ts, 2, 1))
|
||||
|
||||
something: {
|
||||
>something : Symbol(something, Decl(deeplyNestedAssignabilityIssue.ts, 17, 18))
|
||||
|
||||
another: {
|
||||
>another : Symbol(another, Decl(deeplyNestedAssignabilityIssue.ts, 18, 16))
|
||||
|
||||
more: {
|
||||
>more : Symbol(more, Decl(deeplyNestedAssignabilityIssue.ts, 19, 18))
|
||||
|
||||
thing: {}
|
||||
>thing : Symbol(thing, Decl(deeplyNestedAssignabilityIssue.ts, 20, 19))
|
||||
|
||||
},
|
||||
yetstill: {
|
||||
>yetstill : Symbol(yetstill, Decl(deeplyNestedAssignabilityIssue.ts, 22, 14))
|
||||
|
||||
another: {}
|
||||
>another : Symbol(another, Decl(deeplyNestedAssignabilityIssue.ts, 23, 23))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
=== tests/cases/compiler/deeplyNestedAssignabilityIssue.ts ===
|
||||
interface A {
|
||||
>A : A
|
||||
|
||||
a: number;
|
||||
>a : number
|
||||
}
|
||||
|
||||
interface Large {
|
||||
>Large : Large
|
||||
|
||||
something: {
|
||||
>something : { another: { more: { thing: A; }; yetstill: { another: A; }; }; }
|
||||
|
||||
another: {
|
||||
>another : { more: { thing: A; }; yetstill: { another: A; }; }
|
||||
|
||||
more: {
|
||||
>more : { thing: A; }
|
||||
|
||||
thing: A;
|
||||
>thing : A
|
||||
>A : A
|
||||
}
|
||||
yetstill: {
|
||||
>yetstill : { another: A; }
|
||||
|
||||
another: A;
|
||||
>another : A
|
||||
>A : A
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const x: Large = {
|
||||
>x : Large
|
||||
>Large : Large
|
||||
>{ something: { another: { more: { thing: {} }, yetstill: { another: {} } } }} : { something: { another: { more: { thing: {}; }; yetstill: { another: {}; }; }; }; }
|
||||
|
||||
something: {
|
||||
>something : { another: { more: { thing: {}; }; yetstill: { another: {}; }; }; }
|
||||
>{ another: { more: { thing: {} }, yetstill: { another: {} } } } : { another: { more: { thing: {}; }; yetstill: { another: {}; }; }; }
|
||||
|
||||
another: {
|
||||
>another : { more: { thing: {}; }; yetstill: { another: {}; }; }
|
||||
>{ more: { thing: {} }, yetstill: { another: {} } } : { more: { thing: {}; }; yetstill: { another: {}; }; }
|
||||
|
||||
more: {
|
||||
>more : { thing: {}; }
|
||||
>{ thing: {} } : { thing: {}; }
|
||||
|
||||
thing: {}
|
||||
>thing : {}
|
||||
>{} : {}
|
||||
|
||||
},
|
||||
yetstill: {
|
||||
>yetstill : { another: {}; }
|
||||
>{ another: {} } : { another: {}; }
|
||||
|
||||
another: {}
|
||||
>another : {}
|
||||
>{} : {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(4,5): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,5): error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'.
|
||||
Type 'number' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,51): error TS2322: Type 'number' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(22,5): error TS2322: Type 'number[]' is not assignable to type '[number, number]'.
|
||||
Property '0' is missing in type 'number[]'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(23,5): error TS2322: Type 'number[]' is not assignable to type '[string, string]'.
|
||||
@@ -32,9 +31,8 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
|
||||
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
|
||||
// where N is the numeric index of E in the array assignment pattern, or
|
||||
var [b0, b1, b2]: [number, boolean, string] = [1, 2, "string"]; // Error
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
|
||||
interface J extends Array<Number> {
|
||||
2: number;
|
||||
}
|
||||
|
||||
@@ -1,28 +1,23 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,5): error TS2322: Type '{ a1: boolean; a2: number; }' is not assignable to type '{ a1: number; a2: string; }'.
|
||||
Types of property 'a1' are incompatible.
|
||||
Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,5): error TS2322: Type '[number, [[boolean]], true]' is not assignable to type '[number, [[string]], boolean]'.
|
||||
Type '[[boolean]]' is not assignable to type '[[string]]'.
|
||||
Type '[boolean]' is not assignable to type '[string]'.
|
||||
Type 'boolean' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,46): error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,56): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,61): error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(19,10): error TS2322: Type 'string[]' is not assignable to type 'number[]'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts (4 errors) ====
|
||||
// The type T associated with a destructuring variable declaration is determined as follows:
|
||||
// If the declaration includes a type annotation, T is that type.
|
||||
var {a1, a2}: { a1: number, a2: string } = { a1: true, a2: 1 } // Error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '{ a1: boolean; a2: number; }' is not assignable to type '{ a1: number; a2: string; }'.
|
||||
!!! error TS2322: Types of property 'a1' are incompatible.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
~~
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts:3:17: The expected type comes from property 'a1' which is declared here on type '{ a1: number; a2: string; }'
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts:3:29: The expected type comes from property 'a2' which is declared here on type '{ a1: number; a2: string; }'
|
||||
var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [[false]], true]; // Error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '[number, [[boolean]], true]' is not assignable to type '[number, [[string]], boolean]'.
|
||||
!!! error TS2322: Type '[[boolean]]' is not assignable to type '[[string]]'.
|
||||
!!! error TS2322: Type '[boolean]' is not assignable to type '[string]'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'false' is not assignable to type 'string'.
|
||||
|
||||
// The type T associated with a destructuring variable declaration is determined as follows:
|
||||
// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression.
|
||||
|
||||
@@ -8,9 +8,7 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd
|
||||
Property 'id' is missing in type 'D<{}>'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(42,5): error TS2322: Type 'C' is not assignable to type 'D<string>'.
|
||||
Property 'source' is missing in type 'C'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(43,5): error TS2322: Type '{ id: string; }' is not assignable to type 'I'.
|
||||
Types of property 'id' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(43,28): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(44,5): error TS2322: Type 'C' is not assignable to type '{ id: string; }'.
|
||||
Types of property 'id' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
@@ -93,10 +91,9 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd
|
||||
!!! error TS2322: Type 'C' is not assignable to type 'D<string>'.
|
||||
!!! error TS2322: Property 'source' is missing in type 'C'.
|
||||
var anObjectLiteral: I = { id: 'a string' };
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ id: string; }' is not assignable to type 'I'.
|
||||
!!! error TS2322: Types of property 'id' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts:2:5: The expected type comes from property 'id' which is declared here on type 'I'
|
||||
var anOtherObjectLiteral: { id: string } = new C();
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'C' is not assignable to type '{ id: string; }'.
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
tests/cases/compiler/fuzzy.ts(13,18): error TS2420: Class 'C' incorrectly implements interface 'I'.
|
||||
Property 'alsoWorks' is missing in type 'C'.
|
||||
tests/cases/compiler/fuzzy.ts(21,13): error TS2322: Type '{ anything: number; oneI: this; }' is not assignable to type 'R'.
|
||||
Types of property 'oneI' are incompatible.
|
||||
Type 'this' is not assignable to type 'I'.
|
||||
Type 'C' is not assignable to type 'I'.
|
||||
tests/cases/compiler/fuzzy.ts(21,34): error TS2322: Type 'this' is not assignable to type 'I'.
|
||||
Type 'C' is not assignable to type 'I'.
|
||||
tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Type '{ oneI: this; }' cannot be converted to type 'R'.
|
||||
Property 'anything' is missing in type '{ oneI: this; }'.
|
||||
|
||||
@@ -33,11 +31,10 @@ tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Type '{ oneI: this; }' canno
|
||||
|
||||
doesntWork():R {
|
||||
return { anything:1, oneI:this };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ anything: number; oneI: this; }' is not assignable to type 'R'.
|
||||
!!! error TS2322: Types of property 'oneI' are incompatible.
|
||||
!!! error TS2322: Type 'this' is not assignable to type 'I'.
|
||||
!!! error TS2322: Type 'C' is not assignable to type 'I'.
|
||||
~~~~
|
||||
!!! error TS2322: Type 'this' is not assignable to type 'I'.
|
||||
!!! error TS2322: Type 'C' is not assignable to type 'I'.
|
||||
!!! related TS6500 tests/cases/compiler/fuzzy.ts:10:9: The expected type comes from property 'oneI' which is declared here on type 'R'
|
||||
}
|
||||
|
||||
worksToo():R {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(12,5): error TS2322: Type '{ x: A<number>; }' is not assignable to type 'I<string>'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'A<number>' is not assignable to type 'Comparable<string>'.
|
||||
Types of property 'compareTo' are incompatible.
|
||||
Type '(other: number) => number' is not assignable to type '(other: string) => number'.
|
||||
Types of parameters 'other' and 'other' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(12,23): error TS2322: Type 'A<number>' is not assignable to type 'Comparable<string>'.
|
||||
Types of property 'compareTo' are incompatible.
|
||||
Type '(other: number) => number' is not assignable to type '(other: string) => number'.
|
||||
Types of parameters 'other' and 'other' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(13,5): error TS2322: Type '{ x: A<number>; }' is not assignable to type 'I<string>'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'A<number>' is not assignable to type 'Comparable<string>'.
|
||||
@@ -29,14 +27,13 @@ tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(17,5): error TS23
|
||||
class A<T> implements Comparable<T> { compareTo(other: T) { return 1; } }
|
||||
var z = { x: new A<number>() };
|
||||
var a1: I<string> = { x: new A<number>() };
|
||||
~~
|
||||
!!! error TS2322: Type '{ x: A<number>; }' is not assignable to type 'I<string>'.
|
||||
!!! error TS2322: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'A<number>' is not assignable to type 'Comparable<string>'.
|
||||
!!! error TS2322: Types of property 'compareTo' are incompatible.
|
||||
!!! error TS2322: Type '(other: number) => number' is not assignable to type '(other: string) => number'.
|
||||
!!! error TS2322: Types of parameters 'other' and 'other' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'A<number>' is not assignable to type 'Comparable<string>'.
|
||||
!!! error TS2322: Types of property 'compareTo' are incompatible.
|
||||
!!! error TS2322: Type '(other: number) => number' is not assignable to type '(other: string) => number'.
|
||||
!!! error TS2322: Types of parameters 'other' and 'other' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts:5:5: The expected type comes from property 'x' which is declared here on type 'I<string>'
|
||||
var a2: I<string> = function (): { x: A<number> } {
|
||||
~~
|
||||
!!! error TS2322: Type '{ x: A<number>; }' is not assignable to type 'I<string>'.
|
||||
|
||||
@@ -3,15 +3,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup
|
||||
Type '4' is not assignable to type '2'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(14,1): error TS2322: Type '{ a: string; }' is not assignable to type 'string | number'.
|
||||
Type '{ a: string; }' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,1): error TS2322: Type '[number, string]' is not assignable to type '[string, number]'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]'.
|
||||
Type '{}' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,14): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,17): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,14): error TS2322: Type '{}' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,18): error TS2322: Type '{}' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(24,1): error TS2322: Type '[{}]' is not assignable to type '[{}, {}]'.
|
||||
Property '1' is missing in type '[{}]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (5 errors) ====
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (7 errors) ====
|
||||
interface I<T, U> {
|
||||
tuple1: [T, U];
|
||||
}
|
||||
@@ -41,13 +41,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup
|
||||
|
||||
// error
|
||||
i1.tuple1 = [5, "foo"];
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '[number, string]' is not assignable to type '[string, number]'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
i1.tuple1 = [{}, {}];
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]'.
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'string'.
|
||||
~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'string'.
|
||||
~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'number'.
|
||||
i2.tuple1 = [{}];
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '[{}]' is not assignable to type '[{}, {}]'.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(20,31): error TS2326: Types of property 'children' are incompatible.
|
||||
Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: IntrinsicAttributes & LitProps<"x">) => "x"'.
|
||||
Type '"y"' is not assignable to type '"x"'.
|
||||
tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(20,31): error TS2322: Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: IntrinsicAttributes & LitProps<"x">) => "x"'.
|
||||
Type '"y"' is not assignable to type '"x"'.
|
||||
tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(21,19): error TS2322: Type '{ children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x" | "y">'.
|
||||
Type '{ children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'LitProps<"x" | "y">'.
|
||||
Types of property 'children' are incompatible.
|
||||
@@ -39,10 +38,10 @@ tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(22,21): error TS2322:
|
||||
|
||||
// Should error
|
||||
const arg = <ElemLit prop="x" children={p => "y"} />
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'children' are incompatible.
|
||||
!!! error TS2326: Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: IntrinsicAttributes & LitProps<"x">) => "x"'.
|
||||
!!! error TS2326: Type '"y"' is not assignable to type '"x"'.
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: IntrinsicAttributes & LitProps<"x">) => "x"'.
|
||||
!!! error TS2322: Type '"y"' is not assignable to type '"x"'.
|
||||
!!! related TS6500 tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx:13:34: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & LitProps<"x">'
|
||||
const argchild = <ElemLit prop="x">{p => "y"}</ElemLit>
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '{ children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x" | "y">'.
|
||||
|
||||
@@ -37,15 +37,9 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(123,12): error TS2345:
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(124,14): error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick<Foo, "a" | "b">'.
|
||||
Object literal may only specify known properties, and 'c' does not exist in type 'Pick<Foo, "a" | "b">'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(128,5): error TS2322: Type '{ a: string; }' is not assignable to type 'T2'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(129,5): error TS2322: Type '{ a: string; }' is not assignable to type 'Partial<T2>'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(130,5): error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(128,16): error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(129,25): error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(130,39): error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,16): error TS2322: Type 'T' is not assignable to type 'string | number | symbol'.
|
||||
Type 'T' is not assignable to type 'symbol'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536: Type 'P' cannot be used to index type 'T'.
|
||||
@@ -239,20 +233,17 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536:
|
||||
type T2 = { a?: number, [key: string]: any };
|
||||
|
||||
let x1: T2 = { a: 'no' }; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '{ a: string; }' is not assignable to type 'T2'.
|
||||
!!! error TS2322: Types of property 'a' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
!!! related TS6500 tests/cases/conformance/types/mapped/mappedTypeErrors.ts:126:13: The expected type comes from property 'a' which is declared here on type 'T2'
|
||||
let x2: Partial<T2> = { a: 'no' }; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '{ a: string; }' is not assignable to type 'Partial<T2>'.
|
||||
!!! error TS2322: Types of property 'a' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
!!! related TS6500 tests/cases/conformance/types/mapped/mappedTypeErrors.ts:126:13: The expected type comes from property 'a' which is declared here on type 'Partial<T2>'
|
||||
let x3: { [P in keyof T2]: T2[P]} = { a: 'no' }; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'.
|
||||
!!! error TS2322: Types of property 'a' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
!!! related TS6500 tests/cases/conformance/types/mapped/mappedTypeErrors.ts:126:13: The expected type comes from property 'a' which is declared here on type '{ [x: string]: any; a?: number | undefined; }'
|
||||
|
||||
// Repro from #13044
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
tests/cases/compiler/nestedFreshLiteral.ts(12,21): error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'.
|
||||
Types of property 'nested' are incompatible.
|
||||
Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'.
|
||||
Types of property 'prop' are incompatible.
|
||||
Type '{ colour: string; }' is not assignable to type 'CSSProps'.
|
||||
Object literal may only specify known properties, but 'colour' does not exist in type 'CSSProps'. Did you mean to write 'color'?
|
||||
tests/cases/compiler/nestedFreshLiteral.ts(12,21): error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'.
|
||||
Types of property 'prop' are incompatible.
|
||||
Type '{ colour: string; }' is not assignable to type 'CSSProps'.
|
||||
Object literal may only specify known properties, but 'colour' does not exist in type 'CSSProps'. Did you mean to write 'color'?
|
||||
|
||||
|
||||
==== tests/cases/compiler/nestedFreshLiteral.ts (1 errors) ====
|
||||
@@ -20,10 +18,9 @@ tests/cases/compiler/nestedFreshLiteral.ts(12,21): error TS2322: Type '{ nested:
|
||||
let stylen: NestedCSSProps = {
|
||||
nested: { prop: { colour: 'red' } }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'.
|
||||
!!! error TS2322: Types of property 'nested' are incompatible.
|
||||
!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'.
|
||||
!!! error TS2322: Types of property 'prop' are incompatible.
|
||||
!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'CSSProps'.
|
||||
!!! error TS2322: Object literal may only specify known properties, but 'colour' does not exist in type 'CSSProps'. Did you mean to write 'color'?
|
||||
!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'.
|
||||
!!! error TS2322: Types of property 'prop' are incompatible.
|
||||
!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'CSSProps'.
|
||||
!!! error TS2322: Object literal may only specify known properties, but 'colour' does not exist in type 'CSSProps'. Did you mean to write 'color'?
|
||||
!!! related TS6500 tests/cases/compiler/nestedFreshLiteral.ts:5:3: The expected type comes from property 'nested' which is declared here on type 'NestedCSSProps'
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts(7,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'WithNonPrimitive'.
|
||||
Types of property 'foo' are incompatible.
|
||||
Type 'string' is not assignable to type 'object'.
|
||||
tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts(7,28): error TS2322: Type 'string' is not assignable to type 'object'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts (1 errors) ====
|
||||
@@ -11,8 +9,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts(7,5): error
|
||||
var a: WithNonPrimitive = { foo: {bar: "bar"} };
|
||||
|
||||
var b: WithNonPrimitive = {foo: "bar"}; // expect error
|
||||
~
|
||||
!!! error TS2322: Type '{ foo: string; }' is not assignable to type 'WithNonPrimitive'.
|
||||
!!! error TS2322: Types of property 'foo' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'object'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'object'.
|
||||
!!! related TS6500 tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts:2:5: The expected type comes from property 'foo' which is declared here on type 'WithNonPrimitive'
|
||||
|
||||
@@ -5,8 +5,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(79,5): error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'.
|
||||
Object literal may only specify known properties, and 'a' does not exist in type '{ [x: number]: string; }'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(85,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(88,9): error TS2304: Cannot find name 'Myn'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -106,15 +105,15 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
|
||||
// error
|
||||
var b: { [x: number]: string; } = {
|
||||
a: '',
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'a' does not exist in type '{ [x: number]: string; }'.
|
||||
b: 1,
|
||||
c: () => { },
|
||||
"d": '',
|
||||
"e": 1,
|
||||
1.0: '',
|
||||
2.0: 1,
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature.
|
||||
"3.0": '',
|
||||
"4.0": 1,
|
||||
f: <Myn>null,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(16,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(25,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(34,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(44,5): error TS2322: Type '{ 1.0: A; 2.0: B; "2.5": B; 3.0: number; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'.
|
||||
Object literal may only specify known properties, and '"4.0"' does not exist in type '{ [x: number]: A; }'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(43,5): error TS2322: Type 'number' is not assignable to type 'A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts (4 errors) ====
|
||||
@@ -55,8 +54,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
|
||||
2.0: new B(),
|
||||
"2.5": new B(),
|
||||
3.0: 1,
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'A'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts:39:10: The expected type comes from this index signature.
|
||||
"4.0": ''
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '{ 1.0: A; 2.0: B; "2.5": B; 3.0: number; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and '"4.0"' does not exist in type '{ [x: number]: A; }'.
|
||||
}
|
||||
@@ -19,10 +19,8 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(23,29): error TS2322: Type
|
||||
Object literal may only specify known properties, and 'couleur' does not exist in type 'Cover | Cover[]'.
|
||||
tests/cases/compiler/objectLiteralExcessProperties.ts(25,27): error TS2322: Type '{ forewarned: string; }' is not assignable to type 'Book | Book[]'.
|
||||
Object literal may only specify known properties, and 'forewarned' does not exist in type 'Book | Book[]'.
|
||||
tests/cases/compiler/objectLiteralExcessProperties.ts(33,27): error TS2322: Type '{ 0: { colour: string; }; }' is not assignable to type 'Indexed'.
|
||||
Property '0' is incompatible with index signature.
|
||||
Type '{ colour: string; }' is not assignable to type 'Cover'.
|
||||
Object literal may only specify known properties, but 'colour' does not exist in type 'Cover'. Did you mean to write 'color'?
|
||||
tests/cases/compiler/objectLiteralExcessProperties.ts(33,27): error TS2322: Type '{ colour: string; }' is not assignable to type 'Cover'.
|
||||
Object literal may only specify known properties, but 'colour' does not exist in type 'Cover'. Did you mean to write 'color'?
|
||||
|
||||
|
||||
==== tests/cases/compiler/objectLiteralExcessProperties.ts (10 errors) ====
|
||||
@@ -90,8 +88,7 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(33,27): error TS2322: Type
|
||||
|
||||
var b11: Indexed = { 0: { colour: "blue" } }; // nested object literal still errors
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ 0: { colour: string; }; }' is not assignable to type 'Indexed'.
|
||||
!!! error TS2322: Property '0' is incompatible with index signature.
|
||||
!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'Cover'.
|
||||
!!! error TS2322: Object literal may only specify known properties, but 'colour' does not exist in type 'Cover'. Did you mean to write 'color'?
|
||||
!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'Cover'.
|
||||
!!! error TS2322: Object literal may only specify known properties, but 'colour' does not exist in type 'Cover'. Did you mean to write 'color'?
|
||||
!!! related TS6501 tests/cases/compiler/objectLiteralExcessProperties.ts:28:5: The expected type comes from this index signature.
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ x: B; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
Property '0' is incompatible with index signature.
|
||||
Type 'A' is not assignable to type 'B'.
|
||||
Property 'y' is missing in type 'A'.
|
||||
tests/cases/compiler/objectLiteralIndexerErrors.ts(14,1): error TS2322: Type '{ x: any; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
Property '0' is incompatible with index signature.
|
||||
Type 'A' is not assignable to type 'B'.
|
||||
tests/cases/compiler/objectLiteralIndexerErrors.ts(13,54): error TS2322: Type 'A' is not assignable to type 'B'.
|
||||
Property 'y' is missing in type 'A'.
|
||||
tests/cases/compiler/objectLiteralIndexerErrors.ts(14,14): error TS2322: Type 'A' is not assignable to type 'B'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/objectLiteralIndexerErrors.ts (2 errors) ====
|
||||
@@ -21,13 +17,11 @@ tests/cases/compiler/objectLiteralIndexerErrors.ts(14,1): error TS2322: Type '{
|
||||
var c: any;
|
||||
|
||||
var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A
|
||||
~~
|
||||
!!! error TS2322: Type '{ x: B; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
!!! error TS2322: Property '0' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'A' is not assignable to type 'B'.
|
||||
!!! error TS2322: Property 'y' is missing in type 'A'.
|
||||
~
|
||||
!!! error TS2322: Type 'A' is not assignable to type 'B'.
|
||||
!!! error TS2322: Property 'y' is missing in type 'A'.
|
||||
!!! related TS6501 tests/cases/compiler/objectLiteralIndexerErrors.ts:13:26: The expected type comes from this index signature.
|
||||
o1 = { x: c, 0: a }; // string indexer is any, number indexer is A
|
||||
~~
|
||||
!!! error TS2322: Type '{ x: any; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
!!! error TS2322: Property '0' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'A' is not assignable to type 'B'.
|
||||
~
|
||||
!!! error TS2322: Type 'A' is not assignable to type 'B'.
|
||||
!!! related TS6501 tests/cases/compiler/objectLiteralIndexerErrors.ts:13:26: The expected type comes from this index signature.
|
||||
@@ -1,6 +1,4 @@
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(7,1): error TS2322: Type '{ a: number; b: number; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'.
|
||||
Type '{ a: number; b: number; }' is not assignable to type '{ a: number; b: string; c: boolean; }'.
|
||||
Property 'c' is missing in type '{ a: number; b: number; }'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(7,14): error TS2322: Type 'number' is not assignable to type 'string | undefined'.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts(8,1): error TS2322: Type '{ b: string; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'.
|
||||
Type '{ b: string; }' is not assignable to type '{ a: number; b: string; c: boolean; }'.
|
||||
Property 'a' is missing in type '{ b: string; }'.
|
||||
@@ -25,10 +23,9 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts
|
||||
a1.c; // boolean | undefined
|
||||
a1 = { a: 1 };
|
||||
a1 = { a: 0, b: 0 }; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '{ a: number; b: number; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'.
|
||||
!!! error TS2322: Type '{ a: number; b: number; }' is not assignable to type '{ a: number; b: string; c: boolean; }'.
|
||||
!!! error TS2322: Property 'c' is missing in type '{ a: number; b: number; }'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | undefined'.
|
||||
!!! related TS6500 tests/cases/conformance/expressions/objectLiterals/objectLiteralNormalization.ts:2:47: The expected type comes from property 'b' which is declared here on type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'
|
||||
a1 = { b: "y" }; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '{ b: string; }' is not assignable to type '{ a: number; b?: undefined; c?: undefined; } | { a: number; b: string; c?: undefined; } | { a: number; b: string; c: boolean; }'.
|
||||
|
||||
+9
-8
@@ -1,14 +1,13 @@
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(4,43): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
||||
Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,72): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ id: string; name: number; }'.
|
||||
Types of property 'id' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,81): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,87): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(8,5): error TS2345: Argument of type '{ name: string; id: number; }' is not assignable to parameter of type '{ name: string; id: boolean; }'.
|
||||
Types of property 'id' are incompatible.
|
||||
Type 'number' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts (4 errors) ====
|
||||
var id: number = 10000;
|
||||
var name: string = "my name";
|
||||
|
||||
@@ -18,10 +17,12 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'.
|
||||
var person1: { name, id }; // ok
|
||||
function foo(name: string, id: number): { id: string, name: number } { return { name, id }; } // error
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ id: string; name: number; }'.
|
||||
!!! error TS2322: Types of property 'id' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts:6:55: The expected type comes from property 'name' which is declared here on type '{ id: string; name: number; }'
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts:6:43: The expected type comes from property 'id' which is declared here on type '{ id: string; name: number; }'
|
||||
function bar(obj: { name: string; id: boolean }) { }
|
||||
bar({ name, id }); // error
|
||||
~~~~~~~~~~~~
|
||||
|
||||
+9
-8
@@ -1,14 +1,13 @@
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(4,43): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
||||
Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,72): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'.
|
||||
Types of property 'name' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,81): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,87): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(8,5): error TS2322: Type '{ name: number; id: string; }' is not assignable to type '{ name: string; id: number; }'.
|
||||
Types of property 'name' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts (4 errors) ====
|
||||
var id: number = 10000;
|
||||
var name: string = "my name";
|
||||
|
||||
@@ -17,10 +16,12 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr
|
||||
!!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'.
|
||||
function bar(name: string, id: number): { name: number, id: string } { return { name, id }; } // error
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'.
|
||||
!!! error TS2322: Types of property 'name' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts:5:43: The expected type comes from property 'name' which is declared here on type '{ name: number; id: string; }'
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts:5:57: The expected type comes from property 'id' which is declared here on type '{ name: number; id: string; }'
|
||||
function foo(name: string, id: number): { name: string, id: number } { return { name, id }; } // error
|
||||
var person1: { name, id }; // ok
|
||||
var person2: { name: string, id: number } = bar("hello", 5);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
tests/cases/compiler/objectLiteralWithNumericPropertyName.ts(4,5): error TS2322: Type '{ 0: number; }' is not assignable to type 'A'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/objectLiteralWithNumericPropertyName.ts(5,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/objectLiteralWithNumericPropertyName.ts (1 errors) ====
|
||||
@@ -8,10 +6,9 @@ tests/cases/compiler/objectLiteralWithNumericPropertyName.ts(4,5): error TS2322:
|
||||
0: string;
|
||||
}
|
||||
var x: A = {
|
||||
~
|
||||
!!! error TS2322: Type '{ 0: number; }' is not assignable to type 'A'.
|
||||
!!! error TS2322: Types of property '0' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
0: 3
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/compiler/objectLiteralWithNumericPropertyName.ts:2:5: The expected type comes from property '0' which is declared here on type 'A'
|
||||
};
|
||||
|
||||
@@ -10,9 +10,7 @@ tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(18,9): error TS23
|
||||
Types of property 'sn' are incompatible.
|
||||
Type 'string | number | undefined' is not assignable to type 'string | number | boolean'.
|
||||
Type 'undefined' is not assignable to type 'string | number | boolean'.
|
||||
tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(28,7): error TS2322: Type '{ title: undefined; yearReleased: number; }' is not assignable to type 'Movie'.
|
||||
Types of property 'title' are incompatible.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(28,26): error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(42,5): error TS2322: Type '{ foo: number | undefined; bar: string | undefined; }' is not assignable to type 'Fields'.
|
||||
Types of property 'foo' are incompatible.
|
||||
Type 'number | undefined' is not assignable to type 'number'.
|
||||
@@ -63,10 +61,9 @@ tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(42,5): error TS23
|
||||
const m = { title: "The Matrix", yearReleased: 1999 };
|
||||
// should error here because title: undefined is not assignable to string
|
||||
const x: Movie = { ...m, title: undefined };
|
||||
~
|
||||
!!! error TS2322: Type '{ title: undefined; yearReleased: number; }' is not assignable to type 'Movie'.
|
||||
!!! error TS2322: Types of property 'title' are incompatible.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/types/spread/objectSpreadStrictNull.ts:22:5: The expected type comes from property 'title' which is declared here on type 'Movie'
|
||||
|
||||
interface Fields {
|
||||
foo: number;
|
||||
|
||||
@@ -2,10 +2,8 @@ tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2322: Type '1' is no
|
||||
tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2322: Type '"test"' is not assignable to type 'D'.
|
||||
tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
tests/cases/compiler/returnInConstructor1.ts(39,9): error TS2322: Type '{ foo: number; }' is not assignable to type 'F'.
|
||||
Types of property 'foo' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/returnInConstructor1.ts(39,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
tests/cases/compiler/returnInConstructor1.ts(39,18): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2322: Type 'G' is not assignable to type 'H'.
|
||||
Types of property 'foo' are incompatible.
|
||||
Type '() => void' is not assignable to type 'string'.
|
||||
@@ -61,11 +59,10 @@ tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of
|
||||
constructor() {
|
||||
return { foo: 1 }; //error
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ foo: number; }' is not assignable to type 'F'.
|
||||
!!! error TS2322: Types of property 'foo' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class.
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/compiler/returnInConstructor1.ts:37:12: The expected type comes from property 'foo' which is declared here on type 'F'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,19 +6,18 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(70,5): error
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(75,8): error TS2322: Type '5' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(75,8): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(80,5): error TS2322: Type '5' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(80,13): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(80,20): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,8): error TS2322: Type '5' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,8): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,19): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(85,26): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,12): error TS2304: Cannot find name 's'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): error TS1312: '=' can only be used in an object literal property inside a destructuring assignment.
|
||||
|
||||
|
||||
==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts (14 errors) ====
|
||||
==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts (15 errors) ====
|
||||
(function() {
|
||||
var s0;
|
||||
for ({ s0 = 5 } of [{ s0: 1 }]) {
|
||||
@@ -115,10 +114,9 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): err
|
||||
({ y2 = 5, y3 = { x: 1 } } = {})
|
||||
~~
|
||||
!!! error TS2322: Type '5' is not assignable to type 'string'.
|
||||
~~
|
||||
!!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'.
|
||||
!!! error TS2322: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts:79:24: The expected type comes from property 'x' which is declared here on type '{ x: string; }'
|
||||
});
|
||||
|
||||
(function() {
|
||||
@@ -132,6 +130,9 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts(111,14): err
|
||||
!!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'.
|
||||
!!! error TS2322: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring.ts:84:24: The expected type comes from property 'x' which is declared here on type '{ x: string; }'
|
||||
});
|
||||
|
||||
(function() {
|
||||
|
||||
+9
-8
@@ -6,19 +6,18 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(70,5): e
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(75,8): error TS2322: Type '5' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(75,8): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(80,5): error TS2322: Type '5' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(80,13): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(80,20): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,8): error TS2322: Type '5' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,8): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,19): error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(85,26): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,12): error TS2304: Cannot find name 's'.
|
||||
tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14): error TS1312: '=' can only be used in an object literal property inside a destructuring assignment.
|
||||
|
||||
|
||||
==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts (14 errors) ====
|
||||
==== tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts (15 errors) ====
|
||||
(function() {
|
||||
var s0;
|
||||
for ({ s0 = 5 } of [{ s0: 1 }]) {
|
||||
@@ -115,10 +114,9 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14):
|
||||
({ y2 = 5, y3 = { x: 1 } } = {})
|
||||
~~
|
||||
!!! error TS2322: Type '5' is not assignable to type 'string'.
|
||||
~~
|
||||
!!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'.
|
||||
!!! error TS2322: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts:79:24: The expected type comes from property 'x' which is declared here on type '{ x: string; }'
|
||||
});
|
||||
|
||||
(function() {
|
||||
@@ -132,6 +130,9 @@ tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts(111,14):
|
||||
!!! error TS2322: Type '{ x: number; }' is not assignable to type '{ x: string; }'.
|
||||
!!! error TS2322: Types of property 'x' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/compiler/shorthandPropertyAssignmentsInDestructuring_ES6.ts:84:24: The expected type comes from property 'x' which is declared here on type '{ x: string; }'
|
||||
});
|
||||
|
||||
(function() {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts(16,17): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts (1 errors) ====
|
||||
interface Foo {
|
||||
a: {
|
||||
b: {
|
||||
c: {
|
||||
d: string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let q: Foo["a"] | undefined;
|
||||
const x: Foo = (void 0, {
|
||||
a: q = {
|
||||
b: ({
|
||||
c: {
|
||||
d: 42
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts:5:17: The expected type comes from property 'd' which is declared here on type '{ d: string; }'
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//// [slightlyIndirectedDeepObjectLiteralElaborations.ts]
|
||||
interface Foo {
|
||||
a: {
|
||||
b: {
|
||||
c: {
|
||||
d: string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let q: Foo["a"] | undefined;
|
||||
const x: Foo = (void 0, {
|
||||
a: q = {
|
||||
b: ({
|
||||
c: {
|
||||
d: 42
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//// [slightlyIndirectedDeepObjectLiteralElaborations.js]
|
||||
var q;
|
||||
var x = (void 0, {
|
||||
a: q = {
|
||||
b: ({
|
||||
c: {
|
||||
d: 42
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,45 @@
|
||||
=== tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts ===
|
||||
interface Foo {
|
||||
>Foo : Symbol(Foo, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 0, 0))
|
||||
|
||||
a: {
|
||||
>a : Symbol(Foo.a, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 0, 15))
|
||||
|
||||
b: {
|
||||
>b : Symbol(b, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 1, 8))
|
||||
|
||||
c: {
|
||||
>c : Symbol(c, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 2, 12))
|
||||
|
||||
d: string
|
||||
>d : Symbol(d, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 3, 16))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let q: Foo["a"] | undefined;
|
||||
>q : Symbol(q, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 10, 3))
|
||||
>Foo : Symbol(Foo, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 0, 0))
|
||||
|
||||
const x: Foo = (void 0, {
|
||||
>x : Symbol(x, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 11, 5))
|
||||
>Foo : Symbol(Foo, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 0, 0))
|
||||
|
||||
a: q = {
|
||||
>a : Symbol(a, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 11, 25))
|
||||
>q : Symbol(q, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 10, 3))
|
||||
|
||||
b: ({
|
||||
>b : Symbol(b, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 12, 12))
|
||||
|
||||
c: {
|
||||
>c : Symbol(c, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 13, 13))
|
||||
|
||||
d: 42
|
||||
>d : Symbol(d, Decl(slightlyIndirectedDeepObjectLiteralElaborations.ts, 14, 16))
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
=== tests/cases/compiler/slightlyIndirectedDeepObjectLiteralElaborations.ts ===
|
||||
interface Foo {
|
||||
>Foo : Foo
|
||||
|
||||
a: {
|
||||
>a : { b: { c: { d: string; }; }; }
|
||||
|
||||
b: {
|
||||
>b : { c: { d: string; }; }
|
||||
|
||||
c: {
|
||||
>c : { d: string; }
|
||||
|
||||
d: string
|
||||
>d : string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let q: Foo["a"] | undefined;
|
||||
>q : { b: { c: { d: string; }; }; }
|
||||
>Foo : Foo
|
||||
|
||||
const x: Foo = (void 0, {
|
||||
>x : Foo
|
||||
>Foo : Foo
|
||||
>(void 0, { a: q = { b: ({ c: { d: 42 } }) }}) : { a: { b: { c: { d: number; }; }; }; }
|
||||
>void 0, { a: q = { b: ({ c: { d: 42 } }) }} : { a: { b: { c: { d: number; }; }; }; }
|
||||
>void 0 : undefined
|
||||
>0 : 0
|
||||
>{ a: q = { b: ({ c: { d: 42 } }) }} : { a: { b: { c: { d: number; }; }; }; }
|
||||
|
||||
a: q = {
|
||||
>a : { b: { c: { d: number; }; }; }
|
||||
>q = { b: ({ c: { d: 42 } }) } : { b: { c: { d: number; }; }; }
|
||||
>q : { b: { c: { d: string; }; }; }
|
||||
>{ b: ({ c: { d: 42 } }) } : { b: { c: { d: number; }; }; }
|
||||
|
||||
b: ({
|
||||
>b : { c: { d: number; }; }
|
||||
>({ c: { d: 42 } }) : { c: { d: number; }; }
|
||||
>{ c: { d: 42 } } : { c: { d: number; }; }
|
||||
|
||||
c: {
|
||||
>c : { d: number; }
|
||||
>{ d: 42 } : { d: number; }
|
||||
|
||||
d: 42
|
||||
>d : number
|
||||
>42 : 42
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
tests/cases/conformance/types/spread/spreadUnion3.ts(2,5): error TS2322: Type '{ y: number; } | { y: string; }' is not assignable to type '{ y: string; }'.
|
||||
Type '{ y: number; }' is not assignable to type '{ y: string; }'.
|
||||
Types of property 'y' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/spread/spreadUnion3.ts(2,14): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/spread/spreadUnion3.ts(9,23): error TS2339: Property 'a' does not exist on type '{}'.
|
||||
tests/cases/conformance/types/spread/spreadUnion3.ts(17,11): error TS2698: Spread types may only be created from object types.
|
||||
tests/cases/conformance/types/spread/spreadUnion3.ts(18,11): error TS2698: Spread types may only be created from object types.
|
||||
@@ -10,11 +7,9 @@ tests/cases/conformance/types/spread/spreadUnion3.ts(18,11): error TS2698: Sprea
|
||||
==== tests/cases/conformance/types/spread/spreadUnion3.ts (4 errors) ====
|
||||
function f(x: { y: string } | undefined): { y: string } {
|
||||
return { y: 123, ...x } // y: string | number
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ y: number; } | { y: string; }' is not assignable to type '{ y: string; }'.
|
||||
!!! error TS2322: Type '{ y: number; }' is not assignable to type '{ y: string; }'.
|
||||
!!! error TS2322: Types of property 'y' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/types/spread/spreadUnion3.ts:1:45: The expected type comes from property 'y' which is declared here on type '{ y: string; }'
|
||||
}
|
||||
f(undefined)
|
||||
|
||||
|
||||
@@ -22,14 +22,18 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(71,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(74,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
Property 'b' is incompatible with index signature.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(80,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(81,5): error TS2322: Type '() => void' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(83,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(85,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(87,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(88,5): error TS2322: Type 'MyString' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(94,5): error TS2322: Type '() => string' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts (27 errors) ====
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts (33 errors) ====
|
||||
// String indexer types constrain the types of named properties in their containing type
|
||||
|
||||
interface MyString extends String {
|
||||
@@ -156,20 +160,34 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
|
||||
// error
|
||||
var b: { [x: string]: string; } = {
|
||||
~
|
||||
!!! error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
!!! error TS2322: Property 'b' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
a: '',
|
||||
b: 1,
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature.
|
||||
c: () => { },
|
||||
~
|
||||
!!! error TS2322: Type '() => void' is not assignable to type 'string'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature.
|
||||
"d": '',
|
||||
"e": 1,
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature.
|
||||
1.0: '',
|
||||
2.0: 1,
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature.
|
||||
"3.0": '',
|
||||
"4.0": 1,
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature.
|
||||
f: <MyString>null,
|
||||
~
|
||||
!!! error TS2322: Type 'MyString' is not assignable to type 'string'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature.
|
||||
|
||||
get X() {
|
||||
~
|
||||
@@ -180,6 +198,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
foo() {
|
||||
~~~
|
||||
!!! error TS2322: Type '() => string' is not assignable to type 'string'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts:78:10: The expected type comes from this index signature.
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,13 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(24,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(31,5): error TS2411: Property 'c' of type 'number' is not assignable to string index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(32,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'.
|
||||
Property 'a' is incompatible with index signature.
|
||||
Type 'typeof A' is not assignable to type 'A'.
|
||||
Property 'foo' is missing in type 'typeof A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(37,5): error TS2322: Type 'typeof A' is not assignable to type 'A'.
|
||||
Property 'foo' is missing in type 'typeof A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(38,5): error TS2322: Type 'typeof B' is not assignable to type 'A'.
|
||||
Property 'foo' is missing in type 'typeof B'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts (7 errors) ====
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts (8 errors) ====
|
||||
// String indexer providing a constraint of a user defined type
|
||||
|
||||
class A {
|
||||
@@ -59,11 +59,14 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
|
||||
// error
|
||||
var b: { [x: string]: A } = {
|
||||
~
|
||||
!!! error TS2322: Type '{ a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'.
|
||||
!!! error TS2322: Property 'a' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'typeof A' is not assignable to type 'A'.
|
||||
!!! error TS2322: Property 'foo' is missing in type 'typeof A'.
|
||||
a: A,
|
||||
~
|
||||
!!! error TS2322: Type 'typeof A' is not assignable to type 'A'.
|
||||
!!! error TS2322: Property 'foo' is missing in type 'typeof A'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts:36:10: The expected type comes from this index signature.
|
||||
b: B
|
||||
~
|
||||
!!! error TS2322: Type 'typeof B' is not assignable to type 'A'.
|
||||
!!! error TS2322: Property 'foo' is missing in type 'typeof B'.
|
||||
!!! related TS6501 tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts:36:10: The expected type comes from this index signature.
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
tests/cases/conformance/jsx/tsxAttributeErrors.tsx(14,6): error TS2326: Types of property 'text' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/tsxAttributeErrors.tsx(17,6): error TS2326: Types of property 'width' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/tsxAttributeErrors.tsx(14,6): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/tsxAttributeErrors.tsx(17,6): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/tsxAttributeErrors.tsx(21,2): error TS2322: Type '{ text: number; }' is not assignable to type '{ text?: string; width?: number; }'.
|
||||
Types of property 'text' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
@@ -22,15 +20,15 @@ tests/cases/conformance/jsx/tsxAttributeErrors.tsx(21,2): error TS2322: Type '{
|
||||
|
||||
// Error, number is not assignable to string
|
||||
<div text={42} />;
|
||||
~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'text' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxAttributeErrors.tsx:5:4: The expected type comes from property 'text' which is declared here on type '{ text?: string; width?: number; }'
|
||||
|
||||
// Error, string is not assignable to number
|
||||
<div width={'foo'} />;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'width' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number'.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxAttributeErrors.tsx:6:4: The expected type comes from property 'width' which is declared here on type '{ text?: string; width?: number; }'
|
||||
|
||||
// Error, number is not assignable to string
|
||||
var attribs = { text: 100 };
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
tests/cases/conformance/jsx/file.tsx(23,8): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(23,8): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(24,2): error TS2559: Type '{ y: number; }' has no properties in common with type 'Attribs1'.
|
||||
tests/cases/conformance/jsx/file.tsx(25,2): error TS2559: Type '{ y: string; }' has no properties in common with type 'Attribs1'.
|
||||
tests/cases/conformance/jsx/file.tsx(26,8): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(26,8): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(27,2): error TS2559: Type '{ var: string; }' has no properties in common with type 'Attribs1'.
|
||||
tests/cases/conformance/jsx/file.tsx(29,2): error TS2322: Type '{}' is not assignable to type '{ reqd: string; }'.
|
||||
Property 'reqd' is missing in type '{}'.
|
||||
tests/cases/conformance/jsx/file.tsx(30,8): error TS2326: Types of property 'reqd' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(30,8): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (7 errors) ====
|
||||
@@ -35,9 +32,9 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2326: Types of property 'req
|
||||
|
||||
// Errors
|
||||
<test1 x={'0'} />; // Error, '0' is not number
|
||||
~~~~~~~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:10:2: The expected type comes from property 'x' which is declared here on type 'Attribs1'
|
||||
<test1 y={0} />; // Error, no property "y"
|
||||
~~~~~
|
||||
!!! error TS2559: Type '{ y: number; }' has no properties in common with type 'Attribs1'.
|
||||
@@ -45,9 +42,9 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2326: Types of property 'req
|
||||
~~~~~
|
||||
!!! error TS2559: Type '{ y: string; }' has no properties in common with type 'Attribs1'.
|
||||
<test1 x="32" />; // Error, "32" is not number
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:10:2: The expected type comes from property 'x' which is declared here on type 'Attribs1'
|
||||
<test1 var="10" />; // Error, no 'var' property
|
||||
~~~~~
|
||||
!!! error TS2559: Type '{ var: string; }' has no properties in common with type 'Attribs1'.
|
||||
@@ -57,9 +54,9 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2326: Types of property 'req
|
||||
!!! error TS2322: Type '{}' is not assignable to type '{ reqd: string; }'.
|
||||
!!! error TS2322: Property 'reqd' is missing in type '{}'.
|
||||
<test2 reqd={10} />; // Error, reqd is not string
|
||||
~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'reqd' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:12: The expected type comes from property 'reqd' which is declared here on type '{ reqd: string; }'
|
||||
|
||||
// Should be OK
|
||||
<var var='var' />;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(11,14): error TS2326: Types of property 'bar' are incompatible.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(11,14): error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/react.d.ts (0 errors) ====
|
||||
@@ -24,9 +23,9 @@ tests/cases/conformance/jsx/file.tsx(11,14): error TS2326: Types of property 'ba
|
||||
|
||||
// Should be an error
|
||||
<MyComponent bar='world' />;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'bar' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'boolean'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
!!! related TS6501 tests/cases/conformance/jsx/file.tsx:6:4: The expected type comes from this index signature.
|
||||
|
||||
// Should be OK
|
||||
<MyComponent bar={true} />;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
tests/cases/conformance/jsx/file.tsx(13,28): error TS2326: Types of property 'primaryText' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(15,28): error TS2326: Types of property 'justRandomProp1' are incompatible.
|
||||
Type 'boolean' is not assignable to type 'string | number'.
|
||||
tests/cases/conformance/jsx/file.tsx(13,28): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(15,28): error TS2322: Type 'true' is not assignable to type 'string | number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/react.d.ts (0 errors) ====
|
||||
@@ -27,14 +25,14 @@ tests/cases/conformance/jsx/file.tsx(15,28): error TS2326: Types of property 'ju
|
||||
return (
|
||||
<div>
|
||||
<VerticalNavMenuItem primaryText={2} /> // error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'primaryText' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:2:3: The expected type comes from property 'primaryText' which is declared here on type 'IProps'
|
||||
<VerticalNavMenuItem justRandomProp={2} primaryText={"hello"} /> // ok
|
||||
<VerticalNavMenuItem justRandomProp1={true} primaryText={"hello"} /> // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'justRandomProp1' are incompatible.
|
||||
!!! error TS2326: Type 'boolean' is not assignable to type 'string | number'.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string | number'.
|
||||
!!! related TS6501 tests/cases/conformance/jsx/file.tsx:3:3: The expected type comes from this index signature.
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -3,8 +3,7 @@ tests/cases/conformance/jsx/file.tsx(19,2): error TS2322: Type '{ x: number; }'
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(23,2): error TS2322: Type '{ y: number; }' is not assignable to type 'Attribs1'.
|
||||
Property 'x' is missing in type '{ y: number; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(31,8): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(31,8): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
|
||||
@@ -46,9 +45,9 @@ tests/cases/conformance/jsx/file.tsx(31,8): error TS2326: Types of property 'x'
|
||||
// Error
|
||||
var obj5 = { x: 32, y: 32 };
|
||||
<test1 x="ok" {...obj5} />
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:8:2: The expected type comes from property 'x' which is declared here on type 'Attribs1'
|
||||
|
||||
// Ok
|
||||
var obj6 = { x: 'ok', y: 32, extra: 100 };
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
tests/cases/conformance/jsx/file.tsx(10,8): error TS2326: Types of property 's' are incompatible.
|
||||
Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(11,8): error TS2326: Types of property 'n' are incompatible.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(10,8): error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(11,8): error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(12,2): error TS2322: Type '{}' is not assignable to type '{ n: boolean; }'.
|
||||
Property 'n' is missing in type '{}'.
|
||||
|
||||
@@ -18,12 +16,12 @@ tests/cases/conformance/jsx/file.tsx(12,2): error TS2322: Type '{}' is not assig
|
||||
// Error
|
||||
<test1 s />;
|
||||
~
|
||||
!!! error TS2326: Types of property 's' are incompatible.
|
||||
!!! error TS2326: Type 'true' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:25: The expected type comes from property 's' which is declared here on type '{ n?: boolean; s?: string; }'
|
||||
<test1 n='true' />;
|
||||
~~~~~~~~
|
||||
!!! error TS2326: Types of property 'n' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'boolean'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:12: The expected type comes from property 'n' which is declared here on type '{ n?: boolean; s?: string; }'
|
||||
<test2 />;
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type '{ n: boolean; }'.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(9,8): error TS2326: Types of property 'data-foo' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(9,8): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
|
||||
@@ -12,9 +11,9 @@ tests/cases/conformance/jsx/file.tsx(9,8): error TS2326: Types of property 'data
|
||||
|
||||
// Error
|
||||
<test1 data-foo={32} />;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'data-foo' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:12: The expected type comes from property 'data-foo' which is declared here on type '{ "data-foo"?: string; }'
|
||||
|
||||
// OK
|
||||
<test1 data-foo={'32'} />;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(9,14): error TS2326: Types of property 'foo' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(9,14): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/react.d.ts (0 errors) ====
|
||||
@@ -26,7 +25,7 @@ tests/cases/conformance/jsx/file.tsx(9,14): error TS2326: Types of property 'foo
|
||||
|
||||
<MyComponent foo="bar" />; // ok
|
||||
<MyComponent foo={0} />; // should be an error
|
||||
~~~~~~~
|
||||
!!! error TS2326: Types of property 'foo' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:12: The expected type comes from property 'foo' which is declared here on type '{ foo: string; }'
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
tests/cases/compiler/file1.tsx(5,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/my-component.tsx (0 errors) ====
|
||||
import * as React from 'react'
|
||||
|
||||
interface MyProps {
|
||||
x: string;
|
||||
y: MyInnerProps;
|
||||
}
|
||||
|
||||
interface MyInnerProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export function MyComponent(_props: MyProps) {
|
||||
return <span>my component</span>;
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/file1.tsx (1 errors) ====
|
||||
import * as React from 'react'
|
||||
import { MyComponent } from './my-component'
|
||||
|
||||
export const result = <MyComponent x="yes" y={{
|
||||
value: 42
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/compiler/my-component.tsx:9:5: The expected type comes from property 'value' which is declared here on type 'MyInnerProps'
|
||||
}} />;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//// [tests/cases/compiler/tsxDeepAttributeAssignabilityError.tsx] ////
|
||||
|
||||
//// [my-component.tsx]
|
||||
import * as React from 'react'
|
||||
|
||||
interface MyProps {
|
||||
x: string;
|
||||
y: MyInnerProps;
|
||||
}
|
||||
|
||||
interface MyInnerProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export function MyComponent(_props: MyProps) {
|
||||
return <span>my component</span>;
|
||||
}
|
||||
|
||||
//// [file1.tsx]
|
||||
import * as React from 'react'
|
||||
import { MyComponent } from './my-component'
|
||||
|
||||
export const result = <MyComponent x="yes" y={{
|
||||
value: 42
|
||||
}} />;
|
||||
|
||||
|
||||
//// [my-component.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
function MyComponent(_props) {
|
||||
return React.createElement("span", null, "my component");
|
||||
}
|
||||
exports.MyComponent = MyComponent;
|
||||
//// [file1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
var my_component_1 = require("./my-component");
|
||||
exports.result = React.createElement(my_component_1.MyComponent, { x: "yes", y: {
|
||||
value: 42
|
||||
} });
|
||||
@@ -0,0 +1,50 @@
|
||||
=== tests/cases/compiler/my-component.tsx ===
|
||||
import * as React from 'react'
|
||||
>React : Symbol(React, Decl(my-component.tsx, 0, 6))
|
||||
|
||||
interface MyProps {
|
||||
>MyProps : Symbol(MyProps, Decl(my-component.tsx, 0, 30))
|
||||
|
||||
x: string;
|
||||
>x : Symbol(MyProps.x, Decl(my-component.tsx, 2, 19))
|
||||
|
||||
y: MyInnerProps;
|
||||
>y : Symbol(MyProps.y, Decl(my-component.tsx, 3, 14))
|
||||
>MyInnerProps : Symbol(MyInnerProps, Decl(my-component.tsx, 5, 1))
|
||||
}
|
||||
|
||||
interface MyInnerProps {
|
||||
>MyInnerProps : Symbol(MyInnerProps, Decl(my-component.tsx, 5, 1))
|
||||
|
||||
value: string;
|
||||
>value : Symbol(MyInnerProps.value, Decl(my-component.tsx, 7, 24))
|
||||
}
|
||||
|
||||
export function MyComponent(_props: MyProps) {
|
||||
>MyComponent : Symbol(MyComponent, Decl(my-component.tsx, 9, 1))
|
||||
>_props : Symbol(_props, Decl(my-component.tsx, 11, 28))
|
||||
>MyProps : Symbol(MyProps, Decl(my-component.tsx, 0, 30))
|
||||
|
||||
return <span>my component</span>;
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2461, 51))
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/file1.tsx ===
|
||||
import * as React from 'react'
|
||||
>React : Symbol(React, Decl(file1.tsx, 0, 6))
|
||||
|
||||
import { MyComponent } from './my-component'
|
||||
>MyComponent : Symbol(MyComponent, Decl(file1.tsx, 1, 8))
|
||||
|
||||
export const result = <MyComponent x="yes" y={{
|
||||
>result : Symbol(result, Decl(file1.tsx, 3, 12))
|
||||
>MyComponent : Symbol(MyComponent, Decl(file1.tsx, 1, 8))
|
||||
>x : Symbol(x, Decl(file1.tsx, 3, 34))
|
||||
>y : Symbol(y, Decl(file1.tsx, 3, 42))
|
||||
|
||||
value: 42
|
||||
>value : Symbol(value, Decl(file1.tsx, 3, 47))
|
||||
|
||||
}} />;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
=== tests/cases/compiler/my-component.tsx ===
|
||||
import * as React from 'react'
|
||||
>React : typeof React
|
||||
|
||||
interface MyProps {
|
||||
>MyProps : MyProps
|
||||
|
||||
x: string;
|
||||
>x : string
|
||||
|
||||
y: MyInnerProps;
|
||||
>y : MyInnerProps
|
||||
>MyInnerProps : MyInnerProps
|
||||
}
|
||||
|
||||
interface MyInnerProps {
|
||||
>MyInnerProps : MyInnerProps
|
||||
|
||||
value: string;
|
||||
>value : string
|
||||
}
|
||||
|
||||
export function MyComponent(_props: MyProps) {
|
||||
>MyComponent : (_props: MyProps) => JSX.Element
|
||||
>_props : MyProps
|
||||
>MyProps : MyProps
|
||||
|
||||
return <span>my component</span>;
|
||||
><span>my component</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/file1.tsx ===
|
||||
import * as React from 'react'
|
||||
>React : typeof React
|
||||
|
||||
import { MyComponent } from './my-component'
|
||||
>MyComponent : (_props: MyProps) => JSX.Element
|
||||
|
||||
export const result = <MyComponent x="yes" y={{
|
||||
>result : JSX.Element
|
||||
><MyComponent x="yes" y={{ value: 42}} /> : JSX.Element
|
||||
>MyComponent : (_props: MyProps) => JSX.Element
|
||||
>x : string
|
||||
>y : { value: number; }
|
||||
>{ value: 42} : { value: number; }
|
||||
|
||||
value: 42
|
||||
>value : number
|
||||
>42 : 42
|
||||
|
||||
}} />;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(13,19): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'true' is not assignable to type 'false'.
|
||||
tests/cases/conformance/jsx/file.tsx(13,19): error TS2322: Type 'true' is not assignable to type 'false'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
|
||||
@@ -17,5 +16,5 @@ tests/cases/conformance/jsx/file.tsx(13,19): error TS2326: Types of property 'x'
|
||||
// Error
|
||||
let p = <Poisoned x/>;
|
||||
~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'true' is not assignable to type 'false'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'false'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & Prop & { children?: ReactNode; }'
|
||||
@@ -2,8 +2,7 @@ tests/cases/conformance/jsx/file.tsx(23,1): error TS2607: JSX element class does
|
||||
tests/cases/conformance/jsx/file.tsx(23,7): error TS2339: Property 'x' does not exist on type '{}'.
|
||||
tests/cases/conformance/jsx/file.tsx(25,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property.
|
||||
tests/cases/conformance/jsx/file.tsx(26,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property.
|
||||
tests/cases/conformance/jsx/file.tsx(33,7): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(33,7): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (5 errors) ====
|
||||
@@ -48,7 +47,7 @@ tests/cases/conformance/jsx/file.tsx(33,7): error TS2326: Types of property 'x'
|
||||
var Obj4: Obj4type;
|
||||
<Obj4 x={10} />; // OK
|
||||
<Obj4 x={'10'} />; // Error
|
||||
~~~~~~~~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:29:37: The expected type comes from property 'x' which is declared here on type '{ x: number; }'
|
||||
|
||||
@@ -2,30 +2,21 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(55,12): error TS2322
|
||||
Type '{ foo: number; }' is not assignable to type '{ bar: string | number | ReactComponent<{}, {}> | null | undefined; baz: string; }'.
|
||||
Property 'bar' is missing in type '{ foo: number; }'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(57,41): error TS2339: Property 'bat' does not exist on type 'Defaultize<InferredPropTypes<{ foo: PropTypeChecker<number, false>; bar: PropTypeChecker<ReactNode, false>; baz: PropTypeChecker<string, true>; }>, { foo: number; }>'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(59,42): error TS2326: Types of property 'baz' are incompatible.
|
||||
Type 'null' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(69,26): error TS2326: Types of property 'foo' are incompatible.
|
||||
Type 'string' is not assignable to type 'number | null | undefined'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(71,35): error TS2326: Types of property 'bar' are incompatible.
|
||||
Type 'null' is not assignable to type 'ReactNode'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(59,42): error TS2322: Type 'null' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(69,26): error TS2322: Type 'string' is not assignable to type 'number | null | undefined'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(71,35): error TS2322: Type 'null' is not assignable to type 'ReactNode'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(80,38): error TS2339: Property 'bar' does not exist on type 'Defaultize<{}, { foo: number; }>'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(81,29): error TS2326: Types of property 'foo' are incompatible.
|
||||
Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(81,29): error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(98,12): error TS2322: Type '{ foo: string; }' is not assignable to type 'Defaultize<FooProps & InferredPropTypes<{ foo: PropTypeChecker<string, false>; bar: PropTypeChecker<ReactNode, false>; baz: PropTypeChecker<number, true>; }>, { foo: string; }>'.
|
||||
Type '{ foo: string; }' is not assignable to type '{ bar: string | number | ReactComponent<{}, {}> | null | undefined; baz: number; }'.
|
||||
Property 'bar' is missing in type '{ foo: string; }'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(100,56): error TS2339: Property 'bat' does not exist on type 'Defaultize<FooProps & InferredPropTypes<{ foo: PropTypeChecker<string, false>; bar: PropTypeChecker<ReactNode, false>; baz: PropTypeChecker<number, true>; }>, { foo: string; }>'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(102,57): error TS2326: Types of property 'baz' are incompatible.
|
||||
Type 'null' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(111,46): error TS2326: Types of property 'foo' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(112,46): error TS2326: Types of property 'foo' are incompatible.
|
||||
Type 'null' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(113,57): error TS2326: Types of property 'bar' are incompatible.
|
||||
Type 'null' is not assignable to type 'ReactNode'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(102,57): error TS2322: Type 'null' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(111,46): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(112,46): error TS2322: Type 'null' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(113,57): error TS2322: Type 'null' is not assignable to type 'ReactNode'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(122,58): error TS2339: Property 'bar' does not exist on type 'Defaultize<FooProps, { foo: string; }>'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS2326: Types of property 'foo' are incompatible.
|
||||
Type 'number' is not assignable to type 'string | undefined'.
|
||||
tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS2322: Type 'number' is not assignable to type 'string | undefined'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx (15 errors) ====
|
||||
@@ -94,9 +85,8 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232
|
||||
!!! error TS2339: Property 'bat' does not exist on type 'Defaultize<InferredPropTypes<{ foo: PropTypeChecker<number, false>; bar: PropTypeChecker<ReactNode, false>; baz: PropTypeChecker<string, true>; }>, { foo: number; }>'.
|
||||
const e = <Component foo={12} bar={null} baz="cool" />; // bar is nullable/undefinable since it's not marked `isRequired`
|
||||
const f = <Component foo={12} bar="yeah" baz={null} />; // Error, baz is _not_ nullable/undefinable since it's marked `isRequired`
|
||||
~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'baz' are incompatible.
|
||||
!!! error TS2326: Type 'null' is not assignable to type 'string'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'string'.
|
||||
|
||||
class JustPropTypes extends ReactComponent {
|
||||
static propTypes = {
|
||||
@@ -107,14 +97,14 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232
|
||||
|
||||
const g = <JustPropTypes foo={12} bar="ok" />;
|
||||
const h = <JustPropTypes foo="no" />; // error, wrong type
|
||||
~~~~~~~~
|
||||
!!! error TS2326: Types of property 'foo' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number | null | undefined'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | null | undefined'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:63:9: The expected type comes from property 'foo' which is declared here on type 'InferredPropTypes<{ foo: PropTypeChecker<number, false>; bar: PropTypeChecker<ReactNode, true>; }>'
|
||||
const i = <JustPropTypes foo={null} bar="ok" />;
|
||||
const j = <JustPropTypes foo={12} bar={null} />; // error, bar is required
|
||||
~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'bar' are incompatible.
|
||||
!!! error TS2326: Type 'null' is not assignable to type 'ReactNode'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'ReactNode'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:64:9: The expected type comes from property 'bar' which is declared here on type 'InferredPropTypes<{ foo: PropTypeChecker<number, false>; bar: PropTypeChecker<ReactNode, true>; }>'
|
||||
|
||||
class JustDefaultProps extends ReactComponent {
|
||||
static defaultProps = {
|
||||
@@ -127,9 +117,9 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232
|
||||
~~~~~~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'Defaultize<{}, { foo: number; }>'.
|
||||
const m = <JustDefaultProps foo="no" />; // error, wrong type
|
||||
~~~~~~~~
|
||||
!!! error TS2326: Types of property 'foo' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number | undefined'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | undefined'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:75:9: The expected type comes from property 'foo' which is declared here on type 'Defaultize<{}, { foo: number; }>'
|
||||
|
||||
interface FooProps {
|
||||
foo: string;
|
||||
@@ -157,9 +147,8 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232
|
||||
!!! error TS2339: Property 'bat' does not exist on type 'Defaultize<FooProps & InferredPropTypes<{ foo: PropTypeChecker<string, false>; bar: PropTypeChecker<ReactNode, false>; baz: PropTypeChecker<number, true>; }>, { foo: string; }>'.
|
||||
const r = <BothWithSpecifiedGeneric foo="no" bar={null} baz={0} />; // bar is nullable/undefinable since it's not marked `isRequired`
|
||||
const s = <BothWithSpecifiedGeneric foo="eh" bar="yeah" baz={null} />; // Error, baz is _not_ nullable/undefinable since it's marked `isRequired`
|
||||
~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'baz' are incompatible.
|
||||
!!! error TS2326: Type 'null' is not assignable to type 'number'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'number'.
|
||||
|
||||
class JustPropTypesWithSpecifiedGeneric extends ReactComponent<FooProps> {
|
||||
static propTypes = {
|
||||
@@ -169,17 +158,17 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232
|
||||
}
|
||||
const t = <JustPropTypesWithSpecifiedGeneric foo="nice" bar="ok" />;
|
||||
const u = <JustPropTypesWithSpecifiedGeneric foo={12} />; // error, wrong type
|
||||
~~~~~~~~
|
||||
!!! error TS2326: Types of property 'foo' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:84:5: The expected type comes from property 'foo' which is declared here on type 'FooProps & InferredPropTypes<{ foo: PropTypeChecker<string, false>; bar: PropTypeChecker<ReactNode, true>; }>'
|
||||
const v = <JustPropTypesWithSpecifiedGeneric foo={null} bar="ok" />; // generic overrides propTypes required-ness, null isn't valid
|
||||
~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'foo' are incompatible.
|
||||
!!! error TS2326: Type 'null' is not assignable to type 'string'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:84:5: The expected type comes from property 'foo' which is declared here on type 'FooProps & InferredPropTypes<{ foo: PropTypeChecker<string, false>; bar: PropTypeChecker<ReactNode, true>; }>'
|
||||
const w = <JustPropTypesWithSpecifiedGeneric foo="cool" bar={null} />; // error, bar is required
|
||||
~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'bar' are incompatible.
|
||||
!!! error TS2326: Type 'null' is not assignable to type 'ReactNode'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'ReactNode'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:107:9: The expected type comes from property 'bar' which is declared here on type 'FooProps & InferredPropTypes<{ foo: PropTypeChecker<string, false>; bar: PropTypeChecker<ReactNode, true>; }>'
|
||||
|
||||
class JustDefaultPropsWithSpecifiedGeneric extends ReactComponent<FooProps> {
|
||||
static defaultProps = {
|
||||
@@ -192,8 +181,8 @@ tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx(123,49): error TS232
|
||||
~~~~~~~~
|
||||
!!! error TS2339: Property 'bar' does not exist on type 'Defaultize<FooProps, { foo: string; }>'.
|
||||
const z = <JustDefaultPropsWithSpecifiedGeneric foo={12} />; // error, wrong type
|
||||
~~~~~~~~
|
||||
!!! error TS2326: Types of property 'foo' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string | undefined'.
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | undefined'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/tsxLibraryManagedAttributes.tsx:117:9: The expected type comes from property 'foo' which is declared here on type 'Defaultize<FooProps, { foo: string; }>'
|
||||
const aa = <JustDefaultPropsWithSpecifiedGeneric />;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/conformance/jsx/file.tsx(13,11): error TS2322: Type '{}' is not assignable to type 'Prop'.
|
||||
Property 'a' is missing in type '{}'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,18): error TS2326: Types of property 'a' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,18): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
|
||||
@@ -27,6 +26,6 @@ tests/cases/conformance/jsx/file.tsx(19,18): error TS2326: Types of property 'a'
|
||||
|
||||
// Error
|
||||
let x2 = <MyComp a="hi"/>
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'a' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'a' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<Prop>> & Prop & { children?: ReactNode; }'
|
||||
@@ -1,11 +1,7 @@
|
||||
tests/cases/conformance/jsx/file.tsx(19,23): error TS2326: Types of property 'x' are incompatible.
|
||||
Type '3' is not assignable to type '2'.
|
||||
tests/cases/conformance/jsx/file.tsx(20,25): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type '2'.
|
||||
tests/cases/conformance/jsx/file.tsx(21,25): error TS2326: Types of property 'x' are incompatible.
|
||||
Type '3' is not assignable to type '2'.
|
||||
tests/cases/conformance/jsx/file.tsx(22,15): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'true' is not assignable to type '2'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,23): error TS2322: Type '3' is not assignable to type '2'.
|
||||
tests/cases/conformance/jsx/file.tsx(20,25): error TS2322: Type 'string' is not assignable to type '2'.
|
||||
tests/cases/conformance/jsx/file.tsx(21,25): error TS2322: Type '3' is not assignable to type '2'.
|
||||
tests/cases/conformance/jsx/file.tsx(22,15): error TS2322: Type 'true' is not assignable to type '2'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (4 errors) ====
|
||||
@@ -28,19 +24,19 @@ tests/cases/conformance/jsx/file.tsx(22,15): error TS2326: Types of property 'x'
|
||||
|
||||
// Error
|
||||
let y = <Opt {...obj} x={3}/>;
|
||||
~~~~~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type '3' is not assignable to type '2'.
|
||||
~
|
||||
!!! error TS2322: Type '3' is not assignable to type '2'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Opt> & OptionProp & { children?: ReactNode; }'
|
||||
let y1 = <Opt {...obj1} x="Hi"/>;
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type '2'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '2'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Opt> & OptionProp & { children?: ReactNode; }'
|
||||
let y2 = <Opt {...obj1} x={3}/>;
|
||||
~~~~~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type '3' is not assignable to type '2'.
|
||||
~
|
||||
!!! error TS2322: Type '3' is not assignable to type '2'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Opt> & OptionProp & { children?: ReactNode; }'
|
||||
let y3 = <Opt x />;
|
||||
~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'true' is not assignable to type '2'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type '2'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Opt> & OptionProp & { children?: ReactNode; }'
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
tests/cases/conformance/jsx/file.tsx(27,33): error TS2326: Types of property 'y' are incompatible.
|
||||
Type 'true' is not assignable to type 'false'.
|
||||
tests/cases/conformance/jsx/file.tsx(28,50): error TS2326: Types of property 'x' are incompatible.
|
||||
Type '3' is not assignable to type '2'.
|
||||
tests/cases/conformance/jsx/file.tsx(27,33): error TS2322: Type 'true' is not assignable to type 'false'.
|
||||
tests/cases/conformance/jsx/file.tsx(28,50): error TS2322: Type '3' is not assignable to type '2'.
|
||||
tests/cases/conformance/jsx/file.tsx(30,11): error TS2322: Type '{ y: true; x: 2; overwrite: string; }' is not assignable to type 'Prop'.
|
||||
Types of property 'y' are incompatible.
|
||||
Type 'true' is not assignable to type 'false'.
|
||||
@@ -36,12 +34,12 @@ tests/cases/conformance/jsx/file.tsx(30,11): error TS2322: Type '{ y: true; x: 2
|
||||
// Error
|
||||
let x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1} />
|
||||
~
|
||||
!!! error TS2326: Types of property 'y' are incompatible.
|
||||
!!! error TS2326: Type 'true' is not assignable to type 'false'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'false'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:14:5: The expected type comes from property 'y' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<OverWriteAttr> & Prop & { children?: ReactNode; }'
|
||||
let x1 = <OverWriteAttr overwrite="hi" {...obj1} x={3} {...{y: true}} />
|
||||
~~~~~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type '3' is not assignable to type '2'.
|
||||
~
|
||||
!!! error TS2322: Type '3' is not assignable to type '2'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:13:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<OverWriteAttr> & Prop & { children?: ReactNode; }'
|
||||
let x2 = <OverWriteAttr {...anyobj} x={3} />
|
||||
let x3 = <OverWriteAttr overwrite="hi" {...obj1} {...{y: true}} />
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
@@ -2,10 +2,8 @@ tests/cases/conformance/jsx/file.tsx(17,10): error TS2322: Type '{}' is not assi
|
||||
Property 'x' is missing in type '{}'.
|
||||
tests/cases/conformance/jsx/file.tsx(18,10): error TS2322: Type '{}' is not assignable to type 'PoisonedProp'.
|
||||
Property 'x' is missing in type '{}'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,19): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,21): error TS2326: Types of property 'y' are incompatible.
|
||||
Type 'true' is not assignable to type '"2"'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,19): error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,21): error TS2322: Type 'true' is not assignable to type '"2"'.
|
||||
tests/cases/conformance/jsx/file.tsx(20,10): error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
@@ -41,11 +39,11 @@ tests/cases/conformance/jsx/file.tsx(21,11): error TS2322: Type '{ X: string; x:
|
||||
!!! error TS2322: Property 'x' is missing in type '{}'.
|
||||
let z = <Poisoned x y/>;
|
||||
~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'true' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'
|
||||
~
|
||||
!!! error TS2326: Types of property 'y' are incompatible.
|
||||
!!! error TS2326: Type 'true' is not assignable to type '"2"'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type '"2"'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'y' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'
|
||||
let w = <Poisoned {...{x: 5, y: "2"}}/>;
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
|
||||
|
||||
@@ -2,24 +2,18 @@ tests/cases/conformance/jsx/file.tsx(12,13): error TS2322: Type '{ extraProp: tr
|
||||
Property 'yy' is missing in type '{ extraProp: true; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(13,13): error TS2322: Type '{ yy: number; }' is not assignable to type '{ yy: number; yy1: string; }'.
|
||||
Property 'yy1' is missing in type '{ yy: number; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(14,31): error TS2326: Types of property 'yy1' are incompatible.
|
||||
Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(14,31): error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(16,31): error TS2339: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(17,13): error TS2322: Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'.
|
||||
Types of property 'yy' are incompatible.
|
||||
Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(25,13): error TS2322: Type '{ extra-data: true; }' is not assignable to type '{ yy: string; direction?: number; }'.
|
||||
Property 'yy' is missing in type '{ extra-data: true; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(26,40): error TS2326: Types of property 'direction' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(33,32): error TS2326: Types of property 'y3' are incompatible.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(34,29): error TS2326: Types of property 'y1' are incompatible.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(35,29): error TS2326: Types of property 'y1' are incompatible.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(36,29): error TS2326: Types of property 'y1' are incompatible.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(26,40): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(33,32): error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(34,29): error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(35,29): error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (11 errors) ====
|
||||
@@ -44,8 +38,8 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2326: Types of property 'y1
|
||||
!!! error TS2322: Property 'yy1' is missing in type '{ yy: number; }'.
|
||||
const c2 = <OneThing {...obj} yy1 />; // type incompatible;
|
||||
~~~
|
||||
!!! error TS2326: Types of property 'yy1' are incompatible.
|
||||
!!! error TS2326: Type 'true' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:43: The expected type comes from property 'yy1' which is declared here on type 'IntrinsicAttributes & { yy: number; yy1: string; }'
|
||||
const c3 = <OneThing {...obj} {...{extra: "extra attr"}} />; // This is OK becuase all attribute are spread
|
||||
const c4 = <OneThing {...obj} y1={10000} />; // extra property;
|
||||
~~~~~~~~~~
|
||||
@@ -67,9 +61,9 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2326: Types of property 'y1
|
||||
!!! error TS2322: Type '{ extra-data: true; }' is not assignable to type '{ yy: string; direction?: number; }'.
|
||||
!!! error TS2322: Property 'yy' is missing in type '{ extra-data: true; }'.
|
||||
const d2 = <TestingOneThing yy="hello" direction="left" />
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'direction' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:22:50: The expected type comes from property 'direction' which is declared here on type 'IntrinsicAttributes & { yy: string; direction?: number; }'
|
||||
|
||||
declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element;
|
||||
declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element;
|
||||
@@ -77,19 +71,19 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2326: Types of property 'y1
|
||||
|
||||
// Error
|
||||
const e1 = <TestingOptional y1 y3="hello"/>
|
||||
~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'y3' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'boolean'.
|
||||
~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:64: The expected type comes from property 'y3' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'
|
||||
const e2 = <TestingOptional y1="hello" y2={1000} y3 />
|
||||
~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'y1' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'boolean'.
|
||||
~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'
|
||||
const e3 = <TestingOptional y1="hello" y2={1000} children="hi" />
|
||||
~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'y1' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'boolean'.
|
||||
~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'
|
||||
const e4 = <TestingOptional y1="hello" y2={1000}>Hi</TestingOptional>
|
||||
~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'y1' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'boolean'.
|
||||
~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'
|
||||
|
||||
@@ -8,12 +8,9 @@ tests/cases/conformance/jsx/file.tsx(51,13): error TS2322: Type '{ onClick: (k:
|
||||
Property '"data-format"' is missing in type '{ onClick: (k: MouseEvent<any>) => void; to: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(53,13): error TS2322: Type '{ to: string; onClick(e: any): void; }' is not assignable to type 'HyphenProps'.
|
||||
Property '"data-format"' is missing in type '{ to: string; onClick(e: any): void; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(54,51): error TS2326: Types of property 'children' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(55,68): error TS2326: Types of property 'className' are incompatible.
|
||||
Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(56,24): error TS2326: Types of property 'data-format' are incompatible.
|
||||
Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(54,51): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(55,68): error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(56,24): error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (8 errors) ====
|
||||
@@ -86,14 +83,14 @@ tests/cases/conformance/jsx/file.tsx(56,24): error TS2326: Types of property 'da
|
||||
!!! error TS2322: Type '{ to: string; onClick(e: any): void; }' is not assignable to type 'HyphenProps'.
|
||||
!!! error TS2322: Property '"data-format"' is missing in type '{ to: string; onClick(e: any): void; }'.
|
||||
const b6 = <MainButton {...{ onClick(e: any){} }} children={10} />; // incorrect type for optional attribute
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'children' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & HyphenProps'
|
||||
const b7 = <MainButton {...{ onClick(e: any){} }} children="hello" className />; // incorrect type for optional attribute
|
||||
~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'className' are incompatible.
|
||||
!!! error TS2326: Type 'true' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'className' which is declared here on type 'IntrinsicAttributes & HyphenProps'
|
||||
const b8 = <MainButton data-format />; // incorrect type for specified hyphanated name
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'data-format' are incompatible.
|
||||
!!! error TS2326: Type 'true' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:17:5: The expected type comes from property 'data-format' which is declared here on type 'IntrinsicAttributes & HyphenProps'
|
||||
+4
-5
@@ -1,5 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(13,24): error TS2326: Types of property 'values' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(13,24): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
|
||||
@@ -16,6 +15,6 @@ tests/cases/conformance/jsx/file.tsx(13,24): error TS2326: Types of property 'va
|
||||
|
||||
// Error
|
||||
let i1 = <MyComponent1 values={5}/>;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'values' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'values' which is declared here on type 'IntrinsicAttributes & MyComponentProp'
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/conformance/jsx/file.tsx(19,10): error TS2322: Type '{ naaame: string; }' is not assignable to type '{ name: string; }'.
|
||||
Property 'name' is missing in type '{ naaame: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(27,15): error TS2326: Types of property 'name' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(27,15): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(29,10): error TS2559: Type '{ naaaaaaame: string; }' has no properties in common with type 'IntrinsicAttributes & { name?: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(34,10): error TS2322: Type '{ extra-prop-name: string; }' is not assignable to type '{ "prop-name": string; }'.
|
||||
Property '"prop-name"' is missing in type '{ extra-prop-name: string; }'.
|
||||
@@ -42,9 +41,8 @@ tests/cases/conformance/jsx/file.tsx(45,11): error TS2559: Type '{ prop1: boolea
|
||||
let d = <Meet name='me' />;
|
||||
// Error
|
||||
let e = <Meet name={42} />;
|
||||
~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'name' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
// Error
|
||||
let f = <Meet naaaaaaame='no' />;
|
||||
~~~~
|
||||
|
||||
+16
-21
@@ -1,14 +1,10 @@
|
||||
tests/cases/conformance/jsx/file.tsx(8,43): error TS2326: Types of property 'ignore-prop' are incompatible.
|
||||
Type '(T & { ignore-prop: number; })["ignore-prop"]' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(8,43): error TS2322: Type '10' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(13,15): error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes & { prop: {}; "ignore-prop": string; }'.
|
||||
Type 'T' is not assignable to type '{ prop: {}; "ignore-prop": string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(20,19): error TS2326: Types of property 'func' are incompatible.
|
||||
Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'.
|
||||
tests/cases/conformance/jsx/file.tsx(31,52): error TS2326: Types of property 'selectHandler' are incompatible.
|
||||
Type '(val: string) => void' is not assignable to type '(selectedVal: number) => void'.
|
||||
Types of parameters 'val' and 'selectedVal' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(20,19): error TS2322: Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'.
|
||||
tests/cases/conformance/jsx/file.tsx(31,52): error TS2322: Type '(val: string) => void' is not assignable to type '(selectedVal: number) => void'.
|
||||
Types of parameters 'val' and 'selectedVal' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (4 errors) ====
|
||||
@@ -20,10 +16,9 @@ tests/cases/conformance/jsx/file.tsx(31,52): error TS2326: Types of property 'se
|
||||
// Error
|
||||
function Bar<T extends {prop: number}>(arg: T) {
|
||||
let a1 = <ComponentSpecific1 {...arg} ignore-prop={10} />;
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'ignore-prop' are incompatible.
|
||||
!!! error TS2326: Type '(T & { ignore-prop: number; })["ignore-prop"]' is not assignable to type 'string'.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type '10' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:53: The expected type comes from property 'ignore-prop' which is declared here on type 'IntrinsicAttributes & { prop: number; "ignore-prop": string; }'
|
||||
}
|
||||
|
||||
// Error
|
||||
@@ -39,9 +34,9 @@ tests/cases/conformance/jsx/file.tsx(31,52): error TS2326: Types of property 'se
|
||||
// Error
|
||||
function createLink(func: (a: number, b: string)=>void) {
|
||||
let o = <Link func={func} />
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'func' are incompatible.
|
||||
!!! error TS2326: Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'.
|
||||
~~~~
|
||||
!!! error TS2322: Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:16:30: The expected type comes from property 'func' which is declared here on type 'IntrinsicAttributes & { func: (arg: number) => void; }'
|
||||
}
|
||||
|
||||
interface InferParamProp<T> {
|
||||
@@ -53,9 +48,9 @@ tests/cases/conformance/jsx/file.tsx(31,52): error TS2326: Types of property 'se
|
||||
|
||||
// Error
|
||||
let i = <InferParamComponent values={[1, 2, 3, 4]} selectHandler={(val: string) => { }} />;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2326: Types of property 'selectHandler' are incompatible.
|
||||
!!! error TS2326: Type '(val: string) => void' is not assignable to type '(selectedVal: number) => void'.
|
||||
!!! error TS2326: Types of parameters 'val' and 'selectedVal' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(val: string) => void' is not assignable to type '(selectedVal: number) => void'.
|
||||
!!! error TS2322: Types of parameters 'val' and 'selectedVal' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:25:5: The expected type comes from property 'selectHandler' which is declared here on type 'IntrinsicAttributes & InferParamProp<number>'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
tests/cases/compiler/file.tsx(11,14): error TS2326: Types of property 'prop' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/file.tsx(11,14): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/file.tsx (1 errors) ====
|
||||
@@ -14,7 +13,7 @@ tests/cases/compiler/file.tsx(11,14): error TS2326: Types of property 'prop' are
|
||||
}
|
||||
|
||||
<SFC<string> prop={1}></SFC>; // should error
|
||||
~~~~~~~~
|
||||
!!! error TS2326: Types of property 'prop' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 /.ts/lib.es5.d.ts:1382:39: The expected type comes from property 'prop' which is declared here on type 'Record<string, string>'
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
tests/cases/conformance/jsx/file.tsx(16,26): error TS2326: Types of property 'b' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(18,26): error TS2326: Types of property 'b' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(16,26): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(18,26): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(20,13): error TS2558: Expected 1 type arguments, but got 2.
|
||||
tests/cases/conformance/jsx/file.tsx(22,13): error TS2558: Expected 1 type arguments, but got 2.
|
||||
tests/cases/conformance/jsx/file.tsx(24,12): error TS1099: Type argument list cannot be empty.
|
||||
@@ -9,19 +7,15 @@ tests/cases/conformance/jsx/file.tsx(26,12): error TS1099: Type argument list ca
|
||||
tests/cases/conformance/jsx/file.tsx(39,14): error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(39,20): error TS2326: Types of property 'a' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(39,20): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(41,14): error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(41,20): error TS2326: Types of property 'a' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(41,20): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/jsx/file.tsx(47,14): error TS2558: Expected 1-2 type arguments, but got 3.
|
||||
tests/cases/conformance/jsx/file.tsx(47,53): error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: ReactNode; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(49,14): error TS2558: Expected 1-2 type arguments, but got 3.
|
||||
tests/cases/conformance/jsx/file.tsx(49,53): error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: ReactNode; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(51,47): error TS2326: Types of property 'b' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(51,47): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(53,47): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (16 errors) ====
|
||||
@@ -41,14 +35,14 @@ tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b'
|
||||
x = <MyComp<Prop> a={10} b="hi"></MyComp>; // OK
|
||||
|
||||
x = <MyComp<Prop> a={10} b={20} />; // error
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'b' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<Prop>> & Prop & { children?: ReactNode; }'
|
||||
|
||||
x = <MyComp<Prop> a={10} b={20}></MyComp>; // error
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'b' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp<Prop>> & Prop & { children?: ReactNode; }'
|
||||
|
||||
x = <MyComp<Prop, Prop> a={10} b="hi" />; // error
|
||||
~~~~~~~~~~
|
||||
@@ -82,16 +76,16 @@ tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b'
|
||||
!!! error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'.
|
||||
!!! error TS2344: Types of property 'a' are incompatible.
|
||||
!!! error TS2344: Type 'number' is not assignable to type 'string'.
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'a' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:32:35: The expected type comes from property 'a' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: ReactNode; }'
|
||||
|
||||
x = <MyComp2<Prop> a={10} b="hi"></MyComp2>; // error
|
||||
~~~~
|
||||
!!! error TS2344: Type 'Prop' does not satisfy the constraint '{ a: string; }'.
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'a' are incompatible.
|
||||
!!! error TS2326: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:32:35: The expected type comes from property 'a' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: ReactNode; }'
|
||||
|
||||
x = <MyComp2<{a: string}, {b: string}> a="hi" b="hi" />; // OK
|
||||
|
||||
@@ -110,12 +104,12 @@ tests/cases/conformance/jsx/file.tsx(53,47): error TS2326: Types of property 'b'
|
||||
!!! error TS2339: Property 'b' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, {}>> & { a: string; } & { children?: ReactNode; }'.
|
||||
|
||||
x = <MyComp2<{a: string}, {b: number}> a="hi" b="hi" />; // error
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'b' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:51:28: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, { b: number; }>> & { a: string; } & { b: number; } & { children?: ReactNode; }'
|
||||
|
||||
x = <MyComp2<{a: string}, {b: number}> a="hi" b="hi"></MyComp2>; // error
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'b' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:53:28: The expected type comes from property 'b' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<MyComp2<{ a: string; }, { b: number; }>> & { a: string; } & { b: number; } & { children?: ReactNode; }'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(12,10): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type 'number | boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(12,10): error TS2322: Type 'string' is not assignable to type 'number | boolean'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
|
||||
@@ -15,6 +14,6 @@ tests/cases/conformance/jsx/file.tsx(12,10): error TS2326: Types of property 'x'
|
||||
|
||||
var SFCComp = SFC1 || SFC2;
|
||||
<SFCComp x={"hi"}/>
|
||||
~~~~~~~~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'number | boolean'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | boolean'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:23: The expected type comes from property 'x' which is declared here on type '(IntrinsicAttributes & { x: number; }) | (IntrinsicAttributes & { x: boolean; })'
|
||||
@@ -1,5 +1,4 @@
|
||||
tests/cases/conformance/jsx/file.tsx(32,17): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'true' is not assignable to type 'ReactText'.
|
||||
tests/cases/conformance/jsx/file.tsx(32,17): error TS2322: Type 'true' is not assignable to type 'ReactText'.
|
||||
tests/cases/conformance/jsx/file.tsx(33,10): error TS2559: Type '{ x: number; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: ReactNode; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(34,10): error TS2559: Type '{ prop: true; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC3> & { children?: ReactNode; }'.
|
||||
|
||||
@@ -38,8 +37,8 @@ tests/cases/conformance/jsx/file.tsx(34,10): error TS2559: Type '{ prop: true; }
|
||||
// Error
|
||||
let a = <RCComp x />;
|
||||
~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'true' is not assignable to type 'ReactText'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'ReactText'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:3:36: The expected type comes from property 'x' which is declared here on type '(IntrinsicAttributes & IntrinsicClassAttributes<RC1> & { x: number; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes<RC2> & { x: string; } & { children?: ReactNode; })'
|
||||
let b = <PartRCComp x={10} />
|
||||
~~~~~~~~~~
|
||||
!!! error TS2559: Type '{ x: number; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<RC4> & { children?: ReactNode; }'.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
tests/cases/conformance/jsx/file.tsx(18,10): error TS2559: Type '{ x: true; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,27): error TS2326: Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(19,27): error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(20,10): error TS2322: Type '{}' is not assignable to type '{ x: boolean; }'.
|
||||
Property 'x' is missing in type '{}'.
|
||||
tests/cases/conformance/jsx/file.tsx(21,10): error TS2322: Type '{ data-prop: true; }' is not assignable to type '{ x: boolean; }'.
|
||||
@@ -29,9 +28,9 @@ tests/cases/conformance/jsx/file.tsx(21,10): error TS2322: Type '{ data-prop: tr
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2559: Type '{ x: true; }' has no properties in common with type 'IntrinsicAttributes'.
|
||||
let b = <SFC2AndEmptyComp x="hi" />;
|
||||
~~~~~~
|
||||
!!! error TS2326: Types of property 'x' are incompatible.
|
||||
!!! error TS2326: Type 'string' is not assignable to type 'boolean'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:11:23: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & { x: boolean; }'
|
||||
let c = <SFC2AndEmptyComp />;
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type '{ x: boolean; }'.
|
||||
|
||||
@@ -2,8 +2,8 @@ tests/cases/compiler/tupleTypes.ts(14,1): error TS2322: Type '[]' is not assigna
|
||||
Property '0' is missing in type '[]'.
|
||||
tests/cases/compiler/tupleTypes.ts(15,1): error TS2322: Type '[number]' is not assignable to type '[number, string]'.
|
||||
Property '1' is missing in type '[number]'.
|
||||
tests/cases/compiler/tupleTypes.ts(17,1): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/tupleTypes.ts(17,6): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/tupleTypes.ts(17,15): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/tupleTypes.ts(18,1): error TS2322: Type '[number, string, number]' is not assignable to type '[number, string]'.
|
||||
Types of property 'length' are incompatible.
|
||||
Type '3' is not assignable to type '2'.
|
||||
@@ -24,7 +24,7 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n
|
||||
Type '{}' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/tupleTypes.ts (9 errors) ====
|
||||
==== tests/cases/compiler/tupleTypes.ts (10 errors) ====
|
||||
var v1: []; // Error
|
||||
var v2: [number];
|
||||
var v3: [number, string];
|
||||
@@ -48,9 +48,10 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n
|
||||
!!! error TS2322: Property '1' is missing in type '[number]'.
|
||||
t = [1, "hello"]; // Ok
|
||||
t = ["hello", 1]; // Error
|
||||
~
|
||||
!!! error TS2322: Type '[string, number]' is not assignable to type '[number, string]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
t = [1, "hello", 2]; // Error
|
||||
~
|
||||
!!! error TS2322: Type '[number, string, number]' is not assignable to type '[number, string]'.
|
||||
|
||||
+4
-7
@@ -1,6 +1,4 @@
|
||||
tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts(10,5): error TS2322: Type '{ [SYM]: "str"; }' is not assignable to type 'I'.
|
||||
Types of property '[SYM]' are incompatible.
|
||||
Type '"str"' is not assignable to type '"sym"'.
|
||||
tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts(10,13): error TS2418: Type of computed property's value is '"str"', which is not assignable to type '"sym"'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts (1 errors) ====
|
||||
@@ -14,8 +12,7 @@ tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts(10,5):
|
||||
|
||||
let a: I = {[SYM]: 'sym'}; // Expect ok
|
||||
let b: I = {[SYM]: 'str'}; // Expect error
|
||||
~
|
||||
!!! error TS2322: Type '{ [SYM]: "str"; }' is not assignable to type 'I'.
|
||||
!!! error TS2322: Types of property '[SYM]' are incompatible.
|
||||
!!! error TS2322: Type '"str"' is not assignable to type '"sym"'.
|
||||
~~~~~
|
||||
!!! error TS2418: Type of computed property's value is '"str"', which is not assignable to type '"sym"'.
|
||||
!!! related TS6500 tests/cases/compiler/uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts:5:3: The expected type comes from property 'unique symbol' which is declared here on type 'I'
|
||||
|
||||
@@ -7,9 +7,7 @@ tests/cases/compiler/widenedTypes.ts(10,1): error TS2322: Type '""' is not assig
|
||||
tests/cases/compiler/widenedTypes.ts(17,1): error TS2322: Type '""' is not assignable to type 'number'.
|
||||
tests/cases/compiler/widenedTypes.ts(22,5): error TS2322: Type 'number[]' is not assignable to type 'string[]'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/widenedTypes.ts(23,5): error TS2322: Type '{ x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
Property 'x' is incompatible with index signature.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/widenedTypes.ts(23,39): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/widenedTypes.ts (9 errors) ====
|
||||
@@ -53,7 +51,6 @@ tests/cases/compiler/widenedTypes.ts(23,5): error TS2322: Type '{ x: number; y:
|
||||
!!! error TS2322: Type 'number[]' is not assignable to type 'string[]'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
var obj: { [x: string]: string; } = { x: 3, y: null }; // assignable because null is widened, and therefore BCT is any
|
||||
~~~
|
||||
!!! error TS2322: Type '{ x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
!!! error TS2322: Property 'x' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! related TS6501 tests/cases/compiler/widenedTypes.ts:23:12: The expected type comes from this index signature.
|
||||
@@ -0,0 +1,30 @@
|
||||
// @pretty: true
|
||||
interface A {
|
||||
a: number;
|
||||
}
|
||||
|
||||
interface Large {
|
||||
something: {
|
||||
another: {
|
||||
more: {
|
||||
thing: A;
|
||||
}
|
||||
yetstill: {
|
||||
another: A;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const x: Large = {
|
||||
something: {
|
||||
another: {
|
||||
more: {
|
||||
thing: {}
|
||||
},
|
||||
yetstill: {
|
||||
another: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
interface Foo {
|
||||
a: {
|
||||
b: {
|
||||
c: {
|
||||
d: string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let q: Foo["a"] | undefined;
|
||||
const x: Foo = (void 0, {
|
||||
a: q = {
|
||||
b: ({
|
||||
c: {
|
||||
d: 42
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
// @jsx: react
|
||||
// @noLib: true
|
||||
// @skipLibCheck: true
|
||||
// @libFiles: react.d.ts,lib.d.ts
|
||||
|
||||
// @Filename: my-component.tsx
|
||||
import * as React from 'react'
|
||||
|
||||
interface MyProps {
|
||||
x: string;
|
||||
y: MyInnerProps;
|
||||
}
|
||||
|
||||
interface MyInnerProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export function MyComponent(_props: MyProps) {
|
||||
return <span>my component</span>;
|
||||
}
|
||||
|
||||
// @Filename: file1.tsx
|
||||
|
||||
import * as React from 'react'
|
||||
import { MyComponent } from './my-component'
|
||||
|
||||
export const result = <MyComponent x="yes" y={{
|
||||
value: 42
|
||||
}} />;
|
||||
Reference in New Issue
Block a user