Skip to content

Commit 7c1bb14

Browse files
committed
Merge branch 'master' into fixContextualReturnTypes
2 parents 2ea0251 + fa74cef commit 7c1bb14

File tree

144 files changed

+5016
-1328
lines changed

Some content is hidden

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

144 files changed

+5016
-1328
lines changed

.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

+45-31
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ gulp.task(typescriptServicesProject, /*help*/ false, () => {
138138
compilerOptions: {
139139
"removeComments": false,
140140
"stripInternal": true,
141-
"declarationMap": false,
141+
"declaration": true,
142142
"outFile": "typescriptServices.out.js" // must align with same task in jakefile. We fix this name below.
143143
}
144144
});
@@ -215,6 +215,11 @@ const tsserverProject = "src/tsserver/tsconfig.json";
215215
const tsserverJs = "built/local/tsserver.js";
216216
gulp.task(tsserverJs, /*help*/ false, useCompilerDeps, () => project.compile(tsserverProject, { typescript: useCompiler }));
217217

218+
gulp.task(
219+
"tsserver",
220+
"Builds the language server",
221+
[tsserverJs]);
222+
218223
const watchGuardProject = "src/watchGuard/tsconfig.json";
219224
const watchGuardJs = "built/local/watchGuard.js";
220225
gulp.task(watchGuardJs, /*help*/ false, useCompilerDeps, () => project.compile(watchGuardProject, { typescript: useCompiler }));
@@ -274,7 +279,7 @@ gulp.task(
274279
// Generate Markdown spec
275280
const specMd = "doc/spec.md";
276281
gulp.task(specMd, /*help*/ false, [word2mdJs], () =>
277-
exec("cscript", ["//nologo", word2mdJs, path.resolve(specMd), path.resolve("doc/TypeScript Language Specification.docx")]));
282+
exec("cscript", ["//nologo", word2mdJs, path.resolve("doc/TypeScript Language Specification.docx"), path.resolve(specMd)]));
278283

279284
gulp.task(
280285
"generate-spec",
@@ -488,29 +493,28 @@ gulp.task(
488493
"Runs 'local'",
489494
["local"]);
490495

491-
gulp.task(
492-
"watch-diagnostics",
493-
/*help*/ false,
494-
[processDiagnosticMessagesJs],
495-
() => gulp.watch([diagnosticMessagesJson], [diagnosticInformationMapTs, builtGeneratedDiagnosticMessagesJson]));
496-
497496
gulp.task(
498497
"watch-lib",
499498
/*help*/ false,
500499
() => gulp.watch(["src/lib/**/*"], ["lib"]));
501500

501+
const watchTscPatterns = [
502+
"src/tsconfig-base.json",
503+
"src/lib/**/*",
504+
"src/compiler/**/*",
505+
"src/tsc/**/*",
506+
];
502507
gulp.task(
503508
"watch-tsc",
504509
/*help*/ false,
505-
["watch-diagnostics", "watch-lib"].concat(useCompilerDeps),
506-
() => project.watch(tscProject, { typescript: useCompiler }));
510+
useCompilerDeps,
511+
() => gulp.watch(watchTscPatterns, ["tsc"]));
507512

508513
const watchServicesPatterns = [
509514
"src/compiler/**/*",
510515
"src/jsTypings/**/*",
511516
"src/services/**/*"
512517
];
513-
514518
gulp.task(
515519
"watch-services",
516520
/*help*/ false,
@@ -522,39 +526,49 @@ const watchLsslPatterns = [
522526
"src/server/**/*",
523527
"src/tsserver/tsconfig.json"
524528
];
525-
526529
gulp.task(
527530
"watch-lssl",
528531
/*help*/ false,
529532
() => gulp.watch(watchLsslPatterns, ["lssl"]));
530533

531-
gulp.task(
532-
"watch-server",
533-
/*help*/ false,
534-
["watch-diagnostics", "watch-lib"].concat(useCompilerDeps),
535-
() => project.watch(tsserverProject, { typescript: useCompiler }));
536-
537-
gulp.task(
538-
"watch-runner",
539-
/*help*/ false,
540-
useCompilerDeps,
541-
() => project.watch(testRunnerProject, { typescript: useCompiler }));
542-
534+
const watchLocalPatterns = [
535+
"src/tsconfig-base.json",
536+
"src/lib/**/*",
537+
"src/compiler/**/*",
538+
"src/tsc/**/*",
539+
"src/services/**/*",
540+
"src/jsTyping/**/*",
541+
"src/server/**/*",
542+
"src/tsserver/**/*",
543+
"src/typingsInstallerCore/**/*",
544+
"src/harness/**/*",
545+
"src/testRunner/**/*",
546+
];
543547
gulp.task(
544548
"watch-local",
545549
"Watches for changes to projects in src/ (but does not execute tests).",
546-
["watch-lib", "watch-tsc", "watch-services", "watch-server", "watch-runner", "watch-lssl"]);
550+
() => gulp.watch(watchLocalPatterns, ["local"]));
547551

552+
const watchPatterns = [
553+
"src/tsconfig-base.json",
554+
"src/lib/**/*",
555+
"src/compiler/**/*",
556+
"src/services/**/*",
557+
"src/jsTyping/**/*",
558+
"src/server/**/*",
559+
"src/tsserver/**/*",
560+
"src/typingsInstallerCore/**/*",
561+
"src/harness/**/*",
562+
"src/testRunner/**/*",
563+
];
548564
gulp.task(
549565
"watch",
550566
"Watches for changes to the build inputs for built/local/run.js, then runs tests.",
551-
["build-rules", "watch-runner", "watch-services", "watch-lssl"],
567+
["build-rules"],
552568
() => {
553569
const sem = new Semaphore(1);
554570

555-
gulp.watch([runJs, typescriptDts, tsserverlibraryDts], () => {
556-
runTests();
557-
});
571+
gulp.watch(watchPatterns, () => { runTests(); });
558572

559573
// NOTE: gulp.watch is far too slow when watching tests/cases/**/* as it first enumerates *every* file
560574
const testFilePattern = /(\.ts|[\\/]tsconfig\.json)$/;
@@ -586,7 +600,7 @@ gulp.task(
586600
project.waitForWorkToStart().then(() => {
587601
source.cancel();
588602
});
589-
603+
590604
if (cmdLineOptions.tests || cmdLineOptions.failed) {
591605
await runConsoleTests(runJs, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ true, source.token);
592606
}
@@ -623,4 +637,4 @@ gulp.task(
623637
"clean:scripts",
624638
"clean-rules",
625639
"clean-built"
626-
]);
640+
]);

Jakefile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ file(ConfigFileFor.tsserverLibrary, [], function () {
361361
compilerOptions: {
362362
"removeComments": false,
363363
"stripInternal": true,
364-
"declarationMap": false,
364+
"declaration": true,
365365
"outFile": "tsserverlibrary.out.js"
366366
}
367367
})

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

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

scripts/build/options.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = minimist(process.argv.slice(2), {
3434
workers: process.env.workerCount || os.cpus().length,
3535
failed: false,
3636
keepFailed: false,
37-
lkg: false,
37+
lkg: true,
3838
dirty: false
3939
}
4040
});

0 commit comments

Comments
 (0)