File: recursiveClassBaseType.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (46 lines) | stat: -rw-r--r-- 994 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
=== tests/cases/compiler/recursiveClassBaseType.ts ===
// Repro from #44281

declare const p: <T>(fn: () => T) => T;
>p : <T>(fn: () => T) => T
>fn : () => T

declare const Base: <T>(val: T) => { new(): T };
>Base : <T>(val: T) => new () => T
>val : T

class C extends Base({ x: p<C[]>(() => []) }) { }
>C : C
>Base({ x: p<C[]>(() => []) }) : { x: C[]; }
>Base : <T>(val: T) => new () => T
>{ x: p<C[]>(() => []) } : { x: C[]; }
>x : C[]
>p<C[]>(() => []) : C[]
>p : <T>(fn: () => T) => T
>() => [] : () => never[]
>[] : never[]

// Repro from #44359

abstract class Base1 {
>Base1 : Base1

    abstract root(): Derived1;
>root : () => Derived1
}

class Derived1 extends class extends Base1 {
>Derived1 : Derived1
>class extends Base1 {    root() {        return undefined as any;    }} : (Anonymous class)
>Base1 : Base1

    root() {
>root : () => any

        return undefined as any;
>undefined as any : any
>undefined : undefined
    }
}
{ }