swc/crates/swc_ecma_parser/tests/tsc/superCallParameterContextualTyping3.ts

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;
}
});
}
}