|
| 1 | +=== tests/cases/compiler/contextuallyTypedJsxChildren.tsx === |
| 2 | +/// <reference path="react16.d.ts" /> |
| 3 | + |
| 4 | +import React from 'react'; |
| 5 | +>React : Symbol(React, Decl(contextuallyTypedJsxChildren.tsx, 2, 6)) |
| 6 | + |
| 7 | +// repro from https://github.com/microsoft/TypeScript/issues/53941 |
| 8 | +declare namespace DropdownMenu { |
| 9 | +>DropdownMenu : Symbol(DropdownMenu, Decl(contextuallyTypedJsxChildren.tsx, 2, 26), Decl(contextuallyTypedJsxChildren.tsx, 23, 13)) |
| 10 | + |
| 11 | + interface BaseProps { |
| 12 | +>BaseProps : Symbol(BaseProps, Decl(contextuallyTypedJsxChildren.tsx, 5, 32)) |
| 13 | + |
| 14 | + icon: string; |
| 15 | +>icon : Symbol(BaseProps.icon, Decl(contextuallyTypedJsxChildren.tsx, 6, 23)) |
| 16 | + |
| 17 | + label: string; |
| 18 | +>label : Symbol(BaseProps.label, Decl(contextuallyTypedJsxChildren.tsx, 7, 17)) |
| 19 | + } |
| 20 | + interface PropsWithChildren extends BaseProps { |
| 21 | +>PropsWithChildren : Symbol(PropsWithChildren, Decl(contextuallyTypedJsxChildren.tsx, 9, 3)) |
| 22 | +>BaseProps : Symbol(BaseProps, Decl(contextuallyTypedJsxChildren.tsx, 5, 32)) |
| 23 | + |
| 24 | + children(props: { onClose: () => void }): JSX.Element; |
| 25 | +>children : Symbol(PropsWithChildren.children, Decl(contextuallyTypedJsxChildren.tsx, 10, 49)) |
| 26 | +>props : Symbol(props, Decl(contextuallyTypedJsxChildren.tsx, 11, 13)) |
| 27 | +>onClose : Symbol(onClose, Decl(contextuallyTypedJsxChildren.tsx, 11, 21)) |
| 28 | +>JSX : Symbol(JSX, Decl(react16.d.ts, 2493, 12)) |
| 29 | +>Element : Symbol(JSX.Element, Decl(react16.d.ts, 2494, 23)) |
| 30 | + |
| 31 | + controls?: never | undefined; |
| 32 | +>controls : Symbol(PropsWithChildren.controls, Decl(contextuallyTypedJsxChildren.tsx, 11, 58)) |
| 33 | + } |
| 34 | + interface PropsWithControls extends BaseProps { |
| 35 | +>PropsWithControls : Symbol(PropsWithControls, Decl(contextuallyTypedJsxChildren.tsx, 13, 3)) |
| 36 | +>BaseProps : Symbol(BaseProps, Decl(contextuallyTypedJsxChildren.tsx, 5, 32)) |
| 37 | + |
| 38 | + controls: Control[]; |
| 39 | +>controls : Symbol(PropsWithControls.controls, Decl(contextuallyTypedJsxChildren.tsx, 14, 49)) |
| 40 | +>Control : Symbol(Control, Decl(contextuallyTypedJsxChildren.tsx, 17, 3)) |
| 41 | + |
| 42 | + children?: never | undefined; |
| 43 | +>children : Symbol(PropsWithControls.children, Decl(contextuallyTypedJsxChildren.tsx, 15, 24)) |
| 44 | + } |
| 45 | + interface Control { |
| 46 | +>Control : Symbol(Control, Decl(contextuallyTypedJsxChildren.tsx, 17, 3)) |
| 47 | + |
| 48 | + title: string; |
| 49 | +>title : Symbol(Control.title, Decl(contextuallyTypedJsxChildren.tsx, 18, 21)) |
| 50 | + } |
| 51 | + type Props = PropsWithChildren | PropsWithControls; |
| 52 | +>Props : Symbol(Props, Decl(contextuallyTypedJsxChildren.tsx, 20, 3)) |
| 53 | +>PropsWithChildren : Symbol(PropsWithChildren, Decl(contextuallyTypedJsxChildren.tsx, 9, 3)) |
| 54 | +>PropsWithControls : Symbol(PropsWithControls, Decl(contextuallyTypedJsxChildren.tsx, 13, 3)) |
| 55 | +} |
| 56 | +declare const DropdownMenu: React.ComponentType<DropdownMenu.Props>; |
| 57 | +>DropdownMenu : Symbol(DropdownMenu, Decl(contextuallyTypedJsxChildren.tsx, 2, 26), Decl(contextuallyTypedJsxChildren.tsx, 23, 13)) |
| 58 | +>React : Symbol(React, Decl(contextuallyTypedJsxChildren.tsx, 2, 6)) |
| 59 | +>ComponentType : Symbol(React.ComponentType, Decl(react16.d.ts, 117, 60)) |
| 60 | +>DropdownMenu : Symbol(DropdownMenu, Decl(contextuallyTypedJsxChildren.tsx, 2, 26), Decl(contextuallyTypedJsxChildren.tsx, 23, 13)) |
| 61 | +>Props : Symbol(DropdownMenu.Props, Decl(contextuallyTypedJsxChildren.tsx, 20, 3)) |
| 62 | + |
| 63 | +<DropdownMenu icon="move" label="Select a direction"> |
| 64 | +>DropdownMenu : Symbol(DropdownMenu, Decl(contextuallyTypedJsxChildren.tsx, 2, 26), Decl(contextuallyTypedJsxChildren.tsx, 23, 13)) |
| 65 | +>icon : Symbol(icon, Decl(contextuallyTypedJsxChildren.tsx, 25, 13)) |
| 66 | +>label : Symbol(label, Decl(contextuallyTypedJsxChildren.tsx, 25, 25)) |
| 67 | + |
| 68 | + {({ onClose }) => ( |
| 69 | +>onClose : Symbol(onClose, Decl(contextuallyTypedJsxChildren.tsx, 26, 5)) |
| 70 | + |
| 71 | + <div> |
| 72 | +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) |
| 73 | + |
| 74 | + <button onClick={onClose}>Click me</button> |
| 75 | +>button : Symbol(JSX.IntrinsicElements.button, Decl(react16.d.ts, 2532, 96)) |
| 76 | +>onClick : Symbol(onClick, Decl(contextuallyTypedJsxChildren.tsx, 28, 13)) |
| 77 | +>onClose : Symbol(onClose, Decl(contextuallyTypedJsxChildren.tsx, 26, 5)) |
| 78 | +>button : Symbol(JSX.IntrinsicElements.button, Decl(react16.d.ts, 2532, 96)) |
| 79 | + |
| 80 | + </div> |
| 81 | +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) |
| 82 | + |
| 83 | + )} |
| 84 | +</DropdownMenu>; |
| 85 | +>DropdownMenu : Symbol(DropdownMenu, Decl(contextuallyTypedJsxChildren.tsx, 2, 26), Decl(contextuallyTypedJsxChildren.tsx, 23, 13)) |
| 86 | + |
| 87 | +<DropdownMenu |
| 88 | +>DropdownMenu : Symbol(DropdownMenu, Decl(contextuallyTypedJsxChildren.tsx, 2, 26), Decl(contextuallyTypedJsxChildren.tsx, 23, 13)) |
| 89 | + |
| 90 | + icon="move" |
| 91 | +>icon : Symbol(icon, Decl(contextuallyTypedJsxChildren.tsx, 33, 13)) |
| 92 | + |
| 93 | + label="Select a direction" |
| 94 | +>label : Symbol(label, Decl(contextuallyTypedJsxChildren.tsx, 34, 13)) |
| 95 | + |
| 96 | + children={({ onClose }) => ( |
| 97 | +>children : Symbol(children, Decl(contextuallyTypedJsxChildren.tsx, 35, 28)) |
| 98 | +>onClose : Symbol(onClose, Decl(contextuallyTypedJsxChildren.tsx, 36, 14)) |
| 99 | + |
| 100 | + <div> |
| 101 | +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) |
| 102 | + |
| 103 | + <button onClick={onClose}>Click me</button> |
| 104 | +>button : Symbol(JSX.IntrinsicElements.button, Decl(react16.d.ts, 2532, 96)) |
| 105 | +>onClick : Symbol(onClick, Decl(contextuallyTypedJsxChildren.tsx, 38, 13)) |
| 106 | +>onClose : Symbol(onClose, Decl(contextuallyTypedJsxChildren.tsx, 36, 14)) |
| 107 | +>button : Symbol(JSX.IntrinsicElements.button, Decl(react16.d.ts, 2532, 96)) |
| 108 | + |
| 109 | + </div> |
| 110 | +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) |
| 111 | + |
| 112 | + )} |
| 113 | +/>; |
| 114 | + |
0 commit comments