|
| 1 | +=== tests/cases/compiler/jsxLibraryManagedAttributesUnusedGeneric.tsx === |
| 2 | +// @ts-ignore |
| 3 | +import React from 'react' |
| 4 | +>React : Symbol(React, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 1, 6)) |
| 5 | + |
| 6 | +declare const jsx: typeof React.createElement |
| 7 | +>jsx : Symbol(jsx, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 3, 13), Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 3, 45)) |
| 8 | +>React : Symbol(React, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 1, 6)) |
| 9 | + |
| 10 | +namespace jsx { |
| 11 | +>jsx : Symbol(jsx, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 3, 13), Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 3, 45)) |
| 12 | + |
| 13 | + export namespace JSX { |
| 14 | +>JSX : Symbol(JSX, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 4, 15)) |
| 15 | + |
| 16 | + export interface Element {} |
| 17 | +>Element : Symbol(Element, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 5, 26)) |
| 18 | + |
| 19 | + export interface ElementClass {} |
| 20 | +>ElementClass : Symbol(ElementClass, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 6, 35)) |
| 21 | + |
| 22 | + export interface ElementAttributesProperty {} |
| 23 | +>ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 7, 40)) |
| 24 | + |
| 25 | + export interface ElementChildrenAttribute {} |
| 26 | +>ElementChildrenAttribute : Symbol(ElementChildrenAttribute, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 8, 53)) |
| 27 | + |
| 28 | + export interface IntrinsicAttributes {} |
| 29 | +>IntrinsicAttributes : Symbol(IntrinsicAttributes, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 9, 52)) |
| 30 | + |
| 31 | + export interface IntrinsicClassAttributes<T> {} |
| 32 | +>IntrinsicClassAttributes : Symbol(IntrinsicClassAttributes, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 10, 47)) |
| 33 | +>T : Symbol(T, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 11, 50)) |
| 34 | + |
| 35 | + export type IntrinsicElements = { |
| 36 | +>IntrinsicElements : Symbol(IntrinsicElements, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 11, 55)) |
| 37 | + |
| 38 | + div: { className: string } |
| 39 | +>div : Symbol(div, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 12, 41)) |
| 40 | +>className : Symbol(className, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 13, 18)) |
| 41 | + } |
| 42 | + // Works |
| 43 | + // export type LibraryManagedAttributes<C, P> = P & { css: string }; |
| 44 | + |
| 45 | + // Equivalent to above, but fails |
| 46 | + export type WithCSSProp<P> = P & { css: string } |
| 47 | +>WithCSSProp : Symbol(WithCSSProp, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 14, 9)) |
| 48 | +>P : Symbol(P, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 19, 32)) |
| 49 | +>P : Symbol(P, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 19, 32)) |
| 50 | +>css : Symbol(css, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 19, 42)) |
| 51 | + |
| 52 | + export type LibraryManagedAttributes<C, P> = WithCSSProp<P> |
| 53 | +>LibraryManagedAttributes : Symbol(LibraryManagedAttributes, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 19, 56)) |
| 54 | +>C : Symbol(C, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 20, 45)) |
| 55 | +>P : Symbol(P, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 20, 47)) |
| 56 | +>WithCSSProp : Symbol(WithCSSProp, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 14, 9)) |
| 57 | +>P : Symbol(P, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 20, 47)) |
| 58 | + |
| 59 | + } |
| 60 | +} |
| 61 | + |
| 62 | +declare const Comp: (p: { className?: string }) => null |
| 63 | +>Comp : Symbol(Comp, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 25, 13)) |
| 64 | +>p : Symbol(p, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 25, 21)) |
| 65 | +>className : Symbol(className, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 25, 25)) |
| 66 | + |
| 67 | +;<Comp css="color:hotpink;" /> |
| 68 | +>Comp : Symbol(Comp, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 25, 13)) |
| 69 | +>css : Symbol(css, Decl(jsxLibraryManagedAttributesUnusedGeneric.tsx, 27, 6)) |
| 70 | + |
0 commit comments