Skip to content

Commit 1e849f8

Browse files
Accepted baselines.
1 parent 1e27606 commit 1e849f8

30 files changed

+469
-570
lines changed

tests/baselines/reference/arrayBufferIsViewNarrowsType.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var obj: Object;
44
>Object : Object
55

66
if (ArrayBuffer.isView(obj)) {
7-
>ArrayBuffer.isView(obj) : arg is ArrayBufferView
7+
>ArrayBuffer.isView(obj) : boolean
88
>ArrayBuffer.isView : (arg: any) => arg is ArrayBufferView
99
>ArrayBuffer : ArrayBufferConstructor
1010
>isView : (arg: any) => arg is ArrayBufferView
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicates01.ts ===
2+
3+
export function f(x: any): x is number {
4+
>f : Symbol(f, Decl(declarationEmitIdentifierPredicates01.ts, 0, 0))
5+
>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18))
6+
>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18))
7+
8+
return typeof x === "number";
9+
>x : Symbol(x, Decl(declarationEmitIdentifierPredicates01.ts, 1, 18))
10+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicates01.ts ===
2+
3+
export function f(x: any): x is number {
4+
>f : (x: any) => x is number
5+
>x : any
6+
>x : any
7+
8+
return typeof x === "number";
9+
>typeof x === "number" : boolean
10+
>typeof x : string
11+
>x : any
12+
>"number" : string
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts(6,33): error TS4060: Return type of exported function has or is using private name 'I'.
2+
3+
4+
==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts (1 errors) ====
5+
6+
interface I {
7+
a: number;
8+
}
9+
10+
export function f(x: any): x is I {
11+
~
12+
!!! error TS4060: Return type of exported function has or is using private name 'I'.
13+
return typeof x.a === "number";
14+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts ===
2+
3+
export class C {
4+
>C : Symbol(C, Decl(declarationEmitThisPredicates01.ts, 0, 0))
5+
6+
m(): this is D {
7+
>m : Symbol(m, Decl(declarationEmitThisPredicates01.ts, 1, 16))
8+
>D : Symbol(D, Decl(declarationEmitThisPredicates01.ts, 5, 1))
9+
10+
return this instanceof D;
11+
>this : Symbol(C, Decl(declarationEmitThisPredicates01.ts, 0, 0))
12+
>D : Symbol(D, Decl(declarationEmitThisPredicates01.ts, 5, 1))
13+
}
14+
}
15+
16+
export class D extends C {
17+
>D : Symbol(D, Decl(declarationEmitThisPredicates01.ts, 5, 1))
18+
>C : Symbol(C, Decl(declarationEmitThisPredicates01.ts, 0, 0))
19+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
=== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates01.ts ===
2+
3+
export class C {
4+
>C : C
5+
6+
m(): this is D {
7+
>m : () => this is D
8+
>D : D
9+
10+
return this instanceof D;
11+
>this instanceof D : boolean
12+
>this : this
13+
>D : typeof D
14+
}
15+
}
16+
17+
export class D extends C {
18+
>D : D
19+
>C : C
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts(9,10): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
2+
3+
4+
==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts (1 errors) ====
5+
6+
export interface Foo {
7+
a: string;
8+
b: number;
9+
c: boolean;
10+
}
11+
12+
export const obj = {
13+
m(): this is Foo {
14+
~~~~
15+
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
16+
let dis = this as Foo;
17+
return dis.a != null && dis.b != null && dis.c != null;
18+
}
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts(3,18): error TS4055: Return type of public method from exported class has or is using private name 'D'.
2+
3+
4+
==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts (1 errors) ====
5+
6+
export class C {
7+
m(): this is D {
8+
~
9+
!!! error TS4055: Return type of public method from exported class has or is using private name 'D'.
10+
return this instanceof D;
11+
}
12+
}
13+
14+
class D extends C {
15+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(8,14): error TS4025: Exported variable 'obj' has or is using private name 'Foo'.
2+
tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(9,10): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
3+
4+
5+
==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts (2 errors) ====
6+
7+
interface Foo {
8+
a: string;
9+
b: number;
10+
c: boolean;
11+
}
12+
13+
export const obj = {
14+
~~~
15+
!!! error TS4025: Exported variable 'obj' has or is using private name 'Foo'.
16+
m(): this is Foo {
17+
~~~~
18+
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
19+
let dis = this as Foo;
20+
return dis.a != null && dis.b != null && dis.c != null;
21+
}
22+
}

tests/baselines/reference/isArray.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var maybeArray: number | number[];
44

55

66
if (Array.isArray(maybeArray)) {
7-
>Array.isArray(maybeArray) : arg is any[]
7+
>Array.isArray(maybeArray) : boolean
88
>Array.isArray : (arg: any) => arg is any[]
99
>Array : ArrayConstructor
1010
>isArray : (arg: any) => arg is any[]

0 commit comments

Comments
 (0)