Skip to content

Commit c4f970f

Browse files
committed
Update tsconfig to latest API
1 parent cae466f commit c4f970f

File tree

7 files changed

+84
-3
lines changed

7 files changed

+84
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"make-error": "^1.0.2",
6666
"minimist": "^1.2.0",
6767
"source-map-support": "^0.3.2",
68-
"tsconfig": "^1.0.3",
68+
"tsconfig": "^2.0.1",
6969
"xtend": "^4.0.0"
7070
}
7171
}

src/ts-node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ function readConfig (cwd: string, ts: typeof TS) {
4444
}
4545

4646
config.compilerOptions = extend({
47-
target: 'es5'
47+
target: 'es5',
48+
module: 'commonjs'
4849
}, config.compilerOptions, {
49-
module: 'commonjs',
5050
sourceMap: true,
5151
inlineSourceMap: false,
5252
inlineSources: false,

src/typings/pinkie-promise.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module "pinkie-promise" {
2+
export = Promise
3+
}

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"src/typings/arrify.d.ts",
1919
"src/typings/tsconfig.d.ts",
2020
"src/typings/make-error.d.ts",
21+
"src/typings/pinkie-promise.d.ts",
2122
"node_modules/typescript/lib/typescript.d.ts"
2223
]
2324
}

tsd.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
},
2929
"diff/diff.d.ts": {
3030
"commit": "7a3ca1f0b8a0960af9fc1838f3234cc9d6ce0645"
31+
},
32+
"es6-promise/es6-promise.d.ts": {
33+
"commit": "68548c2daab053869f323d475419c693478bbb73"
3134
}
3235
}
3336
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Type definitions for es6-promise
2+
// Project: https://github.com/jakearchibald/ES6-Promise
3+
// Definitions by: François de Campredon <https://github.com/fdecampredon/>, vvakame <https://github.com/vvakame>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
6+
interface Thenable<R> {
7+
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
8+
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
9+
}
10+
11+
declare class Promise<R> implements Thenable<R> {
12+
/**
13+
* If you call resolve in the body of the callback passed to the constructor,
14+
* your promise is fulfilled with result object passed to resolve.
15+
* If you call reject your promise is rejected with the object passed to resolve.
16+
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
17+
* Any errors thrown in the constructor callback will be implicitly passed to reject().
18+
*/
19+
constructor(callback: (resolve : (value?: R | Thenable<R>) => void, reject: (error?: any) => void) => void);
20+
21+
/**
22+
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
23+
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
24+
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
25+
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
26+
* If an error is thrown in the callback, the returned promise rejects with that error.
27+
*
28+
* @param onFulfilled called when/if "promise" resolves
29+
* @param onRejected called when/if "promise" rejects
30+
*/
31+
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
32+
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
33+
34+
/**
35+
* Sugar for promise.then(undefined, onRejected)
36+
*
37+
* @param onRejected called when/if "promise" rejects
38+
*/
39+
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
40+
}
41+
42+
declare module Promise {
43+
/**
44+
* Make a new promise from the thenable.
45+
* A thenable is promise-like in as far as it has a "then" method.
46+
*/
47+
function resolve<R>(value?: R | Thenable<R>): Promise<R>;
48+
49+
/**
50+
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
51+
*/
52+
function reject(error: any): Promise<any>;
53+
54+
/**
55+
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
56+
* the array passed to all can be a mixture of promise-like objects and other objects.
57+
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
58+
*/
59+
function all<R>(promises: (R | Thenable<R>)[]): Promise<R[]>;
60+
61+
/**
62+
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
63+
*/
64+
function race<R>(promises: (R | Thenable<R>)[]): Promise<R>;
65+
}
66+
67+
declare module 'es6-promise' {
68+
var foo: typeof Promise; // Temp variable to reference Promise in local context
69+
module rsvp {
70+
export var Promise: typeof foo;
71+
}
72+
export = rsvp;
73+
}

typings/tsd.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
/// <reference path="chalk/chalk.d.ts" />
77
/// <reference path="proxyquire/proxyquire.d.ts" />
88
/// <reference path="diff/diff.d.ts" />
9+
/// <reference path="es6-promise/es6-promise.d.ts" />

0 commit comments

Comments
 (0)