TypeScript/tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping3.ts
2015-01-27 22:39:48 -08:00

31 lines
No EOL
598 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;
}
});
}
}