diff --git a/tests/baselines/reference/declFileFunctions.js b/tests/baselines/reference/declFileFunctions.js index da1917163e1..d3debf4d50c 100644 --- a/tests/baselines/reference/declFileFunctions.js +++ b/tests/baselines/reference/declFileFunctions.js @@ -26,6 +26,10 @@ export function fooWithSingleOverload(a: any) { return a; } +export function fooWithTypePredicate(a: any): a is number { + return true; +} + /** This comment should appear for nonExportedFoo*/ function nonExportedFoo() { } @@ -92,6 +96,10 @@ function fooWithSingleOverload(a) { return a; } exports.fooWithSingleOverload = fooWithSingleOverload; +function fooWithTypePredicate(a) { + return true; +} +exports.fooWithTypePredicate = fooWithTypePredicate; /** This comment should appear for nonExportedFoo*/ function nonExportedFoo() { } @@ -144,6 +152,7 @@ export declare function fooWithRestParameters(a: string, ...rests: string[]): st export declare function fooWithOverloads(a: string): string; export declare function fooWithOverloads(a: number): number; export declare function fooWithSingleOverload(a: string): string; +export declare function fooWithTypePredicate(a: any): a is number; //// [declFileFunctions_1.d.ts] /** This comment should appear for foo*/ declare function globalfoo(): void; diff --git a/tests/baselines/reference/declFileFunctions.symbols b/tests/baselines/reference/declFileFunctions.symbols index ff04d211557..1d62cc29d28 100644 --- a/tests/baselines/reference/declFileFunctions.symbols +++ b/tests/baselines/reference/declFileFunctions.symbols @@ -57,49 +57,57 @@ export function fooWithSingleOverload(a: any) { >a : Symbol(a, Decl(declFileFunctions_0.ts, 21, 38)) } +export function fooWithTypePredicate(a: any): a is number { +>fooWithTypePredicate : Symbol(fooWithTypePredicate, Decl(declFileFunctions_0.ts, 23, 1)) +>a : Symbol(a, Decl(declFileFunctions_0.ts, 25, 37)) +>a : Symbol(a, Decl(declFileFunctions_0.ts, 25, 37)) + + return true; +} + /** This comment should appear for nonExportedFoo*/ function nonExportedFoo() { ->nonExportedFoo : Symbol(nonExportedFoo, Decl(declFileFunctions_0.ts, 23, 1)) +>nonExportedFoo : Symbol(nonExportedFoo, Decl(declFileFunctions_0.ts, 27, 1)) } /** This is comment for function signature*/ function nonExportedFooWithParameters(/** this is comment about a*/a: string, ->nonExportedFooWithParameters : Symbol(nonExportedFooWithParameters, Decl(declFileFunctions_0.ts, 27, 1)) ->a : Symbol(a, Decl(declFileFunctions_0.ts, 29, 38)) +>nonExportedFooWithParameters : Symbol(nonExportedFooWithParameters, Decl(declFileFunctions_0.ts, 31, 1)) +>a : Symbol(a, Decl(declFileFunctions_0.ts, 33, 38)) /** this is comment for b*/ b: number) { ->b : Symbol(b, Decl(declFileFunctions_0.ts, 29, 77)) +>b : Symbol(b, Decl(declFileFunctions_0.ts, 33, 77)) var d = a; ->d : Symbol(d, Decl(declFileFunctions_0.ts, 32, 7)) ->a : Symbol(a, Decl(declFileFunctions_0.ts, 29, 38)) +>d : Symbol(d, Decl(declFileFunctions_0.ts, 36, 7)) +>a : Symbol(a, Decl(declFileFunctions_0.ts, 33, 38)) } function nonExportedFooWithRestParameters(a: string, ...rests: string[]) { ->nonExportedFooWithRestParameters : Symbol(nonExportedFooWithRestParameters, Decl(declFileFunctions_0.ts, 33, 1)) ->a : Symbol(a, Decl(declFileFunctions_0.ts, 34, 42)) ->rests : Symbol(rests, Decl(declFileFunctions_0.ts, 34, 52)) +>nonExportedFooWithRestParameters : Symbol(nonExportedFooWithRestParameters, Decl(declFileFunctions_0.ts, 37, 1)) +>a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 42)) +>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 38, 52)) return a + rests.join(""); ->a : Symbol(a, Decl(declFileFunctions_0.ts, 34, 42)) +>a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 42)) >rests.join : Symbol(Array.join, Decl(lib.d.ts, 1035, 31)) ->rests : Symbol(rests, Decl(declFileFunctions_0.ts, 34, 52)) +>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 38, 52)) >join : Symbol(Array.join, Decl(lib.d.ts, 1035, 31)) } function nonExportedFooWithOverloads(a: string): string; ->nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 36, 1), Decl(declFileFunctions_0.ts, 38, 56), Decl(declFileFunctions_0.ts, 39, 56)) ->a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 37)) +>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56)) +>a : Symbol(a, Decl(declFileFunctions_0.ts, 42, 37)) function nonExportedFooWithOverloads(a: number): number; ->nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 36, 1), Decl(declFileFunctions_0.ts, 38, 56), Decl(declFileFunctions_0.ts, 39, 56)) ->a : Symbol(a, Decl(declFileFunctions_0.ts, 39, 37)) +>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56)) +>a : Symbol(a, Decl(declFileFunctions_0.ts, 43, 37)) function nonExportedFooWithOverloads(a: any): any { ->nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 36, 1), Decl(declFileFunctions_0.ts, 38, 56), Decl(declFileFunctions_0.ts, 39, 56)) ->a : Symbol(a, Decl(declFileFunctions_0.ts, 40, 37)) +>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56)) +>a : Symbol(a, Decl(declFileFunctions_0.ts, 44, 37)) return a; ->a : Symbol(a, Decl(declFileFunctions_0.ts, 40, 37)) +>a : Symbol(a, Decl(declFileFunctions_0.ts, 44, 37)) } === tests/cases/compiler/declFileFunctions_1.ts === diff --git a/tests/baselines/reference/declFileFunctions.types b/tests/baselines/reference/declFileFunctions.types index b9e94f7ffcd..e6ecc53b043 100644 --- a/tests/baselines/reference/declFileFunctions.types +++ b/tests/baselines/reference/declFileFunctions.types @@ -60,6 +60,15 @@ export function fooWithSingleOverload(a: any) { >a : any } +export function fooWithTypePredicate(a: any): a is number { +>fooWithTypePredicate : (a: any) => boolean +>a : any +>a : any + + return true; +>true : boolean +} + /** This comment should appear for nonExportedFoo*/ function nonExportedFoo() { >nonExportedFoo : () => void