Skip to content

Commit ff3890f

Browse files
committed
Merge branch 'master' into mappedtype-inference-seperate-symbols
2 parents 3fa71c0 + a8742e3 commit ff3890f

File tree

2,313 files changed

+526393
-286212
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,313 files changed

+526393
-286212
lines changed

.devcontainer/Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.154.0/containers/javascript-node/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Node.js version: 14, 12, 10
4+
ARG VARIANT="14-buster"
5+
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
6+
7+
RUN sudo -u node npm install -g gulp-cli

.devcontainer/devcontainer.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Node.js",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
"VARIANT": "14"
7+
}
8+
},
9+
"settings": {
10+
"terminal.integrated.shell.linux": "/bin/bash"
11+
},
12+
"extensions": [
13+
"dbaeumer.vscode-eslint"
14+
],
15+
"remoteUser": "node"
16+
}

.github/ISSUE_TEMPLATE/Bug_report.md

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

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

+55
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/workflows/new-release-branch.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts
2323
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts
2424
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
25-
sed -i -e 's/const version = `${versionMajorMinor}.0-.*`/const version = `${versionMajorMinor}.0-${{ github.event.client_payload.core_tag || 'dev' }}`/g' src/compiler/corePublic.ts
25+
sed -i -e 's/const version\(: string\)\{0,1\} = `${versionMajorMinor}.0-.*`/const version = `${versionMajorMinor}.0-${{ github.event.client_payload.core_tag || 'dev' }}`/g' src/compiler/corePublic.ts
2626
npm ci
2727
gulp LKG
2828
npm test

.github/workflows/set-version.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts
2929
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts
3030
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
31-
sed -i -e 's/const version = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts
31+
sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts
3232
npm ci
3333
gulp LKG
3434
npm test

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ tests/baselines/reference/dt
8585
.failed-tests
8686
TEST-results.xml
8787
package-lock.json
88+
tests/cases/user/npm/npm
8889
tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
8990
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
9091
tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ scripts
1010
src
1111
tests
1212
Jakefile.js
13+
.devcontainer
1314
.eslintrc
1415
.eslintignore
1516
.editorconfig

.travis.yml

-28
This file was deleted.

CONTRIBUTING.md

+22-6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ In general, things we find useful when reviewing suggestions are:
7070

7171
## Tips
7272

73+
### Using a development container
74+
75+
This repository includes a [development container](https://code.visualstudio.com/docs/remote/containers) that you can use to quickly create an isolated development environment with all the tools you need to start working on TypeScript. To get started with a dev container and VS Code, either:
76+
77+
- Clone the TypeScript repository locally and use the `Open Folder in Container` command.
78+
- Use the `Clone Repository in Container Volume` command to clone the TypeScript repository into a new container.
79+
7380
### Faster clones
7481

7582
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`.
@@ -153,17 +160,17 @@ gulp runtests --tests=2dArrays
153160

154161
## Debugging the tests
155162

156-
You can debug with VS Code or Node instead with `gulp runtests --inspect`:
163+
You can debug with VS Code or Node instead with `gulp runtests -i`:
157164

158165
```Shell
159-
gulp runtests --tests=2dArrays --inspect
166+
gulp runtests --tests=2dArrays -i
160167
```
161168

162169
You can also use the [provided VS Code launch configuration](./.vscode/launch.template.json) to launch a debug session for an open test file. Rename the file 'launch.json', open the test file of interest, and launch the debugger from the debug panel (or press F5).
163170

164171
## Adding a Test
165172

166-
To add a new test case, add a `.ts` file in `tests\cases\compiler` with code that shows the your bug is now fixed, or your new feature now works.
173+
To add a new test case, add a `.ts` file in `tests\cases\compiler` with code that shows the bug is now fixed, or your new feature now works.
167174

168175
These files support metadata tags in the format `// @metaDataName: value`.
169176
The supported names and values are the same as those supported in the compiler itself, with the addition of the `fileName` flag.
@@ -189,16 +196,25 @@ import { f as g } from "file1";
189196
var x = g();
190197
```
191198

192-
## Managing the Baselines
199+
## Managing the baselines
193200

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.
201+
Most tests generate "baselines" to find differences in output.
202+
As an example, compiler tests usually emit one file each for
203+
204+
- the `.js` and `.d.ts` output (all in the same `.js` output file),
205+
- the errors produced by the compiler (in an `.errors.txt` file),
206+
- the types of each expression (in a `.types` file),
207+
- the symbols for each identifier (in a `.symbols` file), and
208+
- the source map outputs for files if a test opts into them (in a `.js.map` file).
195209

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

198212
```Shell
199-
gulp diff
213+
git diff --diff-filter=AM --no-index ./tests/baselines/reference ./tests/baselines/local
200214
```
201215

216+
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.
217+
202218
After verifying that the changes in the baselines are correct, run
203219

204220
```Shell

0 commit comments

Comments
 (0)