Don't double-check JSX calls

The JSX code path stands on its own
This commit is contained in:
Nathan Shively-Sanders 2019-06-25 13:57:30 -07:00
parent f20f700025
commit 66244f7937
4 changed files with 139 additions and 74 deletions

View File

@ -21201,13 +21201,11 @@ namespace ts {
const errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } = { errors: undefined, skipLogging: true };
if (isJsxOpeningLikeElement(node)) {
const r = checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer);
if (!r) {
if (reportErrors) {
Debug.assert(!!errorOutputContainer.errors, "has error 0");
}
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer)) {
Debug.assert(!reportErrors || !!errorOutputContainer.errors, "jsx should have errors when reporting errors");
return errorOutputContainer.errors || [];
}
return undefined;
}
const thisType = getThisTypeOfSignature(signature);
if (thisType && thisType !== voidType && node.kind !== SyntaxKind.NewExpression) {
@ -21219,7 +21217,7 @@ namespace ts {
const errorNode = reportErrors ? (thisArgumentNode || node) : undefined;
const headMessage = Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;
if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer)) {
Debug.assert(!reportErrors || !!errorOutputContainer.errors, "has error 1"); // CLEAR
Debug.assert(!reportErrors || !!errorOutputContainer.errors, "this parameter should have errors when reporting errors");
return errorOutputContainer.errors || [];
}
}
@ -21236,7 +21234,7 @@ namespace ts {
// parameter types yet and therefore excess property checks may yield false positives (see #17041).
const checkArgType = checkMode & CheckMode.SkipContextSensitive ? getRegularTypeOfObjectLiteral(argType) : argType;
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer)) {
Debug.assert(!reportErrors || !!errorOutputContainer.errors, "has error 2"); // CLEAR
Debug.assert(!reportErrors || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
return errorOutputContainer.errors || [];
}
}
@ -21245,7 +21243,7 @@ namespace ts {
const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, /*context*/ undefined);
const errorNode = reportErrors ? argCount < args.length ? args[argCount] : node : undefined;
if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, undefined, errorOutputContainer)) {
Debug.assert(!reportErrors || !!errorOutputContainer.errors, "has error 3"); // CLEAR
Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
return errorOutputContainer.errors || [];
}
}

View File

