Skip to content

Commit 08a7744

Browse files
committed
Accepts baselines
1 parent 951084f commit 08a7744

File tree

3 files changed

+44
-18
lines changed

3 files changed

+44
-18
lines changed

tests/baselines/reference/declFileFunctions.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export function fooWithSingleOverload(a: any) {
2626
return a;
2727
}
2828

29+
export function fooWithTypePredicate(a: any): a is number {
30+
return true;
31+
}
32+
2933
/** This comment should appear for nonExportedFoo*/
3034
function nonExportedFoo() {
3135
}
@@ -92,6 +96,10 @@ function fooWithSingleOverload(a) {
9296
return a;
9397
}
9498
exports.fooWithSingleOverload = fooWithSingleOverload;
99+
function fooWithTypePredicate(a) {
100+
return true;
101+
}
102+
exports.fooWithTypePredicate = fooWithTypePredicate;
95103
/** This comment should appear for nonExportedFoo*/
96104
function nonExportedFoo() {
97105
}
@@ -144,6 +152,7 @@ export declare function fooWithRestParameters(a: string, ...rests: string[]): st
144152
export declare function fooWithOverloads(a: string): string;
145153
export declare function fooWithOverloads(a: number): number;
146154
export declare function fooWithSingleOverload(a: string): string;
155+
export declare function fooWithTypePredicate(a: any): a is number;
147156
//// [declFileFunctions_1.d.ts]
148157
/** This comment should appear for foo*/
149158
declare function globalfoo(): void;

tests/baselines/reference/declFileFunctions.symbols

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,49 +57,57 @@ export function fooWithSingleOverload(a: any) {
5757
>a : Symbol(a, Decl(declFileFunctions_0.ts, 21, 38))
5858
}
5959

60+
export function fooWithTypePredicate(a: any): a is number {
61+
>fooWithTypePredicate : Symbol(fooWithTypePredicate, Decl(declFileFunctions_0.ts, 23, 1))
62+
>a : Symbol(a, Decl(declFileFunctions_0.ts, 25, 37))
63+
>a : Symbol(a, Decl(declFileFunctions_0.ts, 25, 37))
64+
65+
return true;
66+
}
67+
6068
/** This comment should appear for nonExportedFoo*/
6169
function nonExportedFoo() {
62-
>nonExportedFoo : Symbol(nonExportedFoo, Decl(declFileFunctions_0.ts, 23, 1))
70+
>nonExportedFoo : Symbol(nonExportedFoo, Decl(declFileFunctions_0.ts, 27, 1))
6371
}
6472
/** This is comment for function signature*/
6573
function nonExportedFooWithParameters(/** this is comment about a*/a: string,
66-
>nonExportedFooWithParameters : Symbol(nonExportedFooWithParameters, Decl(declFileFunctions_0.ts, 27, 1))
67-
>a : Symbol(a, Decl(declFileFunctions_0.ts, 29, 38))
74+
>nonExportedFooWithParameters : Symbol(nonExportedFooWithParameters, Decl(declFileFunctions_0.ts, 31, 1))
75+
>a : Symbol(a, Decl(declFileFunctions_0.ts, 33, 38))
6876

6977
/** this is comment for b*/
7078
b: number) {
71-
>b : Symbol(b, Decl(declFileFunctions_0.ts, 29, 77))
79+
>b : Symbol(b, Decl(declFileFunctions_0.ts, 33, 77))
7280

7381
var d = a;
74-
>d : Symbol(d, Decl(declFileFunctions_0.ts, 32, 7))
75-
>a : Symbol(a, Decl(declFileFunctions_0.ts, 29, 38))
82+
>d : Symbol(d, Decl(declFileFunctions_0.ts, 36, 7))
83+
>a : Symbol(a, Decl(declFileFunctions_0.ts, 33, 38))
7684
}
7785
function nonExportedFooWithRestParameters(a: string, ...rests: string[]) {
78-
>nonExportedFooWithRestParameters : Symbol(nonExportedFooWithRestParameters, Decl(declFileFunctions_0.ts, 33, 1))
79-
>a : Symbol(a, Decl(declFileFunctions_0.ts, 34, 42))
80-
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 34, 52))
86+
>nonExportedFooWithRestParameters : Symbol(nonExportedFooWithRestParameters, Decl(declFileFunctions_0.ts, 37, 1))
87+
>a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 42))
88+
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 38, 52))
8189

8290
return a + rests.join("");
83-
>a : Symbol(a, Decl(declFileFunctions_0.ts, 34, 42))
91+
>a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 42))
8492
>rests.join : Symbol(Array.join, Decl(lib.d.ts, 1035, 31))
85-
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 34, 52))
93+
>rests : Symbol(rests, Decl(declFileFunctions_0.ts, 38, 52))
8694
>join : Symbol(Array.join, Decl(lib.d.ts, 1035, 31))
8795
}
8896

8997
function nonExportedFooWithOverloads(a: string): string;
90-
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 36, 1), Decl(declFileFunctions_0.ts, 38, 56), Decl(declFileFunctions_0.ts, 39, 56))
91-
>a : Symbol(a, Decl(declFileFunctions_0.ts, 38, 37))
98+
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56))
99+
>a : Symbol(a, Decl(declFileFunctions_0.ts, 42, 37))
92100

93101
function nonExportedFooWithOverloads(a: number): number;
94-
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 36, 1), Decl(declFileFunctions_0.ts, 38, 56), Decl(declFileFunctions_0.ts, 39, 56))
95-
>a : Symbol(a, Decl(declFileFunctions_0.ts, 39, 37))
102+
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56))
103+
>a : Symbol(a, Decl(declFileFunctions_0.ts, 43, 37))
96104

97105
function nonExportedFooWithOverloads(a: any): any {
98-
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 36, 1), Decl(declFileFunctions_0.ts, 38, 56), Decl(declFileFunctions_0.ts, 39, 56))
99-
>a : Symbol(a, Decl(declFileFunctions_0.ts, 40, 37))
106+
>nonExportedFooWithOverloads : Symbol(nonExportedFooWithOverloads, Decl(declFileFunctions_0.ts, 40, 1), Decl(declFileFunctions_0.ts, 42, 56), Decl(declFileFunctions_0.ts, 43, 56))
107+
>a : Symbol(a, Decl(declFileFunctions_0.ts, 44, 37))
100108

101109
return a;
102-
>a : Symbol(a, Decl(declFileFunctions_0.ts, 40, 37))
110+
>a : Symbol(a, Decl(declFileFunctions_0.ts, 44, 37))
103111
}
104112

105113
=== tests/cases/compiler/declFileFunctions_1.ts ===

tests/baselines/reference/declFileFunctions.types

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ export function fooWithSingleOverload(a: any) {
6060
>a : any
6161
}
6262

63+
export function fooWithTypePredicate(a: any): a is number {
64+
>fooWithTypePredicate : (a: any) => boolean
65+
>a : any
66+
>a : any
67+
68+
return true;
69+
>true : boolean
70+
}
71+
6372
/** This comment should appear for nonExportedFoo*/
6473
function nonExportedFoo() {
6574
>nonExportedFoo : () => void

0 commit comments

Comments
 (0)