|
| 1 | +//// [tests/cases/compiler/coAndContraVariantInferences6.ts] //// |
| 2 | + |
| 3 | +=== coAndContraVariantInferences6.ts === |
| 4 | +// https://github.com/microsoft/TypeScript/issues/57911 |
| 5 | + |
| 6 | +interface ExactProps { |
| 7 | +>ExactProps : Symbol(ExactProps, Decl(coAndContraVariantInferences6.ts, 0, 0)) |
| 8 | + |
| 9 | + value: "A" | "B"; |
| 10 | +>value : Symbol(ExactProps.value, Decl(coAndContraVariantInferences6.ts, 2, 22)) |
| 11 | +} |
| 12 | +interface FunctionComponent<P = {}> { |
| 13 | +>FunctionComponent : Symbol(FunctionComponent, Decl(coAndContraVariantInferences6.ts, 4, 1)) |
| 14 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 5, 28)) |
| 15 | + |
| 16 | + (props: P): ReactElement<any> | null; |
| 17 | +>props : Symbol(props, Decl(coAndContraVariantInferences6.ts, 6, 3)) |
| 18 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 5, 28)) |
| 19 | +>ReactElement : Symbol(ReactElement, Decl(coAndContraVariantInferences6.ts, 13, 1)) |
| 20 | +} |
| 21 | +declare class Component<P> { |
| 22 | +>Component : Symbol(Component, Decl(coAndContraVariantInferences6.ts, 7, 1)) |
| 23 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 8, 24)) |
| 24 | + |
| 25 | + constructor(props: P); |
| 26 | +>props : Symbol(props, Decl(coAndContraVariantInferences6.ts, 9, 14)) |
| 27 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 8, 24)) |
| 28 | +} |
| 29 | +interface ComponentClass<P = {}> { |
| 30 | +>ComponentClass : Symbol(ComponentClass, Decl(coAndContraVariantInferences6.ts, 10, 1)) |
| 31 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 11, 25)) |
| 32 | + |
| 33 | + new (props: P): Component<P>; |
| 34 | +>props : Symbol(props, Decl(coAndContraVariantInferences6.ts, 12, 7)) |
| 35 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 11, 25)) |
| 36 | +>Component : Symbol(Component, Decl(coAndContraVariantInferences6.ts, 7, 1)) |
| 37 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 11, 25)) |
| 38 | +} |
| 39 | + |
| 40 | +interface ReactElement< |
| 41 | +>ReactElement : Symbol(ReactElement, Decl(coAndContraVariantInferences6.ts, 13, 1)) |
| 42 | + |
| 43 | + T extends string | JSXElementConstructor<any> = |
| 44 | +>T : Symbol(T, Decl(coAndContraVariantInferences6.ts, 15, 23)) |
| 45 | +>JSXElementConstructor : Symbol(JSXElementConstructor, Decl(coAndContraVariantInferences6.ts, 21, 1)) |
| 46 | + |
| 47 | + | string |
| 48 | + | JSXElementConstructor<any>, |
| 49 | +>JSXElementConstructor : Symbol(JSXElementConstructor, Decl(coAndContraVariantInferences6.ts, 21, 1)) |
| 50 | + |
| 51 | +> { |
| 52 | + type: T; |
| 53 | +>type : Symbol(ReactElement.type, Decl(coAndContraVariantInferences6.ts, 19, 3)) |
| 54 | +>T : Symbol(T, Decl(coAndContraVariantInferences6.ts, 15, 23)) |
| 55 | +} |
| 56 | + |
| 57 | +type JSXElementConstructor<P> = |
| 58 | +>JSXElementConstructor : Symbol(JSXElementConstructor, Decl(coAndContraVariantInferences6.ts, 21, 1)) |
| 59 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 23, 27)) |
| 60 | + |
| 61 | + | ((props: P) => ReactElement<any> | null) |
| 62 | +>props : Symbol(props, Decl(coAndContraVariantInferences6.ts, 24, 6)) |
| 63 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 23, 27)) |
| 64 | +>ReactElement : Symbol(ReactElement, Decl(coAndContraVariantInferences6.ts, 13, 1)) |
| 65 | + |
| 66 | + | (new (props: P) => Component<any>); |
| 67 | +>props : Symbol(props, Decl(coAndContraVariantInferences6.ts, 25, 10)) |
| 68 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 23, 27)) |
| 69 | +>Component : Symbol(Component, Decl(coAndContraVariantInferences6.ts, 7, 1)) |
| 70 | + |
| 71 | +declare function createElementIsolated<P extends {}>( |
| 72 | +>createElementIsolated : Symbol(createElementIsolated, Decl(coAndContraVariantInferences6.ts, 25, 39)) |
| 73 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 27, 39)) |
| 74 | + |
| 75 | + type: FunctionComponent<P> | ComponentClass<P> | string, |
| 76 | +>type : Symbol(type, Decl(coAndContraVariantInferences6.ts, 27, 53)) |
| 77 | +>FunctionComponent : Symbol(FunctionComponent, Decl(coAndContraVariantInferences6.ts, 4, 1)) |
| 78 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 27, 39)) |
| 79 | +>ComponentClass : Symbol(ComponentClass, Decl(coAndContraVariantInferences6.ts, 10, 1)) |
| 80 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 27, 39)) |
| 81 | + |
| 82 | + props?: P | null, |
| 83 | +>props : Symbol(props, Decl(coAndContraVariantInferences6.ts, 28, 58)) |
| 84 | +>P : Symbol(P, Decl(coAndContraVariantInferences6.ts, 27, 39)) |
| 85 | + |
| 86 | +): void; |
| 87 | + |
| 88 | +declare let WrapperIsolated: JSXElementConstructor<ExactProps>; |
| 89 | +>WrapperIsolated : Symbol(WrapperIsolated, Decl(coAndContraVariantInferences6.ts, 32, 11)) |
| 90 | +>JSXElementConstructor : Symbol(JSXElementConstructor, Decl(coAndContraVariantInferences6.ts, 21, 1)) |
| 91 | +>ExactProps : Symbol(ExactProps, Decl(coAndContraVariantInferences6.ts, 0, 0)) |
| 92 | + |
| 93 | +createElementIsolated(WrapperIsolated, { value: "C" }); |
| 94 | +>createElementIsolated : Symbol(createElementIsolated, Decl(coAndContraVariantInferences6.ts, 25, 39)) |
| 95 | +>WrapperIsolated : Symbol(WrapperIsolated, Decl(coAndContraVariantInferences6.ts, 32, 11)) |
| 96 | +>value : Symbol(value, Decl(coAndContraVariantInferences6.ts, 33, 40)) |
| 97 | + |
| 98 | +declare const props: any[]; |
| 99 | +>props : Symbol(props, Decl(coAndContraVariantInferences6.ts, 35, 13)) |
| 100 | + |
| 101 | +declare const stat: any; |
| 102 | +>stat : Symbol(stat, Decl(coAndContraVariantInferences6.ts, 36, 13)) |
| 103 | + |
| 104 | +[].push.apply(props, stat.properties); |
| 105 | +>[].push.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) |
| 106 | +>[].push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) |
| 107 | +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) |
| 108 | +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) |
| 109 | +>props : Symbol(props, Decl(coAndContraVariantInferences6.ts, 35, 13)) |
| 110 | +>stat : Symbol(stat, Decl(coAndContraVariantInferences6.ts, 36, 13)) |
| 111 | + |
0 commit comments