Skip to content

Commit 3f00197

Browse files
committed
Accept baselines
1 parent 765e57b commit 3f00197

19 files changed

+115
-115
lines changed
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
error TS2318: Cannot find global type 'Promise'.
2-
tests/cases/compiler/asyncFunctionNoReturnType.ts(1,1): error TS2697: An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option.
3-
tests/cases/compiler/asyncFunctionNoReturnType.ts(1,1): error TS7030: Not all code paths return a value.
1+
error TS2468: Cannot find global value 'Promise'.
2+
tests/cases/compiler/asyncFunctionNoReturnType.ts(1,1): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
43
tests/cases/compiler/asyncFunctionNoReturnType.ts(2,9): error TS2304: Cannot find name 'window'.
5-
tests/cases/compiler/asyncFunctionNoReturnType.ts(3,9): error TS7030: Not all code paths return a value.
64

75

8-
!!! error TS2318: Cannot find global type 'Promise'.
9-
==== tests/cases/compiler/asyncFunctionNoReturnType.ts (4 errors) ====
6+
!!! error TS2468: Cannot find global value 'Promise'.
7+
==== tests/cases/compiler/asyncFunctionNoReturnType.ts (2 errors) ====
108
async () => {
119
~~~~~~~~~~~~~
12-
!!! error TS2697: An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option.
13-
~~~~~~~~~~~~~
14-
!!! error TS7030: Not all code paths return a value.
10+
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
1511
if (window)
1612
~~~~~~
1713
!!! error TS2304: Cannot find name 'window'.
1814
return;
19-
~~~~~~~
20-
!!! error TS7030: Not all code paths return a value.
2115
}
2216

tests/baselines/reference/bluebirdStaticThis.errors.txt

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
tests/cases/compiler/bluebirdStaticThis.ts(5,15): error TS2420: Class 'Promise<R>' incorrectly implements interface 'Thenable<R>'.
1+
tests/cases/compiler/bluebirdStaticThis.ts(5,22): error TS2420: Class 'Promise<R>' incorrectly implements interface 'Thenable<R>'.
22
Property 'then' is missing in type 'Promise<R>'.
3-
tests/cases/compiler/bluebirdStaticThis.ts(22,51): error TS2694: Namespace 'Promise' has no exported member 'Resolver'.
4-
tests/cases/compiler/bluebirdStaticThis.ts(57,109): error TS2694: Namespace 'Promise' has no exported member 'Inspection'.
5-
tests/cases/compiler/bluebirdStaticThis.ts(58,91): error TS2694: Namespace 'Promise' has no exported member 'Inspection'.
6-
tests/cases/compiler/bluebirdStaticThis.ts(59,91): error TS2694: Namespace 'Promise' has no exported member 'Inspection'.
7-
tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace 'Promise' has no exported member 'Inspection'.
3+
tests/cases/compiler/bluebirdStaticThis.ts(22,51): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Resolver'.
4+
tests/cases/compiler/bluebirdStaticThis.ts(57,109): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
5+
tests/cases/compiler/bluebirdStaticThis.ts(58,91): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
6+
tests/cases/compiler/bluebirdStaticThis.ts(59,91): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
7+
tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
88

99

