mirror of
https://github.com/swc-project/swc.git
synced 2024-12-26 23:27:56 +03:00
31 lines
568 B
TypeScript
31 lines
568 B
TypeScript
interface ContextualType<T> {
|
|
method(parameter: T): void;
|
|
}
|
|
|
|
class CBase<T> {
|
|
constructor(param: ContextualType<T>) {
|
|
}
|
|
|
|
foo(param: ContextualType<T>) {
|
|
}
|
|
}
|
|
|
|
class C extends CBase<string> {
|
|
constructor() {
|
|
// Should be okay.
|
|
// 'p' should have type 'string'.
|
|
super({
|
|
method(p) {
|
|
p.length;
|
|
}
|
|
});
|
|
|
|
// Should be okay.
|
|
// 'p' should have type 'string'.
|
|
super.foo({
|
|
method(p) {
|
|
p.length;
|
|
}
|
|
});
|
|
}
|
|
} |