Skip to content

Commit a4c10a4

Browse files
committed
Merge remote-tracking branch 'origin/master' into debug-messages
* origin/master: (1082 commits) Fix unneeded cast lints (microsoft#29383) Extracted compilerOptions setting to helper function Added codefix to enable experimentalDecorators in the user's config file Add tests for noLib with <reference lib> and bundling. Add tests for noLib with <reference lib>. Do not process library reference directives with noLib set. emit jsx type arguments Allow circular umd-merged-with-augmentation refs to resolve to the module as intended (microsoft#29335) Allow nonnull assertions in references (microsoft#29351) Accept new baselines Add regression tests Improve logic that determines when to resolve conditional types Update user baselines (microsoft#29336) Fix crash (microsoft#29333) Exclude JSDoc @extends from 'super()' checks (microsoft#29308) Fix existing test Verify that completion with new identifier location returns isNewIdentifierLocation: true Fixes microsoft#24009 Fix the failing test case There is no need to check for file presence when trying to rename imports based on file rename Fixes microsoft#29031 Fix gulp baseline-accept (microsoft#29301) ...
2 parents d080a3b + fadd95f commit a4c10a4

File tree

5,210 files changed

+305864
-344352
lines changed

Some content is hidden

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

5,210 files changed

+305864
-344352
lines changed

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 1 addition & 1 deletion
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.1.0-dev.201xxxxx
19+
**TypeScript Version:** 3.3.0-dev.201xxxxx
2020

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

.github/ISSUE_TEMPLATE/Feature_request.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ What shortcomings exist with current approaches?
3232
## Checklist
3333

3434
My suggestion meets these guidelines:
35-
* [ ] This wouldn't be a breaking change in existing TypeScript / JavaScript code
35+
36+
* [ ] This wouldn't be a breaking change in existing TypeScript/JavaScript code
3637
* [ ] This wouldn't change the runtime behavior of existing JavaScript code
3738
* [ ] This could be implemented without emitting different JS based on the types of the expressions
38-
* [ ] This isn't a runtime feature (e.g. new expression-level syntax)
39+
* [ ] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
40+
* [ ] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).
3941

.travis.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: node_js
22

33
node_js:
4-
- 'stable'
5-
- '8'
4+
- 'node'
5+
- '10'
66
- '6'
77

88
sudo: false
@@ -16,10 +16,7 @@ matrix:
1616
branches:
1717
only:
1818
- master
19-
- release-2.7
20-
- release-2.8
21-
- release-2.9
22-
- release-3.0
19+
- /^release-.*/
2320

2421
install:
2522
- npm uninstall typescript --no-save

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

CONTRIBUTING.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Your pull request should:
7272
* Requests need not be a single commit, but should be a linear sequence of commits (i.e. no merge commits in your PR)
7373
* It is desirable, but not necessary, for the tests to pass at each commit
7474
* Have clear commit messages
75-
* e.g. "Refactor feature", "Fix issue", "Add tests for issue"
75+
* e.g. "Minor refactor in goToTypeDefinition", "Fix iterated type in for-await-of", "Add test for preserveWatchOutput on command line"
7676
* Include adequate tests
7777
* At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why
7878
* Tests should include reasonable permutations of the target fix/change
@@ -82,19 +82,26 @@ Your pull request should:
8282
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
8383

