|
| 1 | +//// [tests/cases/compiler/contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts] //// |
| 2 | + |
| 3 | +=== contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts === |
| 4 | +type ComponentType<P> = (p: P) => any; |
| 5 | +>ComponentType : Symbol(ComponentType, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 0, 0)) |
| 6 | +>P : Symbol(P, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 0, 19)) |
| 7 | +>p : Symbol(p, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 0, 25)) |
| 8 | +>P : Symbol(P, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 0, 19)) |
| 9 | + |
| 10 | +type ComponentProps<C> = C extends ComponentType<infer P> ? P : never; |
| 11 | +>ComponentProps : Symbol(ComponentProps, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 0, 38)) |
| 12 | +>C : Symbol(C, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 1, 20)) |
| 13 | +>C : Symbol(C, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 1, 20)) |
| 14 | +>ComponentType : Symbol(ComponentType, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 0, 0)) |
| 15 | +>P : Symbol(P, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 1, 54)) |
| 16 | +>P : Symbol(P, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 1, 54)) |
| 17 | + |
| 18 | +type Attrs<P, A extends Partial<P>> = A; |
| 19 | +>Attrs : Symbol(Attrs, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 1, 70)) |
| 20 | +>P : Symbol(P, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 3, 11)) |
| 21 | +>A : Symbol(A, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 3, 13)) |
| 22 | +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) |
| 23 | +>P : Symbol(P, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 3, 11)) |
| 24 | +>A : Symbol(A, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 3, 13)) |
| 25 | + |
| 26 | +interface StyledFunction< |
| 27 | +>StyledFunction : Symbol(StyledFunction, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 3, 40)) |
| 28 | + |
| 29 | + C extends ComponentType<any>, |
| 30 | +>C : Symbol(C, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 5, 25)) |
| 31 | +>ComponentType : Symbol(ComponentType, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 0, 0)) |
| 32 | + |
| 33 | + O extends object = {}, |
| 34 | +>O : Symbol(O, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 6, 31)) |
| 35 | + |
| 36 | + A extends keyof any = never, |
| 37 | +>A : Symbol(A, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 7, 24)) |
| 38 | + |
| 39 | +> { |
| 40 | + attrs< |
| 41 | +>attrs : Symbol(StyledFunction.attrs, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 9, 3)) |
| 42 | + |
| 43 | + U, |
| 44 | +>U : Symbol(U, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 10, 8)) |
| 45 | + |
| 46 | + NewA extends Partial<ComponentProps<C> & U> & { |
| 47 | +>NewA : Symbol(NewA, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 11, 6)) |
| 48 | +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) |
| 49 | +>ComponentProps : Symbol(ComponentProps, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 0, 38)) |
| 50 | +>C : Symbol(C, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 5, 25)) |
| 51 | +>U : Symbol(U, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 10, 8)) |
| 52 | + |
| 53 | + [others: string]: any; |
| 54 | +>others : Symbol(others, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 13, 7)) |
| 55 | + |
| 56 | + } = {}, |
| 57 | + >( |
| 58 | + attrs: Attrs<ComponentProps<C> & U, NewA>, |
| 59 | +>attrs : Symbol(attrs, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 15, 4)) |
| 60 | +>Attrs : Symbol(Attrs, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 1, 70)) |
| 61 | +>ComponentProps : Symbol(ComponentProps, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 0, 38)) |
| 62 | +>C : Symbol(C, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 5, 25)) |
| 63 | +>U : Symbol(U, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 10, 8)) |
| 64 | +>NewA : Symbol(NewA, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 11, 6)) |
| 65 | + |
| 66 | + ): StyledFunction<C, O & NewA, A | keyof NewA>; |
| 67 | +>StyledFunction : Symbol(StyledFunction, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 3, 40)) |
| 68 | +>C : Symbol(C, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 5, 25)) |
| 69 | +>O : Symbol(O, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 6, 31)) |
| 70 | +>NewA : Symbol(NewA, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 11, 6)) |
| 71 | +>A : Symbol(A, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 7, 24)) |
| 72 | +>NewA : Symbol(NewA, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 11, 6)) |
| 73 | +} |
| 74 | + |
| 75 | +interface StyledInterface { |
| 76 | +>StyledInterface : Symbol(StyledInterface, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 18, 1)) |
| 77 | + |
| 78 | + <C extends ComponentType<any>>(component: C): StyledFunction<C>; |
| 79 | +>C : Symbol(C, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 21, 3)) |
| 80 | +>ComponentType : Symbol(ComponentType, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 0, 0)) |
| 81 | +>component : Symbol(component, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 21, 33)) |
| 82 | +>C : Symbol(C, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 21, 3)) |
| 83 | +>StyledFunction : Symbol(StyledFunction, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 3, 40)) |
| 84 | +>C : Symbol(C, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 21, 3)) |
| 85 | +} |
| 86 | + |
| 87 | +declare const styled: StyledInterface; |
| 88 | +>styled : Symbol(styled, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 24, 13)) |
| 89 | +>StyledInterface : Symbol(StyledInterface, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 18, 1)) |
| 90 | + |
| 91 | +interface BaseProps { |
| 92 | +>BaseProps : Symbol(BaseProps, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 24, 38)) |
| 93 | + |
| 94 | + as?: "select" | "input"; |
| 95 | +>as : Symbol(BaseProps.as, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 26, 21)) |
| 96 | +} |
| 97 | + |
| 98 | +declare const Flex: (props: BaseProps) => null; |
| 99 | +>Flex : Symbol(Flex, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 30, 13)) |
| 100 | +>props : Symbol(props, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 30, 21)) |
| 101 | +>BaseProps : Symbol(BaseProps, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 24, 38)) |
| 102 | + |
| 103 | +export const StyledSelect = styled(Flex).attrs({ |
| 104 | +>StyledSelect : Symbol(StyledSelect, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 32, 12)) |
| 105 | +>styled(Flex).attrs : Symbol(StyledFunction.attrs, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 9, 3)) |
| 106 | +>styled : Symbol(styled, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 24, 13)) |
| 107 | +>Flex : Symbol(Flex, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 30, 13)) |
| 108 | +>attrs : Symbol(StyledFunction.attrs, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 9, 3)) |
| 109 | + |
| 110 | + as: "select", |
| 111 | +>as : Symbol(as, Decl(contextualTypeBasedOnIntersectionWithAnyInTheMix1.ts, 32, 48)) |
| 112 | + |
| 113 | +}); |
| 114 | + |
0 commit comments