Skip to content

Commit f90b59c

Browse files
authored
Merge branch 'master' into es3
2 parents 444cb2e + bbf559b commit f90b59c

File tree

796 files changed

+101229
-21427
lines changed

Some content is hidden

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

796 files changed

+101229
-21427
lines changed

.github/ISSUE_TEMPLATE/Bug_report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Please fill in the *entire* template below.
1616
-->
1717

1818
<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
19-
**TypeScript Version:** 3.3.0-dev.201xxxxx
19+
**TypeScript Version:** 3.4.0-dev.201xxxxx
2020

2121
<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
2222
**Search Terms:**

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Ken Howard <[email protected]>
121121
Kevin Lang <[email protected]>
122122
kimamula <[email protected]> # Kenji Imamula
123123
Kitson Kelly <[email protected]>
124+
Krishnadas Babu <[email protected]>
124125
Klaus Meinhardt <[email protected]>
125126
Kyle Kelley <[email protected]>
126127
Lorant Pinter <[email protected]>

CONTRIBUTING.md

+10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ In general, things we find useful when reviewing suggestions are:
4747

4848
# Instructions for Contributing Code
4949

50+
## Tips
51+
52+
### Faster clones
53+
54+
The TypeScript repository is relatively large. To save some time, you might want to clone it without the repo's full history using `git clone --depth=1`.
55+
56+
### Using local builds
57+
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`.
59+
5060
## Contributing bug fixes
5161

5262
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.

Gulpfile.js

+585-552
Large diffs are not rendered by default.

Jakefile.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ const path = require("path");
88
const fold = require("travis-fold");
99
const ts = require("./lib/typescript");
1010
const del = require("del");
11-
const getDirSize = require("./scripts/build/getDirSize");
11+
const { getDirSize, needsUpdate, flatten } = require("./scripts/build/utils");
1212
const { base64VLQFormatEncode } = require("./scripts/build/sourcemaps");
13-
const needsUpdate = require("./scripts/build/needsUpdate");
14-
const { flatten } = require("./scripts/build/project");
1513

1614
// add node_modules to path so we don't need global modules, prefer the modules by adding them first
1715
var nodeModulesPathPrefix = path.resolve("./node_modules/.bin/") + path.delimiter;
@@ -25,6 +23,10 @@ else if (process.env.PATH !== undefined) {
2523
const host = process.env.TYPESCRIPT_HOST || process.env.host || "node";
2624

2725
const defaultTestTimeout = 40000;
26+
const useBuilt =
27+
process.env.USE_BUILT === "true" ? true :
28+
process.env.LKG === "true" ? false :
29+
false;
2830

2931
let useDebugMode = true;
3032

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

299301
desc("Compiles tslint rules to js");
300302
task(TaskNames.buildRules, [], function () {
301-
tsbuild(ConfigFileFor.lint, false, () => complete());
303+
tsbuild(ConfigFileFor.lint, !useBuilt, () => complete());
302304
}, { async: true });
303305

304306
desc("Cleans the compiler output, declare files, and tests");
@@ -361,7 +363,7 @@ file(ConfigFileFor.tsserverLibrary, [], function () {
361363
compilerOptions: {
362364
"removeComments": false,
363365
"stripInternal": true,
364-
"declarationMap": false,
366+
"declaration": true,
365367
"outFile": "tsserverlibrary.out.js"
366368
}
367369
})
@@ -370,7 +372,7 @@ file(ConfigFileFor.tsserverLibrary, [], function () {
370372
// tsserverlibrary.js
371373
// tsserverlibrary.d.ts
372374
file(Paths.tsserverLibraryFile, [TaskNames.coreBuild, ConfigFileFor.tsserverLibrary], function() {
373-
tsbuild(ConfigFileFor.tsserverLibrary, false, () => {
375+
tsbuild(ConfigFileFor.tsserverLibrary, !useBuilt, () => {
374376
if (needsUpdate([Paths.tsserverLibraryOutFile, Paths.tsserverLibraryDefinitionOutFile], [Paths.tsserverLibraryFile, Paths.tsserverLibraryDefinitionFile])) {
375377
const copyright = readFileSync(Paths.copyright);
376378

@@ -429,7 +431,7 @@ file(ConfigFileFor.typescriptServices, [], function () {
429431
// typescriptServices.js
430432
// typescriptServices.d.ts
431433
file(Paths.servicesFile, [TaskNames.coreBuild, ConfigFileFor.typescriptServices], function() {
432-
tsbuild(ConfigFileFor.typescriptServices, false, () => {
434+
tsbuild(ConfigFileFor.typescriptServices, !useBuilt, () => {
433435
if (needsUpdate([Paths.servicesOutFile, Paths.servicesDefinitionOutFile], [Paths.servicesFile, Paths.servicesDefinitionFile])) {
434436
const copyright = readFileSync(Paths.copyright);
435437

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
2-
[![VSTS Build Status](https://typescript.visualstudio.com/_apis/public/build/definitions/cf7ac146-d525-443c-b23c-0d58337efebc/4/badge)](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=4&view=logs)
2+
[![VSTS Build Status](https://dev.azure.com/typescript/TypeScript/_apis/build/status/Typescript/node10)](https://dev.azure.com/typescript/TypeScript/_build/latest?definitionId=4&view=logs)
33
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
44
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
55

doc/spec.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ TypeScript is a trademark of Microsoft Corporation.
239239

240240
# <a name="1"/>1 Introduction
241241

242-
JavaScript applications such as web e-mail, maps, document editing, and collaboration tools are becoming an increasingly important part of the everyday computing. We designed TypeScript to meet the needs of the JavaScript programming teams that build and maintain large JavaScript programs. TypeScript helps programming teams to define interfaces between software components and to gain insight into the behavior of existing JavaScript libraries. TypeScript also enables teams to reduce naming conflicts by organizing their code into dynamically-loadable modules. TypeScript's optional type system enables JavaScript programmers to use highly-productive development tools and practices: static checking, symbol-based navigation, statement completion, and code re-factoring.
242+
JavaScript applications such as web e-mail, maps, document editing, and collaboration tools are becoming an increasingly important part of the everyday computing. We designed TypeScript to meet the needs of the JavaScript programming teams that build and maintain large JavaScript programs. TypeScript helps programming teams to define interfaces between software components and to gain insight into the behavior of existing JavaScript libraries. TypeScript also enables teams to reduce naming conflicts by organizing their code into dynamically-loadable modules. TypeScript's optional type system enables JavaScript programmers to use highly-productive development tools and practices: static checking, symbol-based navigation, statement completion, and code refactoring.
243243

244244
TypeScript is a syntactic sugar for JavaScript. TypeScript syntax is a superset of ECMAScript 2015 (ES2015) syntax. Every JavaScript program is also a TypeScript program. The TypeScript compiler performs only file-local transformations on TypeScript programs and does not re-order variables declared in TypeScript. This leads to JavaScript output that closely matches the TypeScript input. TypeScript does not transform variable names, making tractable the direct debugging of emitted JavaScript. TypeScript optionally provides source maps, enabling source-level debugging. TypeScript tools typically emit JavaScript upon file save, preserving the test, edit, refresh cycle commonly used in JavaScript development.
245245

@@ -263,7 +263,7 @@ function f() {
263263
}
264264
```
265265

