Skip to content

Commit 2913cb0

Browse files
committed
Merge branch 'master' into strictObjectLiterals
Conflicts: tests/baselines/reference/typeGuardFunction.types
2 parents 592319d + 2c5ba08 commit 2913cb0

File tree

318 files changed

+38639
-23915
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

318 files changed

+38639
-23915
lines changed

Jakefile.js

+34-13
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ var languageServiceLibrarySources = [
113113
return path.join(serverDirectory, f);
114114
}).concat(servicesSources);
115115

116-
var harnessSources = [
116+
var harnessCoreSources = [
117117
"harness.ts",
118118
"sourceMapRecorder.ts",
119119
"harnessLanguageService.ts",
@@ -129,7 +129,9 @@ var harnessSources = [
129129
"runner.ts"
130130
].map(function (f) {
131131
return path.join(harnessDirectory, f);
132-
}).concat([
132+
});
133+
134+
var harnessSources = harnessCoreSources.concat([
133135
"incrementalParser.ts",
134136
"jsDocParsing.ts",
135137
"services/colorization.ts",
@@ -361,7 +363,7 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
361363
/*keepComments*/ true,
362364
/*noResolve*/ false,
363365
/*stripInternal*/ true,
364-
/*callback*/ function () {
366+
/*callback*/ function () {
365367
jake.cpR(servicesFile, nodePackageFile, {silent: true});
366368

367369
prependFile(copyright, standaloneDefinitionsFile);
@@ -379,12 +381,12 @@ compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(se
379381

380382
var lsslFile = path.join(builtLocalDirectory, "tslssl.js");
381383
compileFile(
382-
lsslFile,
383-
languageServiceLibrarySources,
384+
lsslFile,
385+
languageServiceLibrarySources,
384386
[builtLocalDirectory, copyright].concat(languageServiceLibrarySources),
385-
/*prefixes*/ [copyright],
386-
/*useBuiltCompiler*/ true,
387-
/*noOutFile*/ false,
387+
/*prefixes*/ [copyright],
388+
/*useBuiltCompiler*/ true,
389+
/*noOutFile*/ false,
388390
/*generateDeclarations*/ true);
389391

390392
// Local target to build the language service server library
@@ -488,7 +490,7 @@ var refTest262Baseline = path.join(internalTests, "baselines/test262/reference")
488490
desc("Builds the test infrastructure using the built compiler");
489491
task("tests", ["local", run].concat(libraryTargets));
490492

491-
function exec(cmd, completeHandler) {
493+
function exec(cmd, completeHandler, errorHandler) {
492494
var ex = jake.createExec([cmd], {windowsVerbatimArguments: true});
493495
// Add listeners for output and error
494496
ex.addListener("stdout", function(output) {
@@ -504,8 +506,12 @@ function exec(cmd, completeHandler) {
504506
complete();
505507
});
506508
ex.addListener("error", function(e, status) {
507-
fail("Process exited with code " + status);
508-
})
509+
if(errorHandler) {
510+
errorHandler(e, status);
511+
} else {
512+
fail("Process exited with code " + status);
513+
}
514+
});
509515

510516
ex.run();
511517
}
@@ -562,7 +568,7 @@ task("runtests", ["tests", builtLocalDirectory], function() {
562568
colors = process.env.colors || process.env.color
563569
colors = colors ? ' --no-colors ' : ' --colors ';
564570
tests = tests ? ' -g ' + tests : '';
565-
reporter = process.env.reporter || process.env.r || 'dot';
571+
reporter = process.env.reporter || process.env.r || 'mocha-fivemat-progress-reporter';
566572
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
567573
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
568574
var cmd = host + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
@@ -717,7 +723,22 @@ task('tsc-instrumented', [loggedIOJsPath, instrumenterJsPath, tscFile], function
717723
}, { async: true });
718724

719725
desc("Updates the sublime plugin's tsserver");
720-
task("update-sublime", [serverFile], function() {
726+
task("update-sublime", ["local", serverFile], function() {
721727
jake.cpR(serverFile, "../TypeScript-Sublime-Plugin/tsserver/");
722728
jake.cpR(serverFile + ".map", "../TypeScript-Sublime-Plugin/tsserver/");
723729
});
730+
731+
// if the codebase were free of linter errors we could make jake runtests
732+
// run this task automatically
733+
desc("Runs tslint on the compiler sources");
734+
task("lint", [], function() {
735+
function success(f) { return function() { console.log('SUCCESS: No linter errors in ' + f + '\n'); }};
736+
function failure(f) { return function() { console.log('FAILURE: Please fix linting errors in ' + f + '\n') }};
737+
738+
var lintTargets = compilerSources.concat(harnessCoreSources);
739+
for(var i in lintTargets) {
740+
var f = lintTargets[i];
741+
var cmd = 'tslint -f ' + f;
742+
exec(cmd, success(f), failure(f));
743+
}
744+
}, { async: true });

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
2-
[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/pr)](http://issuestats.com/github/microsoft/typescript)
3-
[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/issue)](http://issuestats.com/github/microsoft/typescript)
42
[![npm version](https://badge.fury.io/js/typescript.svg)](http://badge.fury.io/js/typescript)
53
[![Downloads](http://img.shields.io/npm/dm/TypeScript.svg)](https://npmjs.org/package/typescript)
64

bin/lib.core.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -1184,3 +1184,16 @@ declare type ClassDecorator = <TFunction extends Function>(target: TFunction) =>
11841184
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
11851185
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
11861186
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
1187+
1188+
declare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void) => PromiseLike<T>;
1189+
1190+
interface PromiseLike<T> {
1191+
/**
1192+
* Attaches callbacks for the resolution and/or rejection of the Promise.
1193+
* @param onfulfilled The callback to execute when the Promise is resolved.
1194+
* @param onrejected The callback to execute when the Promise is rejected.
1195+
* @returns A Promise for the completion of which ever callback is executed.
1196+
*/
1197+
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
1198+
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
1199+
}

bin/lib.core.es6.d.ts

+14-11
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,19 @@ declare type ClassDecorator = <TFunction extends Function>(target: TFunction) =>
11841184
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
11851185
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
11861186
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
1187+
1188+
declare type PromiseConstructorLike = new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void) => PromiseLike<T>;
1189+
1190+
interface PromiseLike<T> {
1191+
/**
1192+
* Attaches callbacks for the resolution and/or rejection of the Promise.
1193+
* @param onfulfilled The callback to execute when the Promise is resolved.
1194+
* @param onrejected The callback to execute when the Promise is rejected.
1195+
* @returns A Promise for the completion of which ever callback is executed.
1196+
*/
1197+
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
1198+
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
1199+
}
11871200
declare type PropertyKey = string | number | symbol;
11881201

11891202
interface Symbol {
@@ -4759,17 +4772,6 @@ declare module Reflect {
47594772
function setPrototypeOf(target: any, proto: any): boolean;
47604773
}
47614774

4762-
interface PromiseLike<T> {
4763-
/**
4764-
* Attaches callbacks for the resolution and/or rejection of the Promise.
4765-
* @param onfulfilled The callback to execute when the Promise is resolved.
4766-
* @param onrejected The callback to execute when the Promise is rejected.
4767-
* @returns A Promise for the completion of which ever callback is executed.
4768-
*/
4769-
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
4770-
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
4771-
}
4772-
47734775
/**
47744776
* Represents the completion of an asynchronous operation
47754777
*/
@@ -4789,6 +4791,7 @@ interface Promise<T> {
47894791
* @returns A Promise for the completion of the callback.
47904792
*/
47914793
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
4794+
catch(onrejected?: (reason: any) => void): Promise<T>;
47924795

47934796
[Symbol.toStringTag]: string;
47944797
}

0 commit comments

Comments
 (0)