@ -1,18 +1,14 @@
tests/cases/conformance/jsx/file.tsx(12,13): error TS2322: Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
tests/cases/conformance/jsx/file.tsx(13,13): error TS2741: Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'.
tests/cases/conformance/jsx/file.tsx(14,31): error TS2322: Type 'true' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(16,13): error TS2322: Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
tests/cases/conformance/jsx/file.tsx(17,13): error TS2322: Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'.
Types of property 'yy' are incompatible.
Type 'boolean' is not assignable to type 'number'.
tests/cases/conformance/jsx/file.tsx(25,13): error TS2741: Property 'yy' is missing in type '{ extra-data: true; }' but required in type '{ yy: string; direction?: number; }'.
tests/cases/conformance/jsx/file.tsx(26,40): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsx/file.tsx(33,32): error TS2322: Type 'string' is not assignable to type 'boolean'.
tests/cases/conformance/jsx/file.tsx(34,29): error TS2322: Type 'string' is not assignable to type 'boolean'.
tests/cases/conformance/jsx/file.tsx(35,29): error TS2322: Type 'string' is not assignable to type 'boolean'.
tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type 'string' is not assignable to type 'boolean'.
tests/cases/conformance/jsx/file.tsx(12,12): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(13,12): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(14,12): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(16,12): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(17,12): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(25,12): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(26,12): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(33,12): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(34,12): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(35,12): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(36,12): error TS2755: No suitable overload for this call.
==== tests/cases/conformance/jsx/file.tsx (11 errors) ====
@ -28,27 +24,49 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type 'string' is not
// Error
const c0 = <OneThing extraProp />; // extra property;
~~~~~~~~
!!! error TS2322: Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
!!! error TS2322: Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:12:13: Overload 1 of 2, '(): Element', gave the following error.
Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes'.
Property 'extraProp' does not exist on type 'IntrinsicAttributes'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:12:13: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error.
Type '{ extraProp: true; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
Property 'extraProp' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
const c1 = <OneThing yy={10}/>; // missing property;
~~~~~~~~
!!! error TS2741: Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'.
!!! related TS2728 tests/cases/conformance/jsx/file.tsx:3:43: 'yy1' is declared here.
~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:13:13: Overload 1 of 2, '(): Element', gave the following error.
Type '{ yy: number; }' is not assignable to type 'IntrinsicAttributes'.
Property 'yy' does not exist on type 'IntrinsicAttributes'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:13:13: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error.
Property 'yy1' is missing in type '{ yy: number; }' but required in type '{ yy: number; yy1: string; }'.
const c2 = <OneThing {...obj} yy1 />; // type incompatible;
~~~
!!! 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; }'
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:14:13: Overload 1 of 2, '(): Element', gave the following error.
Type '{ yy1: true; yy: number; }' is not assignable to type 'IntrinsicAttributes'.
Property 'yy1' does not exist on type 'IntrinsicAttributes'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:14:31: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error.
Type 'true' is not assignable to type 'string'.
const c3 = <OneThing {...obj} {...{extra: "extra attr"}} />; // This is OK becuase all attribute are spread
const c4 = <OneThing {...obj} y1={10000} />; // extra property;
~~~~~~~~
!!! error TS2322: Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
!!! error TS2322: Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:16:13: Overload 1 of 2, '(): Element', gave the following error.
Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes'.
Property 'y1' does not exist on type 'IntrinsicAttributes'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:16:13: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error.
Type '{ y1: number; yy: number; yy1: string; }' is not assignable to type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
Property 'y1' does not exist on type 'IntrinsicAttributes & { yy: number; yy1: string; }'.
const c5 = <OneThing {...obj} {...{yy: true}} />; // type incompatible;
~~~~~~~~
!!! error TS2322: Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'.
!!! error TS2322: Types of property 'yy' are incompatible.
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:17:13: Overload 1 of 2, '(): Element', gave the following error.
Type '{ yy: boolean; yy1: string; }' has no properties in common with type 'IntrinsicAttributes'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:17:13: Overload 2 of 2, '(l: { yy: number; yy1: string; }): Element', gave the following error.
Type '{ yy: boolean; yy1: string; }' is not assignable to type '{ yy: number; yy1: string; }'.
Types of property 'yy' are incompatible.
Type 'boolean' is not assignable to type 'number'.
const c6 = <OneThing {...obj2} {...{extra: "extra attr"}} />; // Should error as there is extra attribute that doesn't match any. Current it is not
const c7 = <OneThing {...obj2} yy />; // Should error as there is extra attribute that doesn't match any. Current it is not
@ -57,13 +75,20 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type 'string' is not
// Error
const d1 = <TestingOneThing extra-data />
~~~~~~~~~~~~~~~
!!! error TS2741: Property 'yy' is missing in type '{ extra-data: true; }' but required in type '{ yy: string; direction?: number; }'.
!!! related TS2728 tests/cases/conformance/jsx/file.tsx:22:38: 'yy' is declared here.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:25:29: Overload 1 of 2, '(j: { "extra-data": string; }): Element', gave the following error.
Type 'true' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:25:13: Overload 2 of 2, '(n: { yy: string; direction?: number; }): Element', gave the following error.
Property 'yy' is missing in type '{ extra-data: true; }' but required in type '{ yy: string; direction?: number; }'.
const d2 = <TestingOneThing yy="hello" direction="left" />
~~~~~~~~~
!!! 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; }'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:26:13: Overload 1 of 2, '(j: { "extra-data": string; }): Element', gave the following error.
Type '{ yy: string; direction: string; }' is not assignable to type 'IntrinsicAttributes & { "extra-data": string; }'.
Property 'yy' does not exist on type 'IntrinsicAttributes & { "extra-data": string; }'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:26:40: Overload 2 of 2, '(n: { yy: string; direction?: number; }): Element', gave the following error.
Type 'string' is not assignable to type 'number'.
declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element;
declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element;
@ -71,19 +96,43 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type 'string' is not
// Error
const e1 = <TestingOptional y1 y3="hello"/>
~~
!!! 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; }'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:33:29: Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error.
Type 'true' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:33:29: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error.
Type 'true' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:33:32: Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error.
Type 'string' is not assignable to type 'boolean'.
const e2 = <TestingOptional y1="hello" y2={1000} y3 />
~~
!!! 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; }'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:34:13: Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error.
Type '{ y1: string; y2: number; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'.
Property 'y3' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:34:13: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error.
Type '{ y1: string; y2: number; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }'.
Property 'y3' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; children: Element; }'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:34:29: Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error.
Type 'string' is not assignable to type 'boolean'.
const e3 = <TestingOptional y1="hello" y2={1000} children="hi" />
~~
!!! 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; }'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:35:13: Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error.
Type '{ y1: string; y2: number; children: string; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'.
Property 'children' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:35:50: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error.
Type 'string' is not assignable to type 'Element'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:35:29: Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error.
Type 'string' is not assignable to type 'boolean'.
const e4 = <TestingOptional y1="hello" y2={1000}>Hi</TestingOptional>
~~
!!! 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; }'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:36:13: Overload 1 of 3, '(a: { y1?: string; y2?: number; }): Element', gave the following error.
Type '{ children: string; y1: string; y2: number; }' is not assignable to type 'IntrinsicAttributes & { y1?: string; y2?: number; }'.
Property 'children' does not exist on type 'IntrinsicAttributes & { y1?: string; y2?: number; }'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:36:50: Overload 2 of 3, '(a: { y1?: string; y2?: number; children: Element; }): Element', gave the following error.
'TestingOptional' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:36:29: Overload 3 of 3, '(a: { y1: boolean; y2?: number; y3: boolean; }): Element', gave the following error.
Type 'string' is not assignable to type 'boolean'.

