Skip to content

Commit 06bbb9b

Browse files
committed
add test case
1 parent bd42209 commit 06bbb9b

4 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
inferenceFromGenericClassNoCrash1.ts(5,3): error TS2564: Property 't' has no initializer and is not definitely assigned in the constructor.
2+
3+
4+
==== inferenceFromGenericClassNoCrash1.ts (1 errors) ====
5+
// https://github.com/microsoft/TypeScript/issues/61633#issuecomment-2841778576
6+
7+
function RenderFlagsMixin<T extends new (...args: any[]) => object>(Base?: T) {}
8+
class Container<T> {
9+
t: T;
10+
~
11+
!!! error TS2564: Property 't' has no initializer and is not definitely assigned in the constructor.
12+
}
13+
RenderFlagsMixin(Container);
14+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//// [tests/cases/compiler/inferenceFromGenericClassNoCrash1.ts] ////
2+
3+
=== inferenceFromGenericClassNoCrash1.ts ===
4+
// https://github.com/microsoft/TypeScript/issues/61633#issuecomment-2841778576
5+
6+
function RenderFlagsMixin<T extends new (...args: any[]) => object>(Base?: T) {}
7+
>RenderFlagsMixin : Symbol(RenderFlagsMixin, Decl(inferenceFromGenericClassNoCrash1.ts, 0, 0))
8+
>T : Symbol(T, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 26))
9+
>args : Symbol(args, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 41))
10+
>Base : Symbol(Base, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 68))
11+
>T : Symbol(T, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 26))
12+
13+
class Container<T> {
14+
>Container : Symbol(Container, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 80))
15+
>T : Symbol(T, Decl(inferenceFromGenericClassNoCrash1.ts, 3, 16))
16+
17+
t: T;
18+
>t : Symbol(Container.t, Decl(inferenceFromGenericClassNoCrash1.ts, 3, 20))
19+
>T : Symbol(T, Decl(inferenceFromGenericClassNoCrash1.ts, 3, 16))
20+
}
21+
RenderFlagsMixin(Container);
22+
>RenderFlagsMixin : Symbol(RenderFlagsMixin, Decl(inferenceFromGenericClassNoCrash1.ts, 0, 0))
23+
>Container : Symbol(Container, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 80))
24+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//// [tests/cases/compiler/inferenceFromGenericClassNoCrash1.ts] ////
2+
3+
=== inferenceFromGenericClassNoCrash1.ts ===
4+
// https://github.com/microsoft/TypeScript/issues/61633#issuecomment-2841778576
5+
6+
function RenderFlagsMixin<T extends new (...args: any[]) => object>(Base?: T) {}
7+
>RenderFlagsMixin : <T extends new (...args: any[]) => object>(Base?: T) => void
8+
> : ^ ^^^^^^^^^ ^^ ^^^ ^^^^^^^^^
9+
>args : any[]
10+
> : ^^^^^
11+
>Base : T | undefined
12+
> : ^^^^^^^^^^^^^
13+
14+
class Container<T> {
15+
>Container : Container<T>
16+
> : ^^^^^^^^^^^^
17+
18+
t: T;
19+
>t : T
20+
> : ^
21+
}
22+
RenderFlagsMixin(Container);
23+
>RenderFlagsMixin(Container) : void
24+
> : ^^^^
25+
>RenderFlagsMixin : <T extends new (...args: any[]) => object>(Base?: T) => void
26+
> : ^ ^^^^^^^^^ ^^ ^^^ ^^^^^^^^^
27+
>Container : typeof Container
28+
> : ^^^^^^^^^^^^^^^^
29+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @strict: true
2+
// @noEmit: true
3+
4+
// https://github.com/microsoft/TypeScript/issues/61633#issuecomment-2841778576
5+
6+
function RenderFlagsMixin<T extends new (...args: any[]) => object>(Base?: T) {}
7+
class Container<T> {
8+
t: T;
9+
}
10+
RenderFlagsMixin(Container);

0 commit comments

Comments
 (0)