8484
## Contributing `lib.d.ts` fixes
85-
86-
The library sources are in: [src/lib](https://github.com/Microsoft/TypeScript/tree/master/src/lib)
8785

88-
Library files in `built/local/` are updated by running
89-
```Shell
86+
There are three relevant locations to be aware of when it comes to TypeScript's library declaration files:
87+
88+
* `src/lib`: the location of the sources themselves.
89+
* `lib`: the location of the last-known-good (LKG) versions of the files which are updated periodically.
90+
* `built/local`: the build output location, including where `src/lib` files will be copied to.
91+
92+
Any changes should be made to [src/lib](https://github.com/Microsoft/TypeScript/tree/master/src/lib). **Most** of these files can be updated by hand, with the exception of any generated files (see below).
93+
94+
Library files in `built/local/` are updated automatically by running the standard build task:
95+
96+
```sh
9097
jake
9198
```
9299

93-
The files in `lib/` are used to bootstrap compilation and usually do not need to be updated.
100+
The files in `lib/` are used to bootstrap compilation and usually **should not** be updated unless publishing a new version or updating the LKG.
94101

95-
#### `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts`
102+
### Modifying generated library files
96103

97-
These two files represent the DOM typings and are auto-generated. To make any modifications to them, please submit a PR to https://github.com/Microsoft/TSJS-lib-generator
104+
The files `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts` both represent type declarations for the DOM and are auto-generated. To make any modifications to them, you will have to direct changes to https://github.com/Microsoft/TSJS-lib-generator
98105

99106
## Running the Tests
100107

@@ -104,7 +111,7 @@ To run all tests, invoke the `runtests-parallel` target using jake:
104111
jake runtests-parallel
105112
```
106113

107-
This run will all tests; to run only a specific subset of tests, use:
114+
This will run all tests; to run only a specific subset of tests, use:
108115

109116
```Shell
110117
jake runtests tests=<regex>
@@ -137,10 +144,10 @@ You can specify which browser to use for debugging. Currently Chrome and IE are
137144
jake runtests-browser tests=2dArrays browser=chrome
138145
```
139146

140-
You can debug with VS Code or Node instead with `jake runtests debug=true`:
147+
You can debug with VS Code or Node instead with `jake runtests inspect=true`:
141148

142149
```Shell
143-
jake runtests tests=2dArrays debug=true
150+
jake runtests tests=2dArrays inspect=true
144151
```
145152

146153
## Adding a Test
@@ -153,7 +160,7 @@ The supported names and values are the same as those supported in the compiler i
153160
They are useful for tests relating to modules.
154161
See below for examples.
155162

156-
**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in `tests\cases\conformance` in an appropriately-named subfolder.
163+
**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in `tests\cases\conformance` in an appropriately-named subfolder.
157164
**Note** that filenames here must be distinct from all other compiler testcase names, so you may have to work a bit to find a unique name if it's something common.
158165

159166
### Tests for multiple files
@@ -194,6 +201,6 @@ to establish the new baselines as the desired behavior. This will change the fil
194201
## Localization
195202

196203
All strings the user may see are stored in [`diagnosticMessages.json`](./src/compiler/diagnosticMessages.json).
197-
If you make changes to it, run `jake generate-diagnostics` to push them to the `Diagnostic` interface in [`diagnosticInformationMap.generated.ts`](./src/compiler/diagnosticInformationMap.generated.ts).
204+
If you make changes to it, run `jake generate-diagnostics` to push them to the `Diagnostic` interface in `diagnosticInformationMap.generated.ts`.
198205

199206
See [coding guidelines on diagnostic messages](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#diagnostic-messages).

Gulpfile.js

Lines changed: 59 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ const baselineAccept = require("./scripts/build/baselineAccept");
2424
const cmdLineOptions = require("./scripts/build/options");
2525
const exec = require("./scripts/build/exec");
2626
const browserify = require("./scripts/build/browserify");
27-
const debounce = require("./scripts/build/debounce");
2827
const prepend = require("./scripts/build/prepend");
2928
const { removeSourceMaps } = require("./scripts/build/sourcemaps");
30-
const { CancelSource, CancelError } = require("./scripts/build/cancellation");
29+
const { CancellationTokenSource, CancelError, delay, Semaphore } = require("prex");
3130
const { libraryTargets, generateLibs } = require("./scripts/build/lib");
3231
const { runConsoleTests, cleanTestDirs, writeTestConfigFile, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline } = require("./scripts/build/tests");
3332

@@ -118,7 +117,8 @@ const generatedLCGFile = "built/local/enu/diagnosticMessages.generated.json.lcg"
118117
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
119118
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
120119
*/
121-
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"]
120+
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"]
121+
.map(f => f.toLowerCase())
122122
.map(f => `built/local/${f}/diagnosticMessages.generated.json`)
123123
.concat(generatedLCGFile);
124124

@@ -534,57 +534,80 @@ gulp.task(
534534
["watch-diagnostics", "watch-lib"].concat(useCompilerDeps),
535535
() => project.watch(tsserverProject, { typescript: useCompiler }));
536536

537-
gulp.task(
538-
"watch-local",
539-
/*help*/ false,
540-
["watch-lib", "watch-tsc", "watch-services", "watch-server"]);
541-
542537
gulp.task(
543538
"watch-runner",
544539
/*help*/ false,
545540
useCompilerDeps,
546541
() => project.watch(testRunnerProject, { typescript: useCompiler }));
547542

548-
const watchPatterns = [
549-
runJs,
550-
typescriptDts,
551-
tsserverlibraryDts
552-
];
543+
gulp.task(
544+
"watch-local",
545+
"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"]);
553547

554548
gulp.task(
555549
"watch",
556-
"Watches for changes to the build inputs for built/local/run.js, then executes runtests-parallel.",
550+
"Watches for changes to the build inputs for built/local/run.js, then runs tests.",
557551
["build-rules", "watch-runner", "watch-services", "watch-lssl"],
558552
() => {
559-
/** @type {CancelSource | undefined} */
560-
let runTestsSource;
553+
const sem = new Semaphore(1);
561554

562-
const fn = debounce(() => {
563-
runTests().catch(error => {
564-
if (error instanceof CancelError) {
565-
log.warn("Operation was canceled");
566-
}
567-
else {
568-
log.error(error);
569-
}
570-
});
571-
}, /*timeout*/ 100, { max: 500 });
572-
573-
gulp.watch(watchPatterns, () => project.wait().then(fn));
555+
gulp.watch([runJs, typescriptDts, tsserverlibraryDts], () => {
556+
runTests();
557+
});
574558

575559
// NOTE: gulp.watch is far too slow when watching tests/cases/**/* as it first enumerates *every* file
576560
const testFilePattern = /(\.ts|[\\/]tsconfig\.json)$/;
577561
fs.watch("tests/cases", { recursive: true }, (_, file) => {
578-
if (testFilePattern.test(file)) project.wait().then(fn);
562+
if (testFilePattern.test(file)) runTests();
579563
});
580564

581-
function runTests() {
582-
if (runTestsSource) runTestsSource.cancel();
583-
runTestsSource = new CancelSource();
584-
return cmdLineOptions.tests || cmdLineOptions.failed
585-
? runConsoleTests(runJs, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ true, runTestsSource.token)
586-
: runConsoleTests(runJs, "min", /*runInParallel*/ true, /*watchMode*/ true, runTestsSource.token);
587-
}
565+
async function runTests() {
566+
try {
567+
// Ensure only one instance of the test runner is running at any given time.
568+
if (sem.count > 0) {
569+
await sem.wait();
570+
try {
571+
// Wait for any concurrent recompilations to complete...
572+
try {
573+
await delay(100);
574+
while (project.hasRemainingWork()) {
575+
await project.waitForWorkToComplete();
576+
await delay(500);
577+
}
578+
}
579+
catch (e) {
580+
if (e instanceof CancelError) return;
581+
throw e;
582+
}
583+
584+
// cancel any pending or active test run if a new recompilation is triggered
585+
const source = new CancellationTokenSource();
586+
project.waitForWorkToStart().then(() => {
587+
source.cancel();
588+
});
589+
590+
if (cmdLineOptions.tests || cmdLineOptions.failed) {
591+
await runConsoleTests(runJs, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ true, source.token);
592+
}
593+
else {
594+
await runConsoleTests(runJs, "min", /*runInParallel*/ true, /*watchMode*/ true, source.token);
595+
}
596+
}
597+
finally {
598+
sem.release();
599+
}
600+
}
601+
}
602+
catch (e) {
603+
if (e instanceof CancelError) {
604+
log.warn("Operation was canceled");
605+
}
606+
else {
607+
log.error(e);
608+
}
609+
}
610+
};
588611
});
589612

590613
gulp.task("clean-built", /*help*/ false, [`clean:${diagnosticInformationMapTs}`], () => del(["built"]));

Jakefile.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ else if (process.env.PATH !== undefined) {
2424

2525
const host = process.env.TYPESCRIPT_HOST || process.env.host || "node";
2626

27-
const locales = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"];
28-
2927
const defaultTestTimeout = 40000;
3028

3129
let useDebugMode = true;
@@ -147,14 +145,14 @@ task(TaskNames.local, [
147145
task("default", [TaskNames.local]);
148146

149147
const RunTestsPrereqs = [TaskNames.lib, Paths.servicesDefinitionFile, Paths.typescriptDefinitionFile, Paths.tsserverLibraryDefinitionFile];
150-
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true.");
148+
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... i[nspect]=true.");
151149
task(TaskNames.runtestsParallel, RunTestsPrereqs, function () {
152150
tsbuild([ConfigFileFor.runjs], true, () => {
153151
runConsoleTests("min", /*parallel*/ true);
154152
});
155153
}, { async: true });
156154

157-
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true.");
155+
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... i[nspect]=true.");
158156
task(TaskNames.runtests, RunTestsPrereqs, function () {
159157
tsbuild([ConfigFileFor.runjs], true, () => {
160158
runConsoleTests('mocha-fivemat-progress-reporter', /*runInParallel*/ false);
@@ -520,7 +518,6 @@ function runConsoleTests(defaultReporter, runInParallel) {
520518
}
521519

522520
let testTimeout = process.env.timeout || defaultTestTimeout;
523-
const debug = process.env.debug || process.env["debug-brk"] || process.env.d;
524521
const inspect = process.env.inspect || process.env["inspect-brk"] || process.env.i;
525522
const runners = process.env.runners || process.env.runner || process.env.ru;
526523
const tests = process.env.test || process.env.tests || process.env.t;
@@ -710,19 +707,6 @@ const Travis = {
710707
}
711708
};
712709

713-
function buildLocalizedTargets() {
714-
/**
715-
* The localization target produces the two following transformations:
716-
* 1. 'src\loc\lcl\<locale>\diagnosticMessages.generated.json.lcl' => 'built\local\<locale>\diagnosticMessages.generated.json'
717-
* convert localized resources into a .json file the compiler can understand
718-
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
719-
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
720-
*/
721-
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"]
722-
.map(f => path.join(Paths.builtLocal,f))
723-
.concat(path.dirname(Paths.generatedLCGFile));
724-
}
725-
726710
function toNs(diff) {
727711
return diff[0] * 1e9 + diff[1];
728712
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob
2929
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
3030
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
3131
* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript).
32-
* Join the [#typescript](https://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
32+
* Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter.
3333
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
3434
* Read the language specification ([docx](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true),
3535
[pdf](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)).
@@ -61,7 +61,7 @@ Change to the TypeScript directory:
6161
cd TypeScript
6262
```
6363

64-
Install Jake tools and dev dependencies:
64+
Install [Jake](http://jakejs.com/) tools and dev dependencies:
6565

6666
```bash
6767
npm install -g jake

completionAtDottedNamespace.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////namespace wwer./**/w
4+
5+
verify.completions({ marker: "", exact: [], isNewIdentifierLocation: true });

doc/spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function f(s) {
286286
}
287287
```
288288

289-
In the JavaScript output, all type annotations have been erased. In general, TypeScript erases all type information before emiting JavaScript.
289+
In the JavaScript output, all type annotations have been erased. In general, TypeScript erases all type information before emitting JavaScript.
290290

291291
## <a name="1.1"/>1.1 Ambient Declarations
292292

lib/de/diagnosticMessages.generated.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@
938938
"Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "Der Typ iterierter Elemente eines \"yield*\"-Operanden muss entweder eine gültige Zusage sein oder darf keinen aufrufbaren \"then\"-Member enthalten.",
939939
"Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "Der Typ eines \"yield\"-Operanden in einem asynchronen Generator muss entweder eine gültige Zusage sein oder darf keinen aufrufbaren \"then\"-Member enthalten.",
940940
"Type_parameter_0_has_a_circular_constraint_2313": "Der Typparameter \"{0}\" weist eine zirkuläre Einschränkung auf.",
941-
"Type_parameter_0_has_a_circular_default_2716": "Der Typparameter \"{0}\" weist einen zirkulären Standard auf.",
941+
"Type_parameter_0_has_a_circular_default_2716": "Der Typparameter \"{0}\" besitzt einen zirkulären Standardwert.",
942942
"Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008": "Der Typparameter \"{0}\" der Aufrufsignatur aus der exportierten Schnittstelle besitzt oder verwendet den privaten Namen \"{1}\".",
943943
"Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006": "Der Typparameter \"{0}\" der Konstruktorsignatur aus der exportierten Schnittstelle besitzt oder verwendet den privaten Namen \"{1}\".",
944944
"Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002": "Der Typparameter \"{0}\" der exportierten Klasse besitzt oder verwendet den privaten Namen \"{1}\".",

0 commit comments

Comments
 (0)