|
| 1 | +=== tests/cases/compiler/conditionalTypeRelaxingConstraintAssignability.ts === |
| 2 | +export type ElChildren = |
| 3 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 4 | + |
| 5 | + | ElChildren.Void |
| 6 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 7 | +>Void : Symbol(ElChildren.Void, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 3, 29)) |
| 8 | + |
| 9 | + | ElChildren.Text; |
| 10 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 11 | +>Text : Symbol(ElChildren.Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) |
| 12 | + |
| 13 | +export namespace ElChildren { |
| 14 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 15 | + |
| 16 | + export type Void = undefined; |
| 17 | +>Void : Symbol(Void, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 3, 29)) |
| 18 | + |
| 19 | + export type Text = string; |
| 20 | +>Text : Symbol(Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) |
| 21 | +} |
| 22 | + |
| 23 | +type Relax<C extends ElChildren> = C extends ElChildren.Text ? ElChildren.Text : C; |
| 24 | +>Relax : Symbol(Relax, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 6, 1)) |
| 25 | +>C : Symbol(C, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 11)) |
| 26 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 27 | +>C : Symbol(C, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 11)) |
| 28 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 29 | +>Text : Symbol(ElChildren.Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) |
| 30 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 31 | +>Text : Symbol(ElChildren.Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) |
| 32 | +>C : Symbol(C, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 11)) |
| 33 | + |
| 34 | +export class Elem< |
| 35 | +>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83)) |
| 36 | + |
| 37 | + C extends ElChildren, |
| 38 | +>C : Symbol(C, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 10, 18)) |
| 39 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 40 | + |
| 41 | + > { |
| 42 | + constructor( |
| 43 | + private children_: Relax<C>, |
| 44 | +>children_ : Symbol(Elem.children_, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 13, 14)) |
| 45 | +>Relax : Symbol(Relax, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 6, 1)) |
| 46 | +>C : Symbol(C, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 10, 18)) |
| 47 | + |
| 48 | + ) { |
| 49 | + } |
| 50 | +} |
| 51 | + |
| 52 | +new Elem(undefined as ElChildren.Void); |
| 53 | +>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83)) |
| 54 | +>undefined : Symbol(undefined) |
| 55 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 56 | +>Void : Symbol(ElChildren.Void, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 3, 29)) |
| 57 | + |
| 58 | +new Elem('' as ElChildren.Text); |
| 59 | +>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83)) |
| 60 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 61 | +>Text : Symbol(ElChildren.Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) |
| 62 | + |
| 63 | +new Elem('' as ElChildren.Void | ElChildren.Text); // error |
| 64 | +>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83)) |
| 65 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 66 | +>Void : Symbol(ElChildren.Void, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 3, 29)) |
| 67 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 68 | +>Text : Symbol(ElChildren.Text, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 4, 31)) |
| 69 | + |
| 70 | +new Elem('' as ElChildren); // error |
| 71 | +>Elem : Symbol(Elem, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 8, 83)) |
| 72 | +>ElChildren : Symbol(ElChildren, Decl(conditionalTypeRelaxingConstraintAssignability.ts, 0, 0), Decl(conditionalTypeRelaxingConstraintAssignability.ts, 2, 20)) |
| 73 | + |
0 commit comments