1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
=== tests/cases/conformance/expressions/contextualTyping/superCallParameterContextualTyping3.ts ===
interface ContextualType<T> {
>ContextualType : Symbol(ContextualType, Decl(superCallParameterContextualTyping3.ts, 0, 0))
>T : Symbol(T, Decl(superCallParameterContextualTyping3.ts, 0, 25))
method(parameter: T): void;
>method : Symbol(ContextualType.method, Decl(superCallParameterContextualTyping3.ts, 0, 29))
>parameter : Symbol(parameter, Decl(superCallParameterContextualTyping3.ts, 1, 11))
>T : Symbol(T, Decl(superCallParameterContextualTyping3.ts, 0, 25))
}
class CBase<T> {
>CBase : Symbol(CBase, Decl(superCallParameterContextualTyping3.ts, 2, 1))
>T : Symbol(T, Decl(superCallParameterContextualTyping3.ts, 4, 12))
constructor(param: ContextualType<T>) {
>param : Symbol(param, Decl(superCallParameterContextualTyping3.ts, 5, 16))
>ContextualType : Symbol(ContextualType, Decl(superCallParameterContextualTyping3.ts, 0, 0))
>T : Symbol(T, Decl(superCallParameterContextualTyping3.ts, 4, 12))
}
foo(param: ContextualType<T>) {
>foo : Symbol(CBase.foo, Decl(superCallParameterContextualTyping3.ts, 6, 5))
>param : Symbol(param, Decl(superCallParameterContextualTyping3.ts, 8, 8))
>ContextualType : Symbol(ContextualType, Decl(superCallParameterContextualTyping3.ts, 0, 0))
>T : Symbol(T, Decl(superCallParameterContextualTyping3.ts, 4, 12))
}
}
class C extends CBase<string> {
>C : Symbol(C, Decl(superCallParameterContextualTyping3.ts, 10, 1))
>CBase : Symbol(CBase, Decl(superCallParameterContextualTyping3.ts, 2, 1))
constructor() {
// Should be okay.
// 'p' should have type 'string'.
super({
>super : Symbol(CBase, Decl(superCallParameterContextualTyping3.ts, 2, 1))
method(p) {
>method : Symbol(method, Decl(superCallParameterContextualTyping3.ts, 16, 15))
>p : Symbol(p, Decl(superCallParameterContextualTyping3.ts, 17, 19))
p.length;
>p.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>p : Symbol(p, Decl(superCallParameterContextualTyping3.ts, 17, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
}
});
// Should be okay.
// 'p' should have type 'string'.
super.foo({
>super.foo : Symbol(CBase.foo, Decl(superCallParameterContextualTyping3.ts, 6, 5))
>super : Symbol(CBase, Decl(superCallParameterContextualTyping3.ts, 2, 1))
>foo : Symbol(CBase.foo, Decl(superCallParameterContextualTyping3.ts, 6, 5))
method(p) {
>method : Symbol(method, Decl(superCallParameterContextualTyping3.ts, 24, 19))
>p : Symbol(p, Decl(superCallParameterContextualTyping3.ts, 25, 19))
p.length;
>p.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>p : Symbol(p, Decl(superCallParameterContextualTyping3.ts, 25, 19))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
}
});
}
}
|