Skip to content

Commit 36043cd

Browse files
committed
merge with master
2 parents 544a793 + 97e7b07 commit 36043cd

720 files changed

Lines changed: 47192 additions & 31298 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tests/baselines/reference/projectOutput/*
2525
tests/baselines/local/projectOutput/*
2626
tests/services/baselines/prototyping/local/*
2727
tests/services/browser/typescriptServices.js
28+
scripts/configureNightly.js
2829
scripts/processDiagnosticMessages.d.ts
2930
scripts/processDiagnosticMessages.js
3031
scripts/importDefinitelyTypedTests.js

AUTHORS.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
TypeScript is authored by:
2+
3+
* Adam Freidin
4+
* Ahmad Farid
5+
* Anders Hejlsberg
6+
* Arnav Singh
7+
* Arthur Ozga
8+
* Basarat Ali Syed
9+
* Ben Duffield
10+
* Bill Ticehurst
11+
* Bryan Forbes
12+
* Caitlin Potter
13+
* Chris Bubernak
14+
* Colby Russell
15+
* Colin Snover
16+
* Cyrus Najmabadi
17+
* Dan Quirk
18+
* Daniel Rosenwasser
19+
* David Li
20+
* Dick van den Brink
21+
* Dirk Bäumer
22+
* Frank Wallis
23+
* Gabriel Isenberg
24+
* Gilad Peleg
25+
* Guillaume Salles
26+
* Harald Niesche
27+
* Ingvar Stepanyan
28+
* Ivo Gabe de Wolff
29+
* James Whitney
30+
* Jason Freeman
31+
* Jason Ramsay
32+
* Jed Mao
33+
* Johannes Rieken
34+
* Jonathan Bond-Caron
35+
* Jonathan Park
36+
* Jonathan Turner
37+
* Josh Kalderimis
38+
* Kagami Sascha Rosylight
39+
* Keith Mashinter
40+
* Kenji Imamula
41+
* Lorant Pinter
42+
* Masahiro Wakame
43+
* Max Deepfield
44+
* Micah Zoltu
45+
* Mohamed Hegazy
46+
* Oleg Mihailik
47+
* Oleksandr Chekhovskyi
48+
* Paul van Brenk
49+
* Pedro Maltez
50+
* Philip Bulley
51+
* piloopin
52+
* Ron Buckton
53+
* Ryan Cavanaugh
54+
* Sheetal Nandi
55+
* Shengping Zhong
56+
* Shyyko Serhiy
57+
* Simon Hürlimann
58+
* Solal Pirelli
59+
* Stan Thomas
60+
* Steve Lucco
61+
* Tien Hoanhtien
62+
* Tingan Ho
63+
* togru
64+
* Tomas Grubliauskas
65+
* TruongSinh Tran-Nguyen
66+
* Vladimir Matveev
67+
* Wesley Wigham
68+
* Yui Tanglertsampan
69+
* Zev Spitz
70+
* Zhengbo Li

Jakefile.js

Lines changed: 82 additions & 22 deletions
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,13 +129,16 @@ 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",
136138
"services/documentRegistry.ts",
137139
"services/preProcessFile.ts",
138140
"services/patternMatcher.ts",
141+
"session.ts",
139142
"versionCache.ts",
140143
"convertToBase64.ts",
141144
"transpile.ts",
@@ -312,7 +315,7 @@ var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnostic
312315
var diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json");
313316
var diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts");
314317

315-
file(processDiagnosticMessagesTs)
318+
file(processDiagnosticMessagesTs);
316319

317320
// processDiagnosticMessages script
318321
compileFile(processDiagnosticMessagesJs,
@@ -337,12 +340,50 @@ file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson],
337340
complete();
338341
});
339342
ex.run();
340-
}, {async: true})
343+
}, {async: true});
341344

342345
desc("Generates a diagnostic file in TypeScript based on an input JSON file");
343-
task("generate-diagnostics", [diagnosticInfoMapTs])
346+
task("generate-diagnostics", [diagnosticInfoMapTs]);
344347

345348

349+
// Publish nightly
350+
var configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
351+
var configureNightlyTs = path.join(scriptsDirectory, "configureNightly.ts");
352+
var packageJson = "package.json";
353+
var programTs = path.join(compilerDirectory, "program.ts");
354+
355+
file(configureNightlyTs);
356+
357+
compileFile(/*outfile*/configureNightlyJs,
358+
/*sources*/ [configureNightlyTs],
359+
/*prereqs*/ [configureNightlyTs],
360+
/*prefixes*/ [],
361+
/*useBuiltCompiler*/ false,
362+
/*noOutFile*/ false,
363+
/*generateDeclarations*/ false,
364+
/*outDir*/ undefined,
365+
/*preserveConstEnums*/ undefined,
366+
/*keepComments*/ false,
367+
/*noResolve*/ false,
368+
/*stripInternal*/ false);
369+
370+
task("setDebugMode", function() {
371+
useDebugMode = true;
372+
});
373+
374+
task("configure-nightly", [configureNightlyJs], function() {
375+
var cmd = "node " + configureNightlyJs + " " + packageJson + " " + programTs;
376+
console.log(cmd);
377+
exec(cmd);
378+
}, { async: true });
379+
380+
desc("Configure, build, test, and publish the nightly release.");
381+
task("publish-nightly", ["configure-nightly", "LKG", "clean", "setDebugMode", "runtests"], function () {
382+
var cmd = "npm publish --tag next";
383+
console.log(cmd);
384+
exec(cmd);
385+
});
386+
346387
// Local target to build the compiler and services
347388
var tscFile = path.join(builtLocalDirectory, compilerFilename);
348389
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
@@ -362,7 +403,7 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
362403
/*keepComments*/ true,
363404
/*noResolve*/ false,
364405
/*stripInternal*/ true,
365-
/*callback*/ function () {
406+
/*callback*/ function () {
366407
jake.cpR(servicesFile, nodePackageFile, {silent: true});
367408

368409
prependFile(copyright, standaloneDefinitionsFile);
@@ -380,12 +421,12 @@ compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(se
380421

381422
var lsslFile = path.join(builtLocalDirectory, "tslssl.js");
382423
compileFile(
383-
lsslFile,
384-
languageServiceLibrarySources,
424+
lsslFile,
425+
languageServiceLibrarySources,
385426
[builtLocalDirectory, copyright].concat(languageServiceLibrarySources),
386-
/*prefixes*/ [copyright],
387-
/*useBuiltCompiler*/ true,
388-
/*noOutFile*/ false,
427+
/*prefixes*/ [copyright],
428+
/*useBuiltCompiler*/ true,
429+
/*noOutFile*/ false,
389430
/*generateDeclarations*/ true);
390431

391432
// Local target to build the language service server library
@@ -439,11 +480,11 @@ file(specMd, [word2mdJs, specWord], function () {
439480
child_process.exec(cmd, function () {
440481
complete();
441482
});
442-
}, {async: true})
483+
}, {async: true});
443484

444485

445486
desc("Generates a Markdown version of the Language Specification");
446-
task("generate-spec", [specMd])
487+
task("generate-spec", [specMd]);
447488

448489

449490
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
@@ -489,7 +530,7 @@ var refTest262Baseline = path.join(internalTests, "baselines/test262/reference")
489530
desc("Builds the test infrastructure using the built compiler");
490531
task("tests", ["local", run].concat(libraryTargets));
491532

492-
function exec(cmd, completeHandler) {
533+
function exec(cmd, completeHandler, errorHandler) {
493534
var ex = jake.createExec([cmd], {windowsVerbatimArguments: true});
494535
// Add listeners for output and error
495536
ex.addListener("stdout", function(output) {
@@ -505,8 +546,12 @@ function exec(cmd, completeHandler) {
505546
complete();
506547
});
507548
ex.addListener("error", function(e, status) {
508-
fail("Process exited with code " + status);
509-
})
549+
if(errorHandler) {
550+
errorHandler(e, status);
551+
} else {
552+
fail("Process exited with code " + status);
553+
}
554+
});
510555

511556
ex.run();
512557
}
@@ -563,15 +608,15 @@ task("runtests", ["tests", builtLocalDirectory], function() {
563608
colors = process.env.colors || process.env.color
564609
colors = colors ? ' --no-colors ' : ' --colors ';
565610
tests = tests ? ' -g ' + tests : '';
566-
reporter = process.env.reporter || process.env.r || 'dot';
611+
reporter = process.env.reporter || process.env.r || 'mocha-fivemat-progress-reporter';
567612
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
568613
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
569614
var cmd = host + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
570615
console.log(cmd);
571616
exec(cmd, deleteTemporaryProjectOutput);
572617
}, {async: true});
573618

574-
desc("Generates code coverage data via instanbul")
619+
desc("Generates code coverage data via instanbul");
575620
task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
576621
var cmd = 'istanbul cover node_modules/mocha/bin/_mocha -- -R min -t ' + testTimeout + ' ' + run;
577622
console.log(cmd);
@@ -614,7 +659,7 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory], function(
614659
function getDiffTool() {
615660
var program = process.env['DIFF']
616661
if (!program) {
617-
fail("Add the 'DIFF' environment variable to the path of the program you want to use.")
662+
fail("Add the 'DIFF' environment variable to the path of the program you want to use.");
618663
}
619664
return program;
620665
}
@@ -623,14 +668,14 @@ function getDiffTool() {
623668
desc("Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable");
624669
task('diff', function () {
625670
var cmd = '"' + getDiffTool() + '" ' + refBaseline + ' ' + localBaseline;
626-
console.log(cmd)
671+
console.log(cmd);
627672
exec(cmd);
628673
}, {async: true});
629674

630675
desc("Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable");
631676
task('diff-rwc', function () {
632677
var cmd = '"' + getDiffTool() + '" ' + refRwcBaseline + ' ' + localRwcBaseline;
633-
console.log(cmd)
678+
console.log(cmd);
634679
exec(cmd);
635680
}, {async: true});
636681

@@ -718,7 +763,22 @@ task('tsc-instrumented', [loggedIOJsPath, instrumenterJsPath, tscFile], function
718763
}, { async: true });
719764

720765
desc("Updates the sublime plugin's tsserver");
721-
task("update-sublime", [serverFile], function() {
766+
task("update-sublime", ["local", serverFile], function() {
722767
jake.cpR(serverFile, "../TypeScript-Sublime-Plugin/tsserver/");
723768
jake.cpR(serverFile + ".map", "../TypeScript-Sublime-Plugin/tsserver/");
724769
});
770+
771+
// if the codebase were free of linter errors we could make jake runtests
772+
// run this task automatically
773+
desc("Runs tslint on the compiler sources");
774+
task("lint", [], function() {
775+
function success(f) { return function() { console.log('SUCCESS: No linter errors in ' + f + '\n'); }};
776+
function failure(f) { return function() { console.log('FAILURE: Please fix linting errors in ' + f + '\n') }};
777+
778+
var lintTargets = compilerSources.concat(harnessCoreSources);
779+
for (var i in lintTargets) {
780+
var f = lintTargets[i];
781+
var cmd = 'tslint -c tslint.json ' + f;
782+
exec(cmd, success(f), failure(f));
783+
}
784+
}, { async: true });

README.md

Lines changed: 15 additions & 3 deletions
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

@@ -10,6 +8,19 @@
108

119
[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [twitter account](https://twitter.com/typescriptlang).
1210

11+
## Installing
12+
13+
For the latest stable version:
14+
15+
```
16+
npm install -g typescript
17+
```
18+
19+
For our nightly builds:
20+
21+
```
22+
npm install -g typescript@next
23+
```
1324

1425
## Contribute
1526

@@ -65,7 +76,8 @@ jake runtests # Run tests using the built compiler and test infrastructu
6576
# Use host=<hostName> or tests=<testPath>.
6677
jake runtests-browser # Runs the tests using the built run.js file. Syntax is jake runtests. Optional
6778
parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]'.
68-
jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests.
79+
jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests.
80+
jake lint # Runs tslint on the TypeScript source.
6981
jake -T # List the above commands.
7082
```
7183

bin/lib.core.d.ts

Lines changed: 13 additions & 0 deletions
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+
}

0 commit comments

Comments
 (0)