44 lines
2 KiB
Text
44 lines
2 KiB
Text
=== tests/cases/conformance/types/members/objectTypeWithCallSignatureAppearsToBeFunctionType.ts ===
|
|
// objects with call signatures should be permitted where function types are expected
|
|
// no errors expected below
|
|
|
|
interface I {
|
|
>I : Symbol(I, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 0, 0))
|
|
|
|
(): void;
|
|
}
|
|
|
|
var i: I;
|
|
>i : Symbol(i, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 7, 3))
|
|
>I : Symbol(I, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 0, 0))
|
|
|
|
var r2: void = i();
|
|
>r2 : Symbol(r2, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 8, 3))
|
|
>i : Symbol(i, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 7, 3))
|
|
|
|
var r2b: (x: any, y?: any) => any = i.apply;
|
|
>r2b : Symbol(r2b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 3))
|
|
>x : Symbol(x, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 10))
|
|
>y : Symbol(y, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 17))
|
|
>i.apply : Symbol(Function.apply, Decl(lib.d.ts, 228, 20))
|
|
>i : Symbol(i, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 7, 3))
|
|
>apply : Symbol(Function.apply, Decl(lib.d.ts, 228, 20))
|
|
|
|
var b: {
|
|
>b : Symbol(b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 11, 3))
|
|
|
|
(): void;
|
|
}
|
|
|
|
var r4: void = b();
|
|
>r4 : Symbol(r4, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 15, 3))
|
|
>b : Symbol(b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 11, 3))
|
|
|
|
var rb4: (x: any, y?: any) => any = b.apply;
|
|
>rb4 : Symbol(rb4, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 3))
|
|
>x : Symbol(x, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 10))
|
|
>y : Symbol(y, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 17))
|
|
>b.apply : Symbol(Function.apply, Decl(lib.d.ts, 228, 20))
|
|
>b : Symbol(b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 11, 3))
|
|
>apply : Symbol(Function.apply, Decl(lib.d.ts, 228, 20))
|
|
|