forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontextuallyTypedJsxAttribute2.types
More file actions
100 lines (85 loc) · 4.54 KB
/
contextuallyTypedJsxAttribute2.types
File metadata and controls
100 lines (85 loc) · 4.54 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//// [tests/cases/compiler/contextuallyTypedJsxAttribute2.tsx] ////
=== Performance Stats ===
Assignability cache: 5,000
Type Count: 10,000
Instantiation count: 250,000
Symbol count: 100,000
=== contextuallyTypedJsxAttribute2.tsx ===
/// <reference path="react16.d.ts" />
import React from "react";
>React : typeof React
> : ^^^^^^^^^^^^
import { ComponentPropsWithRef, ElementType } from "react";
>ComponentPropsWithRef : any
> : ^^^
>ElementType : any
> : ^^^
function UnwrappedLink<T extends ElementType = ElementType>(
>UnwrappedLink : <T extends ElementType = React.ElementType>(props: Omit<ComponentPropsWithRef<ElementType extends T ? "a" : T>, "as">) => JSX.Element
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^
props: Omit<ComponentPropsWithRef<ElementType extends T ? "a" : T>, "as">,
>props : Omit<React.ComponentPropsWithRef<React.ElementType extends T ? "a" : T>, "as">
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
) {
return <a></a>;
><a></a> : JSX.Element
> : ^^^^^^^^^^^
>a : any
> : ^^^
>a : any
> : ^^^
}
<UnwrappedLink onClick={(e) => {}} />;
><UnwrappedLink onClick={(e) => {}} /> : JSX.Element
> : ^^^^^^^^^^^
>UnwrappedLink : <T extends ElementType = React.ElementType>(props: Omit<ComponentPropsWithRef<ElementType extends T ? "a" : T>, "as">) => JSX.Element
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^
>onClick : (e: React.MouseEvent<HTMLAnchorElement>) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>(e) => {} : (e: React.MouseEvent<HTMLAnchorElement>) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>e : React.MouseEvent<HTMLAnchorElement>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
function UnwrappedLink2<T extends ElementType = ElementType>(
>UnwrappedLink2 : <T extends ElementType = React.ElementType>(props: Omit<ComponentPropsWithRef<ElementType extends T ? "a" : T>, "as"> & { as?: T; }) => JSX.Element
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^
props: Omit<ComponentPropsWithRef<ElementType extends T ? "a" : T>, "as"> & {
>props : Omit<React.ComponentPropsWithRef<React.ElementType extends T ? "a" : T>, "as"> & { as?: T | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
as?: T;
>as : T | undefined
> : ^^^^^^^^^^^^^
},
) {
return <a></a>;
><a></a> : JSX.Element
> : ^^^^^^^^^^^
>a : any
> : ^^^
>a : any
> : ^^^
}
<UnwrappedLink2 onClick={(e) => {}} />;
><UnwrappedLink2 onClick={(e) => {}} /> : JSX.Element
> : ^^^^^^^^^^^
>UnwrappedLink2 : <T extends ElementType = React.ElementType>(props: Omit<ComponentPropsWithRef<ElementType extends T ? "a" : T>, "as"> & { as?: T; }) => JSX.Element
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^
>onClick : (e: React.MouseEvent<HTMLAnchorElement>) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>(e) => {} : (e: React.MouseEvent<HTMLAnchorElement>) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>e : React.MouseEvent<HTMLAnchorElement>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<UnwrappedLink2 as="button" onClick={(e) => {}} />;
><UnwrappedLink2 as="button" onClick={(e) => {}} /> : JSX.Element
> : ^^^^^^^^^^^
>UnwrappedLink2 : <T extends ElementType = React.ElementType>(props: Omit<ComponentPropsWithRef<ElementType extends T ? "a" : T>, "as"> & { as?: T; }) => JSX.Element
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^
>as : "button"
> : ^^^^^^^^
>onClick : (e: React.MouseEvent<HTMLButtonElement>) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>(e) => {} : (e: React.MouseEvent<HTMLButtonElement>) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>e : React.MouseEvent<HTMLButtonElement>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^