diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4f1b797e58a67..8a3579295dd49 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10716,7 +10716,7 @@ namespace ts { const intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode); if (intrinsicAttributes !== errorType && intrinsicClassAttributes !== errorType && (contains(targetTypes, intrinsicAttributes) || contains(targetTypes, intrinsicClassAttributes))) { - // do not report top error + // only report an error when the target isn't the intersection type with Intrinsic[Class]Attributes return result; } } @@ -11281,7 +11281,12 @@ namespace ts { const unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties); if (unmatchedProperty) { if (reportErrors) { - reportError(Diagnostics.Property_0_is_missing_in_type_1, symbolToString(unmatchedProperty), typeToString(source)); + if (getObjectFlags(source) & ObjectFlags.JsxAttributes) { + reportError(Diagnostics.Property_0_is_missing_in_the_provided_JSX_attributes, symbolToString(unmatchedProperty)); + } + else { + reportError(Diagnostics.Property_0_is_missing_in_type_1, symbolToString(unmatchedProperty), typeToString(source)); + } } return Ternary.False; } diff --git a/src/parser/diagnosticMessages.json b/src/parser/diagnosticMessages.json index 599d81c499778..577a1eb85d14b 100644 --- a/src/parser/diagnosticMessages.json +++ b/src/parser/diagnosticMessages.json @@ -2072,6 +2072,10 @@ "category": "Error", "code": 2609 }, + "Property '{0}' is missing in the provided JSX attributes.": { + "category": "Error", + "code": 2610 + }, "Cannot augment module '{0}' with value exports because it resolves to a non-module entity.": { "category": "Error", "code": 2649 diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 942cbd0aa13eb..2eda3f1bc9dd3 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -5327,6 +5327,7 @@ declare namespace ts { JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: DiagnosticMessage; The_global_type_JSX_0_may_not_have_more_than_one_property: DiagnosticMessage; JSX_spread_child_must_be_an_array_type: DiagnosticMessage; + Property_0_is_missing_in_the_provided_JSX_attributes: DiagnosticMessage; Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: DiagnosticMessage; A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: DiagnosticMessage; Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: DiagnosticMessage; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index d4ebabca0a994..29b40e6b8e193 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -5327,6 +5327,7 @@ declare namespace ts { JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: DiagnosticMessage; The_global_type_JSX_0_may_not_have_more_than_one_property: DiagnosticMessage; JSX_spread_child_must_be_an_array_type: DiagnosticMessage; + Property_0_is_missing_in_the_provided_JSX_attributes: DiagnosticMessage; Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: DiagnosticMessage; A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: DiagnosticMessage; Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: DiagnosticMessage; diff --git a/tests/baselines/reference/checkJsxChildrenProperty2.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty2.errors.txt index ac342678508c5..fa9165511f487 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty2.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(14,10): error TS2322: Type '{ a: number; b: string; }' is not assignable to type 'Prop'. - Property 'children' is missing in type '{ a: number; b: string; }'. + Property 'children' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(17,11): error TS2710: 'children' are specified twice. The attribute named 'children' will be overwritten. tests/cases/conformance/jsx/file.tsx(31,6): error TS2322: Type '{ children: (Element | ((name: string) => Element))[]; a: number; b: string; }' is not assignable to type 'Prop'. Types of property 'children' are incompatible. @@ -40,7 +40,7 @@ tests/cases/conformance/jsx/file.tsx(49,6): error TS2322: Type '{ children: Elem let k = ; ~~~~ !!! error TS2322: Type '{ a: number; b: string; }' is not assignable to type 'Prop'. -!!! error TS2322: Property 'children' is missing in type '{ a: number; b: string; }'. +!!! error TS2322: Property 'children' is missing in the provided JSX attributes. let k0 = diff --git a/tests/baselines/reference/checkJsxChildrenProperty5.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty5.errors.txt index 8aa860f4889ef..c51e596898184 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty5.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty5.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(20,10): error TS2322: Type '{ a: number; b: string; }' is not assignable to type 'Prop'. - Property 'children' is missing in type '{ a: number; b: string; }'. + Property 'children' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(24,6): error TS2322: Type '{ children: Element; a: number; b: string; }' is not assignable to type 'Prop'. Types of property 'children' are incompatible. Type 'Element' is not assignable to type 'Button'. @@ -33,7 +33,7 @@ tests/cases/conformance/jsx/file.tsx(28,6): error TS2322: Type '{ children: type let k = ; ~~~~ !!! error TS2322: Type '{ a: number; b: string; }' is not assignable to type 'Prop'. -!!! error TS2322: Property 'children' is missing in type '{ a: number; b: string; }'. +!!! error TS2322: Property 'children' is missing in the provided JSX attributes. // Error: JSX.element is not the same as JSX.ElementClass let k1 = diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt index 96e79a9cec707..641ad71b1c950 100644 --- a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt +++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(27,13): error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'LinkProps'. - Property 'goTo' is missing in type '{ extra: true; onClick: (k: "left" | "right") => void; }'. + Property 'goTo' is missing in the provided JSX attributes. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(28,13): error TS2322: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'LinkProps'. - Property 'goTo' is missing in type '{ onClick: (k: "left" | "right") => void; extra: true; }'. + Property 'goTo' is missing in the provided JSX attributes. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(29,43): error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(30,36): error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(33,65): error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & ButtonProps'. @@ -38,11 +38,11 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(36,44): err const b0 = {console.log(k)}}} extra />; // k has type "left" | "right" ~~~~~~~~~~ !!! error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'LinkProps'. -!!! error TS2322: Property 'goTo' is missing in type '{ extra: true; onClick: (k: "left" | "right") => void; }'. +!!! error TS2322: Property 'goTo' is missing in the provided JSX attributes. const b2 = {console.log(k)}} extra />; // k has type "left" | "right" ~~~~~~~~~~ !!! error TS2322: Type '{ onClick: (k: "left" | "right") => void; extra: true; }' is not assignable to type 'LinkProps'. -!!! error TS2322: Property 'goTo' is missing in type '{ onClick: (k: "left" | "right") => void; extra: true; }'. +!!! error TS2322: Property 'goTo' is missing in the provided JSX attributes. const b3 = ; // goTo has type"home" | "contact" ~~~~~ !!! error TS2339: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'. diff --git a/tests/baselines/reference/tsxAttributeResolution1.errors.txt b/tests/baselines/reference/tsxAttributeResolution1.errors.txt index ab881bfa6f902..10cf22e5db610 100644 --- a/tests/baselines/reference/tsxAttributeResolution1.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution1.errors.txt @@ -6,7 +6,7 @@ tests/cases/conformance/jsx/file.tsx(26,8): error TS2326: Types of property 'x' 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 '{}'. + Property 'reqd' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(30,8): error TS2326: Types of property 'reqd' are incompatible. Type 'number' is not assignable to type 'string'. @@ -55,7 +55,7 @@ tests/cases/conformance/jsx/file.tsx(30,8): error TS2326: Types of property 'req ; // Error, missing reqd ~~~~~ !!! error TS2322: Type '{}' is not assignable to type '{ reqd: string; }'. -!!! error TS2322: Property 'reqd' is missing in type '{}'. +!!! error TS2322: Property 'reqd' is missing in the provided JSX attributes. ; // Error, reqd is not string ~~~~~~~~~ !!! error TS2326: Types of property 'reqd' are incompatible. diff --git a/tests/baselines/reference/tsxAttributeResolution12.errors.txt b/tests/baselines/reference/tsxAttributeResolution12.errors.txt index 802a3b1d9d54e..27162d65858e9 100644 --- a/tests/baselines/reference/tsxAttributeResolution12.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution12.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/jsx/file.tsx(25,11): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & { reqd: any; }'. Type '{}' is not assignable to type '{ reqd: any; }'. - Property 'reqd' is missing in type '{}'. + Property 'reqd' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(28,11): error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & { reqd: any; }'. Type '{}' is not assignable to type '{ reqd: any; }'. - Property 'reqd' is missing in type '{}'. + Property 'reqd' is missing in the provided JSX attributes. ==== tests/cases/conformance/jsx/react.d.ts (0 errors) ==== @@ -48,13 +48,13 @@ tests/cases/conformance/jsx/file.tsx(28,11): error TS2322: Type '{}' is not assi ~ !!! error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & { reqd: any; }'. !!! error TS2322: Type '{}' is not assignable to type '{ reqd: any; }'. -!!! error TS2322: Property 'reqd' is missing in type '{}'. +!!! error TS2322: Property 'reqd' is missing in the provided JSX attributes. // Should error var t2 = ; ~~~~~~~~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & { reqd: any; }'. !!! error TS2322: Type '{}' is not assignable to type '{ reqd: any; }'. -!!! error TS2322: Property 'reqd' is missing in type '{}'. +!!! error TS2322: Property 'reqd' is missing in the provided JSX attributes. \ No newline at end of file diff --git a/tests/baselines/reference/tsxAttributeResolution3.errors.txt b/tests/baselines/reference/tsxAttributeResolution3.errors.txt index 94205714803b2..98e8ad21a4b57 100644 --- a/tests/baselines/reference/tsxAttributeResolution3.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution3.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/jsx/file.tsx(19,2): error TS2322: Type '{ x: number; }' Types of property 'x' are incompatible. 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; }'. + Property 'x' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(31,8): error TS2326: Types of property 'x' are incompatible. Type 'number' is not assignable to type 'string'. @@ -37,7 +37,7 @@ tests/cases/conformance/jsx/file.tsx(31,8): error TS2326: Types of property 'x' ~~~~~ !!! error TS2322: Type '{ y: number; }' is not assignable to type 'Attribs1'. -!!! error TS2322: Property 'x' is missing in type '{ y: number; }'. +!!! error TS2322: Property 'x' is missing in the provided JSX attributes. // OK var obj4 = { x: 32, y: 32 }; diff --git a/tests/baselines/reference/tsxAttributeResolution5.errors.txt b/tests/baselines/reference/tsxAttributeResolution5.errors.txt index 92b8a254c1fe1..7eced05910634 100644 --- a/tests/baselines/reference/tsxAttributeResolution5.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution5.errors.txt @@ -6,7 +6,7 @@ tests/cases/conformance/jsx/file.tsx(25,10): error TS2322: Type 'T' is not assig Type '{ y: string; }' is not assignable to type 'Attribs1'. Property 'x' is missing in type '{ y: string; }'. tests/cases/conformance/jsx/file.tsx(29,2): error TS2322: Type '{}' is not assignable to type 'Attribs1'. - Property 'x' is missing in type '{}'. + Property 'x' is missing in the provided JSX attributes. ==== tests/cases/conformance/jsx/file.tsx (3 errors) ==== @@ -50,6 +50,6 @@ tests/cases/conformance/jsx/file.tsx(29,2): error TS2322: Type '{}' is not assig ; // Error, missing x ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'Attribs1'. -!!! error TS2322: Property 'x' is missing in type '{}'. +!!! error TS2322: Property 'x' is missing in the provided JSX attributes. ; // Error, missing toString \ No newline at end of file diff --git a/tests/baselines/reference/tsxAttributeResolution6.errors.txt b/tests/baselines/reference/tsxAttributeResolution6.errors.txt index e9ad3c3e8deb4..5e2295ec6b9d3 100644 --- a/tests/baselines/reference/tsxAttributeResolution6.errors.txt +++ b/tests/baselines/reference/tsxAttributeResolution6.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/jsx/file.tsx(10,8): error TS2326: Types of property 's' 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(12,2): error TS2322: Type '{}' is not assignable to type '{ n: boolean; }'. - Property 'n' is missing in type '{}'. + Property 'n' is missing in the provided JSX attributes. ==== tests/cases/conformance/jsx/file.tsx (3 errors) ==== @@ -27,7 +27,7 @@ tests/cases/conformance/jsx/file.tsx(12,2): error TS2322: Type '{}' is not assig ; ~~~~~ !!! error TS2322: Type '{}' is not assignable to type '{ n: boolean; }'. -!!! error TS2322: Property 'n' is missing in type '{}'. +!!! error TS2322: Property 'n' is missing in the provided JSX attributes. // OK ; diff --git a/tests/baselines/reference/tsxElementResolution3.errors.txt b/tests/baselines/reference/tsxElementResolution3.errors.txt index fdc278be05391..1c9699dc0ff02 100644 --- a/tests/baselines/reference/tsxElementResolution3.errors.txt +++ b/tests/baselines/reference/tsxElementResolution3.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(12,2): error TS2322: Type '{ w: string; }' is not assignable to type '{ n: string; }'. - Property 'n' is missing in type '{ w: string; }'. + Property 'n' is missing in the provided JSX attributes. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -17,4 +17,4 @@ tests/cases/conformance/jsx/file.tsx(12,2): error TS2322: Type '{ w: string; }' ; ~~~~ !!! error TS2322: Type '{ w: string; }' is not assignable to type '{ n: string; }'. -!!! error TS2322: Property 'n' is missing in type '{ w: string; }'. \ No newline at end of file +!!! error TS2322: Property 'n' is missing in the provided JSX attributes. \ No newline at end of file diff --git a/tests/baselines/reference/tsxElementResolution4.errors.txt b/tests/baselines/reference/tsxElementResolution4.errors.txt index 48074b87a6b03..3617582614b41 100644 --- a/tests/baselines/reference/tsxElementResolution4.errors.txt +++ b/tests/baselines/reference/tsxElementResolution4.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(16,2): error TS2322: Type '{ q: string; }' is not assignable to type '{ m: string; }'. - Property 'm' is missing in type '{ q: string; }'. + Property 'm' is missing in the provided JSX attributes. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -21,5 +21,5 @@ tests/cases/conformance/jsx/file.tsx(16,2): error TS2322: Type '{ q: string; }' ; ~~~~ !!! error TS2322: Type '{ q: string; }' is not assignable to type '{ m: string; }'. -!!! error TS2322: Property 'm' is missing in type '{ q: string; }'. +!!! error TS2322: Property 'm' is missing in the provided JSX attributes. \ No newline at end of file diff --git a/tests/baselines/reference/tsxIntrinsicAttributeErrors.errors.txt b/tests/baselines/reference/tsxIntrinsicAttributeErrors.errors.txt index 1fa2663e874d5..56a0b6eac7d70 100644 --- a/tests/baselines/reference/tsxIntrinsicAttributeErrors.errors.txt +++ b/tests/baselines/reference/tsxIntrinsicAttributeErrors.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/tsxIntrinsicAttributeErrors.tsx(29,2): error TS2322: Type '{ x: number; }' is not assignable to type 'IntrinsicAttributes'. - Property 'key' is missing in type '{ x: number; }'. + Property 'key' is missing in the provided JSX attributes. ==== tests/cases/conformance/jsx/tsxIntrinsicAttributeErrors.tsx (1 errors) ==== @@ -34,5 +34,5 @@ tests/cases/conformance/jsx/tsxIntrinsicAttributeErrors.tsx(29,2): error TS2322: ~ !!! error TS2322: Type '{ x: number; }' is not assignable to type 'IntrinsicAttributes'. -!!! error TS2322: Property 'key' is missing in type '{ x: number; }'. +!!! error TS2322: Property 'key' is missing in the provided JSX attributes. \ No newline at end of file diff --git a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt index 669c315b71a38..d27353c607822 100644 --- a/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt +++ b/tests/baselines/reference/tsxReactComponentWithDefaultTypeParameter3.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(13,11): error TS2322: Type '{}' is not assignable to type 'Prop'. - Property 'a' is missing in type '{}'. + Property 'a' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(19,18): error TS2326: Types of property 'a' are incompatible. Type 'string' is not assignable to type 'number'. @@ -20,7 +20,7 @@ tests/cases/conformance/jsx/file.tsx(19,18): error TS2326: Types of property 'a' let x1 = ~~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'Prop'. -!!! error TS2322: Property 'a' is missing in type '{}'. +!!! error TS2322: Property 'a' is missing in the provided JSX attributes. // OK let x = diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution16.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution16.errors.txt index accecdff013f8..9f4c7657dacf2 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution16.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution16.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(11,10): error TS2322: Type '{ property1: string; property2: number; }' is not assignable to type 'AnotherComponentProps'. - Property 'AnotherProperty1' is missing in type '{ property1: string; property2: number; }'. + Property 'AnotherProperty1' is missing in the provided JSX attributes. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -16,7 +16,7 @@ tests/cases/conformance/jsx/file.tsx(11,10): error TS2322: Type '{ property1: st ~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ property1: string; property2: number; }' is not assignable to type 'AnotherComponentProps'. -!!! error TS2322: Property 'AnotherProperty1' is missing in type '{ property1: string; property2: number; }'. +!!! error TS2322: Property 'AnotherProperty1' is missing in the provided JSX attributes. ); } diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt index d472e032a1e03..c9836c44c84f6 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution2.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/jsx/file.tsx(17,10): error TS2322: Type '{}' is not assignable to type 'PoisonedProp'. - Property 'x' is missing in type '{}'. + Property 'x' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(18,10): error TS2322: Type '{}' is not assignable to type 'PoisonedProp'. - Property 'x' is missing in type '{}'. + Property 'x' is missing in the provided JSX attributes. 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. @@ -34,11 +34,11 @@ tests/cases/conformance/jsx/file.tsx(21,11): error TS2322: Type '{ X: string; x: let p = ; ~~~~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'PoisonedProp'. -!!! error TS2322: Property 'x' is missing in type '{}'. +!!! error TS2322: Property 'x' is missing in the provided JSX attributes. let y = ; ~~~~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'PoisonedProp'. -!!! error TS2322: Property 'x' is missing in type '{}'. +!!! error TS2322: Property 'x' is missing in the provided JSX attributes. let z = ; ~ !!! error TS2326: Types of property 'x' are incompatible. diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt index 65deca2aff4d8..bbb29fa044245 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/jsx/file.tsx(13,10): error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes & { editable: false; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })'. Type '{ editable: true; }' is not assignable to type '{ editable: true; onEdit: (newText: string) => void; }'. - Property 'onEdit' is missing in type '{ editable: true; }'. + Property 'onEdit' is missing in the provided JSX attributes. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -20,7 +20,7 @@ tests/cases/conformance/jsx/file.tsx(13,10): error TS2322: Type '{ editable: tru ~~~~~~~~~~~~~ !!! error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes & { editable: false; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })'. !!! error TS2322: Type '{ editable: true; }' is not assignable to type '{ editable: true; onEdit: (newText: string) => void; }'. -!!! error TS2322: Property 'onEdit' is missing in type '{ editable: true; }'. +!!! error TS2322: Property 'onEdit' is missing in the provided JSX attributes. const textProps: TextProps = { editable: false diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt index a9019c17e0db6..e305aa2ba14e1 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/jsx/file.tsx(12,13): error TS2322: Type '{ extraProp: true; }' is not assignable to type '{ yy: number; yy1: string; }'. - Property 'yy' is missing in type '{ extraProp: true; }'. + Property 'yy' is missing in the provided JSX attributes. 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; }'. + Property 'yy1' is missing in the provided JSX attributes. 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(16,31): error TS2339: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'. @@ -9,7 +9,7 @@ tests/cases/conformance/jsx/file.tsx(17,13): error TS2322: Type '{ yy: boolean; 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; }'. + Property 'yy' is missing in the provided JSX attributes. 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. @@ -37,11 +37,11 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2326: Types of property 'y1 const c0 = ; // extra property; ~~~~~~~~ !!! error TS2322: Type '{ extraProp: true; }' is not assignable to type '{ yy: number; yy1: string; }'. -!!! error TS2322: Property 'yy' is missing in type '{ extraProp: true; }'. +!!! error TS2322: Property 'yy' is missing in the provided JSX attributes. const c1 = ; // missing property; ~~~~~~~~ !!! error TS2322: Type '{ yy: number; }' is not assignable to type '{ yy: number; yy1: string; }'. -!!! error TS2322: Property 'yy1' is missing in type '{ yy: number; }'. +!!! error TS2322: Property 'yy1' is missing in the provided JSX attributes. const c2 = ; // type incompatible; ~~~ !!! error TS2326: Types of property 'yy1' are incompatible. @@ -65,7 +65,7 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2326: Types of property 'y1 const d1 = ~~~~~~~~~~~~~~~ !!! 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; }'. +!!! error TS2322: Property 'yy' is missing in the provided JSX attributes. const d2 = ~~~~~~~~~~~~~~~~ !!! error TS2326: Types of property 'direction' are incompatible. diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt index b0b05adfa6a8f..47d3b9b3b3108 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload5.errors.txt @@ -1,13 +1,13 @@ tests/cases/conformance/jsx/file.tsx(48,13): error TS2322: Type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }' is not assignable to type 'HyphenProps'. - Property '"data-format"' is missing in type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }'. + Property '"data-format"' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(49,13): error TS2322: Type '{ children: string; to: string; onClick: (e: any) => void; }' is not assignable to type 'HyphenProps'. - Property '"data-format"' is missing in type '{ children: string; to: string; onClick: (e: any) => void; }'. + Property '"data-format"' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(50,13): error TS2322: Type '{ onClick: () => void; to: string; }' is not assignable to type 'HyphenProps'. - Property '"data-format"' is missing in type '{ onClick: () => void; to: string; }'. + Property '"data-format"' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(51,13): error TS2322: Type '{ onClick: (k: MouseEvent) => void; to: string; }' is not assignable to type 'HyphenProps'. - Property '"data-format"' is missing in type '{ onClick: (k: MouseEvent) => void; to: string; }'. + Property '"data-format"' is missing in the provided JSX attributes. 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; }'. + Property '"data-format"' is missing in the provided JSX attributes. 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. @@ -67,24 +67,24 @@ tests/cases/conformance/jsx/file.tsx(56,24): error TS2326: Types of property 'da const b0 = {}}>GO; // extra property; ~~~~~~~~~~ !!! error TS2322: Type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }' is not assignable to type 'HyphenProps'. -!!! error TS2322: Property '"data-format"' is missing in type '{ children: string; to: string; onClick: (e: MouseEvent) => void; }'. +!!! error TS2322: Property '"data-format"' is missing in the provided JSX attributes. const b1 = {}} {...obj0}>Hello world; // extra property; ~~~~~~~~~~ !!! error TS2322: Type '{ children: string; to: string; onClick: (e: any) => void; }' is not assignable to type 'HyphenProps'. -!!! error TS2322: Property '"data-format"' is missing in type '{ children: string; to: string; onClick: (e: any) => void; }'. +!!! error TS2322: Property '"data-format"' is missing in the provided JSX attributes. const b2 = ; // extra property ~~~~~~~~~~ !!! error TS2322: Type '{ onClick: () => void; to: string; }' is not assignable to type 'HyphenProps'. -!!! error TS2322: Property '"data-format"' is missing in type '{ onClick: () => void; to: string; }'. +!!! error TS2322: Property '"data-format"' is missing in the provided JSX attributes. const b3 = {}}} />; // extra property ~~~~~~~~~~ !!! error TS2322: Type '{ onClick: (k: MouseEvent) => void; to: string; }' is not assignable to type 'HyphenProps'. -!!! error TS2322: Property '"data-format"' is missing in type '{ onClick: (k: MouseEvent) => void; to: string; }'. +!!! error TS2322: Property '"data-format"' is missing in the provided JSX attributes. const b4 = ; // Should error because Incorrect type; but attributes are any so everything is allowed const b5 = ; // Spread retain method declaration (see GitHub #13365), so now there is an extra attributes ~~~~~~~~~~ !!! 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; }'. +!!! error TS2322: Property '"data-format"' is missing in the provided JSX attributes. const b6 = ; // incorrect type for optional attribute ~~~~~~~~~~~~~ !!! error TS2326: Types of property 'children' are incompatible. diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt index 2a5f87adb97e6..83226885974a8 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponents1.errors.txt @@ -1,10 +1,10 @@ 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; }'. + Property 'name' is missing in the provided JSX attributes. 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(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; }'. + Property '"prop-name"' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(37,10): error TS2559: Type '{ prop1: true; }' has no properties in common with type 'IntrinsicAttributes'. tests/cases/conformance/jsx/file.tsx(38,11): error TS2559: Type '{ ref: (x: any) => any; }' has no properties in common with type 'IntrinsicAttributes'. tests/cases/conformance/jsx/file.tsx(41,16): error TS1005: ',' expected. @@ -33,7 +33,7 @@ tests/cases/conformance/jsx/file.tsx(45,11): error TS2559: Type '{ prop1: boolea let b = ; ~~~~~ !!! error TS2322: Type '{ naaame: string; }' is not assignable to type '{ name: string; }'. -!!! error TS2322: Property 'name' is missing in type '{ naaame: string; }'. +!!! error TS2322: Property 'name' is missing in the provided JSX attributes. // OK let c = ; @@ -56,7 +56,7 @@ tests/cases/conformance/jsx/file.tsx(45,11): error TS2559: Type '{ prop1: boolea let h = ; ~~~~~~~~~~~~ !!! error TS2322: Type '{ extra-prop-name: string; }' is not assignable to type '{ "prop-name": string; }'. -!!! error TS2322: Property '"prop-name"' is missing in type '{ extra-prop-name: string; }'. +!!! error TS2322: Property '"prop-name"' is missing in the provided JSX attributes. // Error let i = diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt index 61f8084866717..5f8b4024c176c 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(9,15): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: {}; a: number; }'. - Property 'b' is missing in type '{ a: number; }'. + Property 'b' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(10,15): error TS2322: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: {}; a: {}; }'. Type 'T & { ignore-prop: true; }' is not assignable to type '{ b: {}; a: {}; }'. Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }'. @@ -17,7 +17,7 @@ tests/cases/conformance/jsx/file.tsx(10,15): error TS2322: Type 'T & { ignore-pr let a0 = ~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ a: number; }' is not assignable to type '{ b: {}; a: number; }'. -!!! error TS2322: Property 'b' is missing in type '{ a: number; }'. +!!! error TS2322: Property 'b' is missing in the provided JSX attributes. let a2 = // missing a ~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: {}; a: {}; }'. diff --git a/tests/baselines/reference/tsxUnionElementType6.errors.txt b/tests/baselines/reference/tsxUnionElementType6.errors.txt index 1dc5a05f8b529..c093a75e90977 100644 --- a/tests/baselines/reference/tsxUnionElementType6.errors.txt +++ b/tests/baselines/reference/tsxUnionElementType6.errors.txt @@ -2,9 +2,9 @@ tests/cases/conformance/jsx/file.tsx(18,10): error TS2559: Type '{ x: true; }' h 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(20,10): error TS2322: Type '{}' is not assignable to type '{ x: boolean; }'. - Property 'x' is missing in type '{}'. + Property 'x' is missing in the provided JSX attributes. tests/cases/conformance/jsx/file.tsx(21,10): error TS2322: Type '{ data-prop: true; }' is not assignable to type '{ x: boolean; }'. - Property 'x' is missing in type '{ data-prop: true; }'. + Property 'x' is missing in the provided JSX attributes. ==== tests/cases/conformance/jsx/file.tsx (4 errors) ==== @@ -35,10 +35,10 @@ tests/cases/conformance/jsx/file.tsx(21,10): error TS2322: Type '{ data-prop: tr let c = ; ~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{}' is not assignable to type '{ x: boolean; }'. -!!! error TS2322: Property 'x' is missing in type '{}'. +!!! error TS2322: Property 'x' is missing in the provided JSX attributes. let d = ; ~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ data-prop: true; }' is not assignable to type '{ x: boolean; }'. -!!! error TS2322: Property 'x' is missing in type '{ data-prop: true; }'. +!!! error TS2322: Property 'x' is missing in the provided JSX attributes. \ No newline at end of file