266-
To benefit from this inference, a programmer can use the TypeScript language service. For example, a code editor can incorporate the TypeScript language service and use the service to find the members of a string object as in the following screen shot.
266+
To benefit from this inference, a programmer can use the TypeScript language service. For example, a code editor can incorporate the TypeScript language service and use the service to find the members of a string object as in the following screenshot.
267267

268268
&emsp;&emsp;![](images/image1.png)
269269

@@ -411,7 +411,7 @@ We mentioned above that the '$' function behaves differently depending on the ty
411411
412412
This signature denotes that a function may be passed as the parameter of the '$' function. When a function is passed to '$', the jQuery library will invoke that function when a DOM document is ready. Because TypeScript supports overloading, tools can use TypeScript to show all available function signatures with their documentation tips and to give the correct documentation once a function has been called with a particular signature.
413413
414-
A typical client would not need to add any additional typing but could just use a community-supplied typing to discover (through statement completion with documentation tips) and verify (through static checking) correct use of the library, as in the following screen shot.
414+
A typical client would not need to add any additional typing but could just use a community-supplied typing to discover (through statement completion with documentation tips) and verify (through static checking) correct use of the library, as in the following screenshot.
415415
416416
&emsp;&emsp;![](images/image2.png)
417417
@@ -628,7 +628,7 @@ JavaScript implementations can use these explicit constants to generate efficien
628628

629629
An important goal of TypeScript is to provide accurate and straightforward types for existing JavaScript programming patterns. To that end, TypeScript includes generic types, discussed in the next section, and *overloading on string parameters*, the topic of this section.
630630

631-
JavaScript programming interfaces often include functions whose behavior is discriminated by a string constant passed to the function. The Document Object Model makes heavy use of this pattern. For example, the following screen shot shows that the 'createElement' method of the 'document' object has multiple signatures, some of which identify the types returned when specific strings are passed into the method.
631+
JavaScript programming interfaces often include functions whose behavior is discriminated by a string constant passed to the function. The Document Object Model makes heavy use of this pattern. For example, the following screenshot shows that the 'createElement' method of the 'document' object has multiple signatures, some of which identify the types returned when specific strings are passed into the method.
632632

