1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
tests/cases/conformance/jsx/file.tsx(9,14): error TS2769: No overload matches this call.
Overload 1 of 3, '(): Element', gave the following error.
Type '{ a: number; }' is not assignable to type 'IntrinsicAttributes'.
Property 'a' does not exist on type 'IntrinsicAttributes'.
Overload 2 of 3, '(attr: { b: unknown; a: string; "ignore-prop": boolean; }): Element', gave the following error.
Type 'number' is not assignable to type 'string'.
Overload 3 of 3, '(attr: { b: unknown; a: number; }): Element', gave the following error.
Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'.
tests/cases/conformance/jsx/file.tsx(10,15): error TS2769: No overload matches this call.
Overload 1 of 3, '(): Element', gave the following error.
Type 'T & { "ignore-prop": true; }' has no properties in common with type 'IntrinsicAttributes'.
Overload 2 of 3, '(attr: { b: number; a: string; "ignore-prop": boolean; }): Element', gave the following error.
Type 'T & { "ignore-prop": true; }' is not assignable to type 'IntrinsicAttributes & { b: number; a: string; "ignore-prop": boolean; }'.
Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: number; a: string; "ignore-prop": boolean; }'.
Overload 3 of 3, '(attr: { b: unknown; a: unknown; }): Element', gave the following error.
Type 'T & { "ignore-prop": true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'.
Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: unknown; a: unknown; }'.
==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
import React = require('react')
declare function OverloadComponent<U>(): JSX.Element;
declare function OverloadComponent<U>(attr: {b: U, a: string, "ignore-prop": boolean}): JSX.Element;
declare function OverloadComponent<T, U>(attr: {b: U, a: T}): JSX.Element;
// Error
function Baz<T extends {b: number}, U extends {a: boolean, b:string}>(arg1: T, arg2: U) {
let a0 = <OverloadComponent a={arg1.b}/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 3, '(): Element', gave the following error.
!!! error TS2769: Type '{ a: number; }' is not assignable to type 'IntrinsicAttributes'.
!!! error TS2769: Property 'a' does not exist on type 'IntrinsicAttributes'.
!!! error TS2769: Overload 2 of 3, '(attr: { b: unknown; a: string; "ignore-prop": boolean; }): Element', gave the following error.
!!! error TS2769: Type 'number' is not assignable to type 'string'.
!!! error TS2769: Overload 3 of 3, '(attr: { b: unknown; a: number; }): Element', gave the following error.
!!! error TS2769: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'.
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:52: The expected type comes from property 'a' which is declared here on type 'IntrinsicAttributes & { b: unknown; a: string; "ignore-prop": boolean; }'
!!! related TS2728 tests/cases/conformance/jsx/file.tsx:5:49: 'b' is declared here.
let a2 = <OverloadComponent {...arg1} ignore-prop /> // missing a
~~~~~~~~~~~~~~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 3, '(): Element', gave the following error.
!!! error TS2769: Type 'T & { "ignore-prop": true; }' has no properties in common with type 'IntrinsicAttributes'.
!!! error TS2769: Overload 2 of 3, '(attr: { b: number; a: string; "ignore-prop": boolean; }): Element', gave the following error.
!!! error TS2769: Type 'T & { "ignore-prop": true; }' is not assignable to type 'IntrinsicAttributes & { b: number; a: string; "ignore-prop": boolean; }'.
!!! error TS2769: Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: number; a: string; "ignore-prop": boolean; }'.
!!! error TS2769: Overload 3 of 3, '(attr: { b: unknown; a: unknown; }): Element', gave the following error.
!!! error TS2769: Type 'T & { "ignore-prop": true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'.
!!! error TS2769: Property 'a' is missing in type '{ b: number; } & { "ignore-prop": true; }' but required in type '{ b: unknown; a: unknown; }'.
!!! related TS2728 tests/cases/conformance/jsx/file.tsx:4:52: 'a' is declared here.
!!! related TS2728 tests/cases/conformance/jsx/file.tsx:5:55: 'a' is declared here.
}
|