View File

@ -72,15 +72,21 @@ tests/cases/conformance/jsx/file.tsx(56,12): error TS2755: No suitable overload
const b6 = <MainButton {...{ onClick(e: any){} }} children={10} />; // incorrect type for optional attribute
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2322 tests/cases/conformance/jsx/file.tsx:54:51: Type 'number' is not assignable to type 'string'.
!!! related TS2322 tests/cases/conformance/jsx/file.tsx:54:51: Type 'number' is not assignable to type 'string'.
!!! related TS2322 tests/cases/conformance/jsx/file.tsx:54:51: Type 'number' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:54:51: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error.
Type 'number' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:54:51: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error.
Type 'number' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:54:51: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error.
Type 'number' is not assignable to type 'string'.
const b7 = <MainButton {...{ onClick(e: any){} }} children="hello" className />; // incorrect type for optional attribute
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2322 tests/cases/conformance/jsx/file.tsx:55:68: Type 'true' is not assignable to type 'string'.
!!! related TS2322 tests/cases/conformance/jsx/file.tsx:55:68: Type 'true' is not assignable to type 'string'.
!!! related TS2322 tests/cases/conformance/jsx/file.tsx:55:68: Type 'true' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:55:68: Overload 1 of 3, '(buttonProps: ButtonProps): Element', gave the following error.
Type 'true' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:55:68: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error.
Type 'true' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:55:68: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error.
Type 'true' is not assignable to type 'string'.
const b8 = <MainButton data-format />; // incorrect type for specified hyphanated name
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
@ -88,4 +94,5 @@ tests/cases/conformance/jsx/file.tsx(56,12): error TS2755: No suitable overload
Property 'onClick' is missing in type '{ data-format: true; }' but required in type 'ButtonProps'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:56:13: Overload 2 of 3, '(linkProps: LinkProps): Element', gave the following error.
Property 'to' is missing in type '{ data-format: true; }' but required in type 'LinkProps'.
!!! related TS2322 tests/cases/conformance/jsx/file.tsx:56:24: Type 'true' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:56:24: Overload 3 of 3, '(hyphenProps: HyphenProps): Element', gave the following error.
Type 'true' is not assignable to type 'string'.

View File

@ -1,6 +1,5 @@
tests/cases/conformance/jsx/file.tsx(9,15): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'.
tests/cases/conformance/jsx/file.tsx(10,15): error TS2322: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'.
Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: unknown; }'.
tests/cases/conformance/jsx/file.tsx(9,14): error TS2755: No suitable overload for this call.
tests/cases/conformance/jsx/file.tsx(10,14): error TS2755: No suitable overload for this call.
==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
@ -13,12 +12,24 @@ tests/cases/conformance/jsx/file.tsx(10,15): error TS2322: Type 'T & { ignore-pr
// Error
function Baz<T extends {b: number}, U extends {a: boolean, b:string}>(arg1: T, arg2: U) {
let a0 = <OverloadComponent a={arg1.b}/>
~~~~~~~~~~~~~~~~~
!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'.
!!! related TS2728 tests/cases/conformance/jsx/file.tsx:5:49: 'b' is declared here.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:9:15: Overload 1 of 3, '(): Element', gave the following error.
Type '{ a: number; }' is not assignable to type 'IntrinsicAttributes'.
Property 'a' does not exist on type 'IntrinsicAttributes'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:9:33: Overload 2 of 3, '(attr: { b: unknown; a: string; "ignore-prop": boolean; }): Element', gave the following error.
Type 'number' is not assignable to type 'string'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:9:15: Overload 3 of 3, '(attr: { b: unknown; a: number; }): Element', gave the following error.
Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'.
let a2 = <OverloadComponent {...arg1} ignore-prop /> // missing a
~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'.
!!! error TS2322: Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: unknown; }'.
!!! related TS2728 tests/cases/conformance/jsx/file.tsx:5:55: 'a' is declared here.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2755: No suitable overload for this call.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:10:15: Overload 1 of 3, '(): Element', gave the following error.
Type 'T & { ignore-prop: true; }' has no properties in common with type 'IntrinsicAttributes'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:10:15: Overload 2 of 3, '(attr: { b: unknown; a: string; "ignore-prop": boolean; }): Element', gave the following error.
Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: string; "ignore-prop": boolean; }'.
Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: string; "ignore-prop": boolean; }'.
!!! related TS2757 tests/cases/conformance/jsx/file.tsx:10:15: Overload 3 of 3, '(attr: { b: unknown; a: unknown; }): Element', gave the following error.
Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'.
Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: unknown; }'.
}