File: circularConstraintYieldsAppropriateError.types

package info (click to toggle)
node-typescript 4.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 396,552 kB
  • sloc: javascript: 1,444,377; makefile: 7; sh: 3
file content (43 lines) | stat: -rw-r--r-- 794 bytes parent folder | download | duplicates (5)
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
=== tests/cases/compiler/circularConstraintYieldsAppropriateError.ts ===
// https://github.com/Microsoft/TypeScript/issues/16861
class BaseType<T> {
>BaseType : BaseType<T>

    bar: T
>bar : T
}

class NextType<C extends { someProp: any }, T = C['someProp']> extends BaseType<T> {
>NextType : NextType<C, T>
>someProp : any
>BaseType : BaseType<T>

    baz: string;
>baz : string
}

class Foo extends NextType<Foo> {
>Foo : Foo
>NextType : NextType<Foo, { test: true; }>

    someProp: {
>someProp : { test: true; }

        test: true
>test : true
>true : true
    }
}

const foo = new Foo();
>foo : Foo
>new Foo() : Foo
>Foo : typeof Foo

foo.bar.test
>foo.bar.test : true
>foo.bar : { test: true; }
>foo : Foo
>bar : { test: true; }
>test : true