633633
&emsp;&emsp;![](images/image3.png)
634634

@@ -639,7 +639,7 @@ var span = document.createElement("span");
639639
span.isMultiLine = false; // OK: HTMLSpanElement has isMultiline property
640640
```
641641

642-
In the following screen shot, a programming tool combines information from overloading on string parameters with contextual typing to infer that the type of the variable 'e' is 'MouseEvent' and that therefore 'e' has a 'clientX' property.
642+
In the following screenshot, a programming tool combines information from overloading on string parameters with contextual typing to infer that the type of the variable 'e' is 'MouseEvent' and that therefore 'e' has a 'clientX' property.
643643

644644
&emsp;&emsp;![](images/image4.png)
645645

@@ -3715,7 +3715,7 @@ the array literal initializer expression is contextually typed by the implied ty
37153715
37163716
## <a name="5.3"/>5.3 Let and Const Declarations
37173717
3718-
Let and const declarations are exended to include optional type annotations.
3718+
Let and const declarations are extended to include optional type annotations.
37193719
37203720
&emsp;&emsp;*LexicalBinding:* *( Modified )*
37213721
&emsp;&emsp;&emsp;*SimpleLexicalBinding*

lib/lib.es5.d.ts

+2-2
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

+3-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript",
33
"author": "Microsoft Corp.",
44
"homepage": "https://www.typescriptlang.org/",
5-
"version": "3.3.0",
5+
"version": "3.4.0",
66
"license": "Apache-2.0",
77
"description": "TypeScript is a language for application scale JavaScript development",
88
"keywords": [
@@ -35,10 +35,8 @@
3535
"@types/convert-source-map": "latest",
3636
"@types/del": "latest",
3737
"@types/glob": "latest",
38-
"@types/gulp": "3.X",
38+
"@types/gulp": "^4.0.5",
3939
"@types/gulp-concat": "latest",
40-
"@types/gulp-help": "latest",
41-
"@types/gulp-if": "0.0.33",
4240
"@types/gulp-newer": "latest",
4341
"@types/gulp-rename": "0.0.33",
4442
"@types/gulp-sourcemaps": "0.0.32",
@@ -50,7 +48,6 @@
5048
"@types/mocha": "latest",
5149
"@types/node": "8.5.5",
5250
"@types/q": "latest",
53-
"@types/run-sequence": "latest",
5451
"@types/source-map-support": "latest",
5552
"@types/through2": "latest",
5653
"@types/travis-fold": "latest",
@@ -63,16 +60,12 @@
6360
"del": "latest",
6461
"fancy-log": "latest",
6562
"fs-extra": "^6.0.1",
66-
"gulp": "3.X",
67-
"gulp-clone": "latest",
63+
"gulp": "^4.0.0",
6864
"gulp-concat": "latest",
69-
"gulp-help": "latest",
70-
"gulp-if": "latest",
7165
"gulp-insert": "latest",
7266
"gulp-newer": "latest",
7367
"gulp-rename": "latest",
7468
"gulp-sourcemaps": "latest",
75-
"gulp-typescript": "latest",
7669
"istanbul": "latest",
7770
"jake": "latest",
7871
"lodash": "4.17.10",
@@ -86,7 +79,6 @@
8679
"prex": "^0.4.3",
8780
"q": "latest",
8881
"remove-internal": "^2.9.2",
89-
"run-sequence": "latest",
9082
"source-map-support": "latest",
9183
"through2": "latest",
9284
"travis-fold": "latest",

scripts/authors.ts

+7-7
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

+1-1
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/build/baselineAccept.js

-24
This file was deleted.

scripts/build/browserify.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// @ts-check
22
const browserify = require("browserify");
3-
const Vinyl = require("./vinyl");
3+
const Vinyl = require("vinyl");
44
const { Transform } = require("stream");
55
const { streamFromFile } = require("./utils");
66
const { replaceContents } = require("./sourcemaps");
77

8-
module.exports = browserifyFile;
9-
108
/**
119
* @param {import("browserify").Options} [opts]
1210
*/
@@ -31,4 +29,5 @@ function browserifyFile(opts) {
3129
}
3230
}
3331
});
34-
}
32+
}
33+
exports.browserify = browserifyFile;

scripts/build/chalk.js

-5
This file was deleted.

scripts/build/convertConstEnum.js

-19
This file was deleted.

scripts/build/debounce.js

-31
This file was deleted.

0 commit comments

Comments
 (0)