Skip to content

Commit 2090582

Browse files
committed
Merge branch 'master' into conditional-type-simpliciations
2 parents 432b143 + ee17915 commit 2090582

File tree

402 files changed

+13409
-4647
lines changed

Some content is hidden

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

402 files changed

+13409
-4647
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ language: node_js
33
node_js:
44
- 'node'
55
- '10'
6-
- '6'
6+
- '8'
77

88
sudo: false
99

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The TypeScript repository is relatively large. To save some time, you might want
5555

5656
### Using local builds
5757

58-
Run `gulp build` to build a version of the compiler/language service that reflects changes you've made. You can then run `node <repo-root>/built/local/tsc.js` in place of `tsc` in your project. For example, to run `tsc --watch` from within the root of the repository on a file called `test.ts`, you can run `node ./built/local/tsc.js --watch test.ts`.
58+
Run `gulp` to build a version of the compiler/language service that reflects changes you've made. You can then run `node <repo-root>/built/local/tsc.js` in place of `tsc` in your project. For example, to run `tsc --watch` from within the root of the repository on a file called `test.ts`, you can run `node ./built/local/tsc.js --watch test.ts`.
5959

6060
## Contributing bug fixes
6161

Gulpfile.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,10 @@ const configureNightly = () => exec(process.execPath, ["scripts/configurePrerele
618618
task("configure-nightly", series(buildScripts, configureNightly));
619619
task("configure-nightly").description = "Runs scripts/configurePrerelease.ts to prepare a build for nightly publishing";
620620

621+
const configureInsiders = () => exec(process.execPath, ["scripts/configurePrerelease.js", "insiders", "package.json", "src/compiler/core.ts"])
622+
task("configure-insiders", series(buildScripts, configureInsiders));
623+
task("configure-insiders").description = "Runs scripts/configurePrerelease.ts to prepare a build for insiders publishing";
624+
621625
const publishNightly = () => exec("npm", ["publish", "--tag", "next"]);
622626
task("publish-nightly", series(task("clean"), task("LKG"), task("clean"), task("runtests-parallel"), publishNightly));
623627
task("publish-nightly").description = "Runs `npm publish --tag next` to create a new nightly build on npm";

Jakefile.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ else if (process.env.PATH !== undefined) {
2323
const host = process.env.TYPESCRIPT_HOST || process.env.host || "node";
2424

2525
const defaultTestTimeout = 40000;
26+
const useBuilt =
27+
(process.env.USE_BUILT === "true" || process.env.CI === "true") ? true :
28+
process.env.LKG === "true" ? false :
29+
false;
2630

2731
let useDebugMode = true;
2832

@@ -296,7 +300,7 @@ task(TaskNames.buildFoldEnd, [], function () {
296300

297301
desc("Compiles tslint rules to js");
298302
task(TaskNames.buildRules, [], function () {
299-
tsbuild(ConfigFileFor.lint, false, () => complete());
303+
tsbuild(ConfigFileFor.lint, !useBuilt, () => complete());
300304
}, { async: true });
301305

302306
desc("Cleans the compiler output, declare files, and tests");
@@ -368,7 +372,7 @@ file(ConfigFileFor.tsserverLibrary, [], function () {
368372
// tsserverlibrary.js
369373
// tsserverlibrary.d.ts
370374
file(Paths.tsserverLibraryFile, [TaskNames.coreBuild, ConfigFileFor.tsserverLibrary], function() {
371-
tsbuild(ConfigFileFor.tsserverLibrary, false, () => {
375+
tsbuild(ConfigFileFor.tsserverLibrary, !useBuilt, () => {
372376
if (needsUpdate([Paths.tsserverLibraryOutFile, Paths.tsserverLibraryDefinitionOutFile], [Paths.tsserverLibraryFile, Paths.tsserverLibraryDefinitionFile])) {
373377
const copyright = readFileSync(Paths.copyright);
374378

@@ -427,7 +431,7 @@ file(ConfigFileFor.typescriptServices, [], function () {
427431
// typescriptServices.js
428432
// typescriptServices.d.ts
429433
file(Paths.servicesFile, [TaskNames.coreBuild, ConfigFileFor.typescriptServices], function() {
430-
tsbuild(ConfigFileFor.typescriptServices, false, () => {
434+
tsbuild(ConfigFileFor.typescriptServices, !useBuilt, () => {
431435
if (needsUpdate([Paths.servicesOutFile, Paths.servicesDefinitionOutFile], [Paths.servicesFile, Paths.servicesDefinitionFile])) {
432436
const copyright = readFileSync(Paths.copyright);
433437

lib/lib.es5.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,14 +1046,14 @@ interface JSON {
10461046
* @param reviver A function that transforms the results. This function is called for each member of the object.
10471047
* If a member contains nested objects, the nested objects are transformed before the parent object is.
10481048
*/
1049-
parse(text: string, reviver?: (key: any, value: any) => any): any;
1049+
parse(text: string, reviver?: (this: any, key: string, value: any) => any): any;
10501050
/**
10511051
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
10521052
* @param value A JavaScript value, usually an object or array, to be converted.
10531053
* @param replacer A function that transforms the results.
10541054
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
10551055
*/
1056-
stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;
1056+
stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
10571057
/**
10581058
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
10591059
* @param value A JavaScript value, usually an object or array, to be converted.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"@types/minimist": "latest",
4747
"@types/mkdirp": "latest",
4848
"@types/mocha": "latest",
49+
"@types/ms": "latest",
4950
"@types/node": "8.5.5",
5051
"@types/q": "latest",
5152
"@types/source-map-support": "latest",
@@ -68,12 +69,13 @@
6869
"gulp-sourcemaps": "latest",
6970
"istanbul": "latest",
7071
"jake": "latest",
71-
"lodash": "4.17.10",
72+
"lodash": "^4.17.11",
7273
"merge2": "latest",
7374
"minimist": "latest",
7475
"mkdirp": "latest",
7576
"mocha": "latest",
7677
"mocha-fivemat-progress-reporter": "latest",
78+
"ms": "latest",
7779
"plugin-error": "latest",
7880
"pretty-hrtime": "^1.0.3",
7981
"prex": "^0.4.3",

scripts/authors.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import child_process = require("child_process");
44

55
type Author = {
66
displayNames: string[];
7-
preferedName?: string;
7+
preferredName?: string;
88
emails: string[];
99
};
1010

@@ -20,7 +20,7 @@ const authorsPath = path.resolve("../AUTHORS.md");
2020

2121
function getKnownAuthors(): Author[] {
2222
const segmentRegExp = /\s?([^<]+)\s+<([^>]+)>/g;
23-
const preferedNameRegeExp = /\s?#\s?([^#]+)$/;
23+
const preferredNameRegeExp = /\s?#\s?([^#]+)$/;
2424
const knownAuthors: Author[] = [];
2525

2626
if (!fs.existsSync(mailMapPath)) {
@@ -37,13 +37,13 @@ function getKnownAuthors(): Author[] {
3737
author.displayNames.push(match[1]);
3838
author.emails.push(match[2]);
3939
}
40-
if (match = preferedNameRegeExp.exec(line)) {
41-
author.preferedName = match[1];
40+
if (match = preferredNameRegeExp.exec(line)) {
41+
author.preferredName = match[1];
4242
}
4343
if (!author.emails) continue;
4444
knownAuthors.push(author);
45-
if (line.indexOf("#") > 0 && !author.preferedName) {
46-
throw new Error("Could not match prefered name for: " + line);
45+
if (line.indexOf("#") > 0 && !author.preferredName) {
46+
throw new Error("Could not match preferred name for: " + line);
4747
}
4848
// console.log("===> line: " + line);
4949
// console.log(JSON.stringify(author, undefined, 2));
@@ -52,7 +52,7 @@ function getKnownAuthors(): Author[] {
5252
}
5353

5454
function getAuthorName(author: Author) {
55-
return author.preferedName || author.displayNames[0];
55+
return author.preferredName || author.displayNames[0];
5656
}
5757

5858
function getKnownAuthorMaps() {

scripts/bisect-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import cp = require('child_process');
66
import fs = require('fs');
77

8-
// Slice off 'node bisect-test.js' from the commandline args
8+
// Slice off 'node bisect-test.js' from the command line args
99
var args = process.argv.slice(2);
1010

1111
function tsc(tscArgs: string, onExit: (exitCode: number) => void) {

scripts/createBenchmark.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ var rawCompilerSources = "";
3030
sourceFiles.forEach(f=> {
3131
rawCompilerSources += "\r\n" + fs.readFileSync(path.join(tsSourceDir, f)).toString();
3232
});
33-
var compilerSoruces = `var compilerSources = ${JSON.stringify(rawCompilerSources) };`;
33+
var compilerSources = `var compilerSources = ${JSON.stringify(rawCompilerSources) };`;
3434

3535
// .js code for the compiler, what we are actually testing
3636
var rawCompilerJavaScript = fs.readFileSync(path.join(tsBuildDir, "tsc.js")).toString();
3737
rawCompilerJavaScript = rawCompilerJavaScript.replace("ts.executeCommandLine(ts.sys.args);", "");
3838

3939
// lib.d.ts sources
4040
var rawLibSources = fs.readFileSync(path.join(tsBuildDir, "lib.d.ts")).toString();
41-
var libSoruces = `var libSources = ${JSON.stringify(rawLibSources) };`;
41+
var libSources = `var libSources = ${JSON.stringify(rawLibSources) };`;
4242

4343
// write test output
4444
if (!fs.existsSync(testOutputDir)) {
@@ -48,7 +48,7 @@ if (!fs.existsSync(testOutputDir)) {
4848
// 1. compiler ts sources, used to test
4949
fs.writeFileSync(
5050
path.join(testOutputDir, "compilerSources.js"),
51-
`${ compilerSoruces } \r\n ${ libSoruces }`);
51+
`${ compilerSources } \r\n ${ libSources }`);
5252

5353
// 2. the compiler js sources + a call the compiler
5454
fs.writeFileSync(

0 commit comments

Comments
 (0)