mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 11:24:49 -05:00
Treat {} in T = {} as any in JS files (#19977)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// @allowJs: true
|
||||
// @outDir: ./built
|
||||
// @filename: library.d.ts
|
||||
export class Foo<T = {}, U = {}> {
|
||||
props: T;
|
||||
state: U;
|
||||
constructor(props: T, state: U);
|
||||
}
|
||||
|
||||
// @filename: component.js
|
||||
import { Foo } from "./library";
|
||||
export class MyFoo extends Foo {
|
||||
member;
|
||||
}
|
||||
|
||||
// @filename: typed_component.ts
|
||||
import { MyFoo } from "./component";
|
||||
export class TypedFoo extends MyFoo {
|
||||
constructor() {
|
||||
super({x: "string", y: 42}, { value: undefined });
|
||||
this.props.x;
|
||||
this.props.y;
|
||||
this.state.value;
|
||||
this.member;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user