Skip to content

Commit 9beaffd

Browse files
committed
Merge branch 'master' into abstractConstructSignatures
# Conflicts: # src/compiler/diagnosticMessages.json
2 parents 5ca4c99 + b405fdd commit 9beaffd

File tree

2,966 files changed

+266404
-199776
lines changed

Some content is hidden

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

2,966 files changed

+266404
-199776
lines changed

.eslintrc.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
"@typescript-eslint/adjacent-overload-signatures": "error",
1818
"@typescript-eslint/array-type": "error",
1919

20-
"camelcase": "off",
20+
"brace-style": "off",
21+
"@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
22+
2123
"@typescript-eslint/naming-convention": [
2224
"error",
2325
{ "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
@@ -32,6 +34,10 @@
3234
],
3335

3436
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
37+
38+
"no-duplicate-imports": "off",
39+
"@typescript-eslint/no-duplicate-imports": "error",
40+
3541
"@typescript-eslint/no-inferrable-types": "error",
3642
"@typescript-eslint/no-misused-new": "error",
3743
"@typescript-eslint/no-this-alias": "error",
@@ -86,7 +92,6 @@
8692
"jsdoc/check-alignment": "error",
8793

8894
// eslint
89-
"brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
9095
"constructor-super": "error",
9196
"curly": ["error", "multi-line"],
9297
"dot-notation": "error",
@@ -95,7 +100,6 @@
95100
"new-parens": "error",
96101
"no-caller": "error",
97102
"no-duplicate-case": "error",
98-
"no-duplicate-imports": "error",
99103
"no-empty": "error",
100104
"no-eval": "error",
101105
"no-extra-bind": "error",

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,70 @@ about: Create a report to help us improve TypeScript
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
8+
# Bug Report
99

10-
<!-- 🚨 STOP 🚨 STOP 🚨 STOP 🚨
11-
12-
Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section!
10+
<!--
11+
Please fill in each section completely. Thank you!
12+
-->
1313

14-
Please help us by doing the following steps before logging an issue:
15-
* Search: https://github.com/Microsoft/TypeScript/search?type=Issues
16-
* Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ
14+
### 🔎 Search Terms
1715

18-
Please fill in the *entire* template below.
16+
<!--
17+
What search terms did you use when trying to find an existing bug report?
18+
List them here so people in the future can find this one more easily.
1919
-->
2020

21-
<!--
22-
Please try to reproduce the issue with the latest published version. It may have already been fixed.
21+
### 🕗 Version & Regression Information
22+
23+
<!-- When did you start seeing this bug occur?
24+
25+
"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
26+
https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs
27+
28+
If possible, please try testing the nightly version of TS to see if it's already been fixed.
2329
For npm: `typescript@next`
2430
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly
31+
32+
Note: The TypeScript Playground can be used to try older versions of TypeScript.
33+
34+
Please keep and fill in the line that best applies:
2535
-->
26-
**TypeScript Version:** 3.7.x-dev.201xxxxx
36+
- This is a crash
37+
- This changed between versions ______ and _______
38+
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
39+
- I was unable to test this on prior versions because _______
40+
41+
### ⏯ Playground Link
2742

28-
<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
29-
**Search Terms:**
43+
<!--
44+
A link to a TypeScript Playground "Share" link which shows this behavior
45+
46+
The TypeScript Workbench can be used for more complex setups, try
47+
https://www.typescriptlang.org/dev/bug-workbench/
48+
49+
As a last resort, you can link to a repo, but these will be slower for us to investigate.
50+
-->
51+
[Playground link with relevant code](https://www.typescriptlang.org/play?#code/PTAEFkE9QYwewCYFNQHM5IM6gBZIE5JA)
3052

31-
**Code**
53+
### 💻 Code
3254

55+
<!-- Please post the relevant code sample here as well-->
3356
```ts
34-
// A *self-contained* demonstration of the problem follows...
35-
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
57+
// We can quickly address your report if:
58+
// - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!
59+
// - It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.
60+
// - The incorrectness of the behavior is readily apparent from reading the sample.
61+
// Reports are slower to investigate if:
62+
// - We have to pare too much extraneous code.
63+
// - We have to clone a large repo and validate that the problem isn't elsewhere.
64+
// - The sample is confusing or doesn't clearly demonstrate what's wrong.
3665
```
3766

38-
**Expected behavior:**
67+
### 🙁 Actual behavior
3968

40-
**Actual behavior:**
69+
<!-- What happened, and why it was wrong -->
4170

42-
**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->
71+
### 🙂 Expected behavior
4372

44-
**Related Issues:** <!-- Did you find other bugs that looked similar? -->
73+
<!-- What you expected to happen instead, and why -->

.github/ISSUE_TEMPLATE/Feature_request.md

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,56 @@ about: Suggest an idea
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
8+
# Suggestion
99

10-
<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨
11-
12-
Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker.
13-
14-
Please help us by doing the following steps before logging an issue:
15-
* Search: https://github.com/Microsoft/TypeScript/search?type=Issues
16-
* Read the FAQ, especially the "Common Feature Requests" section: https://github.com/Microsoft/TypeScript/wiki/FAQ
17-
10+
<!--
11+
Please fill in each section completely. Thank you!
1812
-->
1913

20-
## Search Terms
14+
## 🔍 Search Terms
2115

22-
<!-- List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily -->
16+
<!--
17+
💡 Did you know? TypeScript has over 2,000 open suggestions!
18+
🔎 Please search thoroughly before logging new feature requests as most common ideas already have a proposal in progress.
19+
The "Common Feature Requests" section of the FAQ lists many popular requests: https://github.com/Microsoft/TypeScript/wiki/FAQ#common-feature-requests
2320
24-
## Suggestion
21+
Replace the text below:
22+
-->
2523

26-
<!-- A summary of what you'd like to see added or changed -->
24+
List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.
2725

28-
## Use Cases
26+
## ✅ Viability Checklist
2927

3028
<!--
31-
What do you want to use this for?
32-
What shortcomings exist with current approaches?
29+
Suggestions that don't meet all these criteria are very, very unlikely to be accepted.
30+
We always recommend reviewing the TypeScript design goals before investing time writing
31+
a proposal for ideas outside the scope of the project.
3332
-->
34-
35-
## Examples
36-
37-
<!-- Show how this would be used and what the behavior would be -->
38-
39-
## Checklist
40-
4133
My suggestion meets these guidelines:
4234

4335
* [ ] This wouldn't be a breaking change in existing TypeScript/JavaScript code
4436
* [ ] This wouldn't change the runtime behavior of existing JavaScript code
4537
* [ ] This could be implemented without emitting different JS based on the types of the expressions
46-
* [ ] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
38+
* [ ] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
4739
* [ ] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).
40+
41+
42+
## ⭐ Suggestion
43+
44+
<!-- A summary of what you'd like to see added or changed -->
45+
46+
## 📃 Motivating Example
47+
48+
<!--
49+
If you were announcing this feature in a blog post, what's a short explanation that shows
50+
a developer why this feature improves the language?
51+
-->
52+
53+
## 💻 Use Cases
54+
55+
<!--
56+
What do you want to use this for?
57+
What shortcomings exist with current approaches?
58+
What workarounds are you using in the meantime?
59+
-->

.github/ISSUE_TEMPLATE/lib_change.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: Library change
3+
about: Fix or improve issues with built-in type definitions like `lib.dom.d.ts`, `lib.es6.d.ts`, etc.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
---
8+
# lib Update Request
9+
10+
<!--
11+
Please fill in each section completely. Thank you!
12+
13+
Are you here for one of these commonly-requested lib changes?
14+
* Object.keys - see https://stackoverflow.com/questions/55012174/
15+
* Array methods - see https://github.com/microsoft/TypeScript/issues/36554
16+
* parseInt, parseFloat, isFinite, isNaN, etc. - see https://github.com/microsoft/TypeScript/issues/4002
17+
18+
The DOM lib is maintained elsewhere and you can skip a step by filing issues/PRs for the DOM at that repo.
19+
See https://github.com/microsoft/TypeScript-DOM-lib-generator
20+
-->
21+
22+
## Configuration Check
23+
24+
<!--
25+
If you're missing common new methods like Array.includes, you may have a misconfigured project.
26+
Try setting `lib: "es2020"` and checking whether the type you want is present.
27+
You can diagnose further by running `tsc` with `--listFilesOnly` or `--showConfig`.
28+
29+
Conversely, if you are seeing built-in methods you expect to *not* see, check your 'lib' setting
30+
or review your dependencies for lib/reference directives that might be polluting
31+
your global scope. This is common when using the 'node' type library. See https://github.com/microsoft/TypeScript/issues/40184
32+
33+
Replace the text below:
34+
-->
35+
My compilation *target* is `ES2015` and my *lib* is `the default`.
36+
37+
## Missing / Incorrect Definition
38+
39+
<!--
40+
What property, method, function, etc is missing or incorrect?
41+
-->
42+
43+
## Sample Code
44+
45+
<!--
46+
What's some code using this that should work, but doesn't?
47+
-->
48+
49+
## Documentation Link
50+
51+
<!--
52+
Link to relevant documentation (e.g. MDN, W3C, ECMAScript Spec) to consult for this property.
53+
Note that lib.dom.d.ts intentionally does not include browser-specific extensions
54+
or early experimental features.
55+
-->

.github/pr_owners.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ RyanCavanaugh
66
sheetalkamat
77
orta
88
rbuckton
9+
ahejlsberg
10+
amcasey
11+
jessetrinity
12+
minestarks
13+
uniqueiniquity
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Accept Baselines and Fix Lints
2+
3+
on:
4+
workflow_dispatch: {}
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Use node version 12
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: 12
16+
registry-url: https://registry.npmjs.org/
17+
18+
- name: Configure Git, Run Tests, Update Baselines, Apply Fixes
19+
run: |
20+
git config user.email "[email protected]"
21+
git config user.name "TypeScript Bot"
22+
npm install
23+
gulp runtests-parallel --ci --fix || true
24+
gulp baseline-accept
25+
git add ./src
26+
git add ./tests/baselines/reference
27+
git diff --cached
28+
git commit -m "Update Baselines and/or Applied Lint Fixes"
29+
git push

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ jobs:
4242
- name: Linter
4343
run: npm run lint:ci
4444

45+
- name: Adding playwright
46+
run: npm install --no-save --no-package-lock playwright
47+
4548
- name: Validate the browser can import TypeScript
4649
run: gulp test-browser-integration
4750

.github/workflows/nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup and publish nightly
2323
run: |
2424
npm whoami
25-
npm i
25+
npm ci
2626
gulp configure-nightly
2727
gulp LKG
2828
gulp runtests-parallel

.github/workflows/release-branch-artifact.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
npm test
2626
env:
2727
CI: true
28+
- name: Adding playwright
29+
run: npm install --no-save --no-package-lock playwright
2830
- name: Validate the browser can import TypeScript
2931
run: gulp test-browser-integration
3032
- name: LKG, clean, and pack

.github/workflows/sync-branch.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
- uses: actions/checkout@v2
2222
with:
2323
ref: ${{ github.event.inputs.branch_name || github.event.client_payload.branch_name }}
24+
fetch-depth: 0
2425
# This does a test post-merge and only pushes the result if the test succeeds
2526
# required client_payload members:
2627
# branch_name - the target branch

CONTRIBUTING.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,25 @@ import { f as g } from "file1";
189189
var x = g();
190190
```
191191

192-
## Managing the Baselines
192+
## Managing the baselines
193193

194-
Compiler tests generate baselines: one file each for the emitted `.js`, the errors produced by the compiler, the type of each expression, and symbol for each identifier. Additionally, some tests generate baselines for the source map output.
194+
Most tests generate "baselines" to find differences in output.
195+
As an example, compiler tests usually emit one file each for
196+
197+
- the `.js` and `.d.ts` output (all in the same `.js` output file),
198+
- the errors produced by the compiler (in an `.errors.txt` file),
199+
- the types of each expression (in a `.types` file),
200+
- the symbols for each identifier (in a `.symbols` file), and
201+
- the source map outputs for files if a test opts into them (in a `.js.map` file).
195202

196203
When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use
197204

198205
```Shell
199-
gulp diff
206+
git diff --diff-filter=AM --no-index ./tests/baselines/reference ./tests/baselines/local
200207
```
201208

209+
Alternatively, you can set the `DIFF` environment variable and run `gulp diff`, or manually run your favorite folder diffing tool between `tests/baselines/reference` and `tests/baselines/local`. Our team largely uses Beyond Compare and WinMerge.
210+
202211
After verifying that the changes in the baselines are correct, run
203212

204213
```Shell

Gulpfile.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ const watchLssl = () => watch([
308308
"src/services/**/*.ts",
309309
"src/server/tsconfig.json",
310310
"src/server/**/*.ts",
311+
"src/webServer/tsconfig.json",
312+
"src/webServer/**/*.ts",
311313
"src/tsserver/tsconfig.json",
312314
"src/tsserver/**/*.ts",
313315
], buildLssl);
@@ -590,6 +592,7 @@ task("LKG").description = "Makes a new LKG out of the built js files";
590592
task("LKG").flags = {
591593
" --built": "Compile using the built version of the compiler.",
592594
};
595+
task("lkg", series("LKG"));
593596

594597
const generateSpec = () => exec("cscript", ["//nologo", "scripts/word2md.js", path.resolve("doc/TypeScript Language Specification - ARCHIVED.docx"), path.resolve("doc/spec-ARCHIVED.md")]);
595598
task("generate-spec", series(buildScripts, generateSpec));

0 commit comments

Comments
 (0)