1010
==== tests/cases/compiler/bluebirdStaticThis.ts (6 errors) ====
1111
// This version is reduced from the full d.ts by removing almost all the tests
1212
// and all the comments.
1313
// Then it adds explicit `this` arguments to the static members.
1414
// Tests by: Bart van der Schoor <https://github.com/Bartvds>
15-
declare class Promise<R> implements Promise.Thenable<R> {
16-
~~~~~~~
15+
export declare class Promise<R> implements Promise.Thenable<R> {
16+
~~~~~~~
1717
!!! error TS2420: Class 'Promise<R>' incorrectly implements interface 'Thenable<R>'.
1818
!!! error TS2420: Property 'then' is missing in type 'Promise<R>'.
1919
constructor(callback: (resolve: (thenableOrResult: R | Promise.Thenable<R>) => void, reject: (error: any) => void) => void);
@@ -34,7 +34,7 @@ tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace 'Prom
3434

3535
static defer<R>(dit: typeof Promise): Promise.Resolver<R>;
3636
~~~~~~~~
37-
!!! error TS2694: Namespace 'Promise' has no exported member 'Resolver'.
37+
!!! error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Resolver'.
3838

3939
static cast<R>(dit: typeof Promise, value: Promise.Thenable<R>): Promise<R>;
4040
static cast<R>(dit: typeof Promise, value: R): Promise<R>;
@@ -71,16 +71,16 @@ tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace 'Prom
7171

7272
static settle<R>(dit: typeof Promise, values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<Promise.Inspection<R>[]>;
7373
~~~~~~~~~~
74-
!!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'.
74+
!!! error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
7575
static settle<R>(dit: typeof Promise, values: Promise.Thenable<R[]>): Promise<Promise.Inspection<R>[]>;
7676
~~~~~~~~~~
77-
!!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'.
77+
!!! error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
7878
static settle<R>(dit: typeof Promise, values: Promise.Thenable<R>[]): Promise<Promise.Inspection<R>[]>;
7979
~~~~~~~~~~
80-
!!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'.
80+
!!! error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
8181
static settle<R>(dit: typeof Promise, values: R[]): Promise<Promise.Inspection<R>[]>;
8282
~~~~~~~~~~
83-
!!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'.
83+
!!! error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
8484

8585
static any<R>(dit: typeof Promise, values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<R>;
8686
static any<R>(dit: typeof Promise, values: Promise.Thenable<R[]>): Promise<R>;
@@ -131,7 +131,7 @@ tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace 'Prom
131131
static filter<R>(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise<R[]>;
132132
}
133133

134-
declare module Promise {
134+
export declare module Promise {
135135
export interface Thenable<R> {
136136
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected: (error: any) => Thenable<U>): Thenable<U>;
137137
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected?: (error: any) => U): Thenable<U>;
@@ -141,9 +141,6 @@ tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace 'Prom
141141

142142
}
143143

144-
declare module 'bluebird' {
145-
export = Promise;
146-
}
147144
interface Foo {
148145
a: number;
149146
b: string;

tests/baselines/reference/bluebirdStaticThis.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// and all the comments.
44
// Then it adds explicit `this` arguments to the static members.
55
// Tests by: Bart van der Schoor <https://github.com/Bartvds>
6-
declare class Promise<R> implements Promise.Thenable<R> {
6+
export declare class Promise<R> implements Promise.Thenable<R> {
77
constructor(callback: (resolve: (thenableOrResult: R | Promise.Thenable<R>) => void, reject: (error: any) => void) => void);
88
static try<R>(dit: typeof Promise, fn: () => Promise.Thenable<R>, args?: any[], ctx?: any): Promise<R>;
99
static try<R>(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise<R>;
@@ -109,7 +109,7 @@ declare class Promise<R> implements Promise.Thenable<R> {
109109
static filter<R>(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise<R[]>;
110110
}
111111

112-
declare module Promise {
112+
export declare module Promise {
113113
export interface Thenable<R> {
114114
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected: (error: any) => Thenable<U>): Thenable<U>;
115115
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected?: (error: any) => U): Thenable<U>;
@@ -119,9 +119,6 @@ declare module Promise {
119119

120120
}
121121

122-
declare module 'bluebird' {
123-
export = Promise;
124-
}
125122
interface Foo {
126123
a: number;
127124
b: string;
@@ -142,6 +139,8 @@ fooProm = Promise.try(Promise, () => {
142139
}, arr, x);
143140

144141
//// [bluebirdStaticThis.js]
142+
"use strict";
143+
exports.__esModule = true;
145144
var x;
146145
var arr;
147146
var foo;

tests/baselines/reference/promiseIdentity.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//// [promiseIdentity.ts]
2-
interface IPromise<T> {
2+
export interface IPromise<T> {
33
then<U>(callback: (x: T) => IPromise<U>): IPromise<U>;
44
}
55
interface Promise<T> {
@@ -22,6 +22,8 @@ var y: IPromise2<string, number>;
2222
var y: Promise2<any, string>;
2323

2424
//// [promiseIdentity.js]
25+
"use strict";
26+
exports.__esModule = true;
2527
var x;
2628
var x;
2729
// Ok because T in this particular Promise2 is any, as are all the U and W references.

tests/baselines/reference/promiseIdentity.symbols

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
=== tests/cases/compiler/promiseIdentity.ts ===
2-
interface IPromise<T> {
2+
export interface IPromise<T> {
33
>IPromise : Symbol(IPromise, Decl(promiseIdentity.ts, 0, 0))
4-
>T : Symbol(T, Decl(promiseIdentity.ts, 0, 19))
4+
>T : Symbol(T, Decl(promiseIdentity.ts, 0, 26))
55

66
then<U>(callback: (x: T) => IPromise<U>): IPromise<U>;
7-
>then : Symbol(IPromise.then, Decl(promiseIdentity.ts, 0, 23))
7+
>then : Symbol(IPromise.then, Decl(promiseIdentity.ts, 0, 30))
88
>U : Symbol(U, Decl(promiseIdentity.ts, 1, 9))
99
>callback : Symbol(callback, Decl(promiseIdentity.ts, 1, 12))
1010
>x : Symbol(x, Decl(promiseIdentity.ts, 1, 23))
11-
>T : Symbol(T, Decl(promiseIdentity.ts, 0, 19))
11+
>T : Symbol(T, Decl(promiseIdentity.ts, 0, 26))
1212
>IPromise : Symbol(IPromise, Decl(promiseIdentity.ts, 0, 0))
1313
>U : Symbol(U, Decl(promiseIdentity.ts, 1, 9))
1414
>IPromise : Symbol(IPromise, Decl(promiseIdentity.ts, 0, 0))

tests/baselines/reference/promiseIdentity.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
=== tests/cases/compiler/promiseIdentity.ts ===
2-
interface IPromise<T> {
2+
export interface IPromise<T> {
33
>IPromise : IPromise<T>
44
>T : T
55

tests/baselines/reference/promiseIdentity2.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ tests/cases/compiler/promiseIdentity2.ts(11,5): error TS2403: Subsequent variabl
22

33

44
==== tests/cases/compiler/promiseIdentity2.ts (1 errors) ====
5-
interface IPromise<T, V> {
5+
export interface IPromise<T, V> {
66
then<U, W>(callback: (x: T) => IPromise<U, W>): IPromise<U, W>;
77
}
8-
interface Promise<T, V> {
8+
export interface Promise<T, V> {
99
then<U, W>(callback: (x: T) => Promise<T, U>): Promise<T, W>;
1010
}
1111

tests/baselines/reference/promiseIdentity2.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//// [promiseIdentity2.ts]
2-
interface IPromise<T, V> {
2+
export interface IPromise<T, V> {
33
then<U, W>(callback: (x: T) => IPromise<U, W>): IPromise<U, W>;
44
}
5-
interface Promise<T, V> {
5+
export interface Promise<T, V> {
66
then<U, W>(callback: (x: T) => Promise<T, U>): Promise<T, W>;
77
}
88

@@ -12,6 +12,8 @@ var x: IPromise<string, number>;
1212
var x: Promise<any, string>;
1313

1414
//// [promiseIdentity2.js]
15+
"use strict";
16+
exports.__esModule = true;
1517
// error because T is string in the first declaration, and T is boolean in the second
1618
// Return type and callback return type are ok because T is any in this particular Promise
1719
var x;
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//// [promiseIdentityWithAny.ts]
2-
interface IPromise<T, V> {
2+
export interface IPromise<T, V> {
33
then<U, W>(callback: (x: T) => IPromise<U, W>): IPromise<U, W>;
44
}
5-
interface Promise<T, V> {
5+
export interface Promise<T, V> {
66
then<U, W>(callback: (x: T) => Promise<any, any>): Promise<any, any>;
77
}
88

@@ -11,6 +11,8 @@ var x: IPromise<string, number>;
1111
var x: Promise<string, boolean>;
1212

1313
//// [promiseIdentityWithAny.js]
14+
"use strict";
15+
exports.__esModule = true;
1416
// Should be ok because signature type parameters get erased to any
1517
var x;
1618
var x;

tests/baselines/reference/promiseIdentityWithAny.symbols

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
=== tests/cases/compiler/promiseIdentityWithAny.ts ===
2-
interface IPromise<T, V> {
2+
export interface IPromise<T, V> {
33
>IPromise : Symbol(IPromise, Decl(promiseIdentityWithAny.ts, 0, 0))
4-
>T : Symbol(T, Decl(promiseIdentityWithAny.ts, 0, 19))
5-
>V : Symbol(V, Decl(promiseIdentityWithAny.ts, 0, 21))
4+
>T : Symbol(T, Decl(promiseIdentityWithAny.ts, 0, 26))
5+
>V : Symbol(V, Decl(promiseIdentityWithAny.ts, 0, 28))
66

77
then<U, W>(callback: (x: T) => IPromise<U, W>): IPromise<U, W>;
8-
>then : Symbol(IPromise.then, Decl(promiseIdentityWithAny.ts, 0, 26))
8+
>then : Symbol(IPromise.then, Decl(promiseIdentityWithAny.ts, 0, 33))
99
>U : Symbol(U, Decl(promiseIdentityWithAny.ts, 1, 9))
1010
>W : Symbol(W, Decl(promiseIdentityWithAny.ts, 1, 11))
1111
>callback : Symbol(callback, Decl(promiseIdentityWithAny.ts, 1, 15))
1212
>x : Symbol(x, Decl(promiseIdentityWithAny.ts, 1, 26))
13-
>T : Symbol(T, Decl(promiseIdentityWithAny.ts, 0, 19))
13+
>T : Symbol(T, Decl(promiseIdentityWithAny.ts, 0, 26))
1414
>IPromise : Symbol(IPromise, Decl(promiseIdentityWithAny.ts, 0, 0))
1515
>U : Symbol(U, Decl(promiseIdentityWithAny.ts, 1, 9))
1616
>W : Symbol(W, Decl(promiseIdentityWithAny.ts, 1, 11))
1717
>IPromise : Symbol(IPromise, Decl(promiseIdentityWithAny.ts, 0, 0))
1818
>U : Symbol(U, Decl(promiseIdentityWithAny.ts, 1, 9))
1919
>W : Symbol(W, Decl(promiseIdentityWithAny.ts, 1, 11))
2020
}
21-
interface Promise<T, V> {
21+
export interface Promise<T, V> {
2222
>Promise : Symbol(Promise, Decl(promiseIdentityWithAny.ts, 2, 1))
23-
>T : Symbol(T, Decl(promiseIdentityWithAny.ts, 3, 18))
24-
>V : Symbol(V, Decl(promiseIdentityWithAny.ts, 3, 20))
23+
>T : Symbol(T, Decl(promiseIdentityWithAny.ts, 3, 25))
24+
>V : Symbol(V, Decl(promiseIdentityWithAny.ts, 3, 27))
2525

2626
then<U, W>(callback: (x: T) => Promise<any, any>): Promise<any, any>;
27-
>then : Symbol(Promise.then, Decl(promiseIdentityWithAny.ts, 3, 25))
27+
>then : Symbol(Promise.then, Decl(promiseIdentityWithAny.ts, 3, 32))
2828
>U : Symbol(U, Decl(promiseIdentityWithAny.ts, 4, 9))
2929
>W : Symbol(W, Decl(promiseIdentityWithAny.ts, 4, 11))
3030
>callback : Symbol(callback, Decl(promiseIdentityWithAny.ts, 4, 15))
3131
>x : Symbol(x, Decl(promiseIdentityWithAny.ts, 4, 26))
32-
>T : Symbol(T, Decl(promiseIdentityWithAny.ts, 3, 18))
32+
>T : Symbol(T, Decl(promiseIdentityWithAny.ts, 3, 25))
3333
>Promise : Symbol(Promise, Decl(promiseIdentityWithAny.ts, 2, 1))
3434
>Promise : Symbol(Promise, Decl(promiseIdentityWithAny.ts, 2, 1))
3535
}

0 commit comments

Comments
 (0)