Skip to content

Commit e149cc3

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix/46149
* upstream/main: (473 commits) Correct node used for isDefinition calculation (microsoft#48499) fix(48405): emit dummy members from a mapped type (microsoft#48481) CFA for dependent parameters typed by generic constraints (microsoft#48411) No contextual typing from return types for boolean literals (microsoft#48380) fix(47733): omit JSDoc comment template suggestion on node with existing JSDoc (microsoft#47748) Ensure that we copy empty NodeArrays during transform (microsoft#48490) Add a new compiler option `moduleSuffixes` to expand the node module resolver's search algorithm (microsoft#48189) feat(27615): Add missing member fix should work for type literals (microsoft#47212) Add label details to completion entry (microsoft#48429) Enable method signature completion for object literals (microsoft#48168) Fix string literal completions when a partially-typed string fixes inference to a type parameter (microsoft#48410) fix(48445): show errors on type-only import/export specifiers in JavaScript files (microsoft#48449) Fix newline inserted in empty block at end of formatting range (microsoft#48463) Prevent looking up symbol for as const from triggering an error (microsoft#48464) Revise accessor resolution logic and error reporting (microsoft#48459) fix(48166): skip checking module.exports in a truthiness call expression (microsoft#48337) LEGO: Merge pull request 48450 LEGO: Merge pull request 48436 fix(48031): show circularity error for self referential get accessor annotations (microsoft#48050) Revert "Fix contextual discrimination for omitted members (microsoft#43937)" (microsoft#48426) ...
2 parents 553dfef + 70585aa commit e149cc3

File tree

3,111 files changed

+184945
-103742
lines changed

Some content is hidden

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

3,111 files changed

+184945
-103742
lines changed

.devcontainer/devcontainer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
}
88
},
99
"settings": {
10-
"terminal.integrated.shell.linux": "/bin/bash"
10+
"terminal.integrated.defaultProfile.linux": "bash",
11+
"terminal.integrated.profiles.linux": {
12+
"bash": {
13+
"path": "/bin/bash",
14+
"icon": "terminal-bash",
15+
},
16+
},
1117
},
1218
"extensions": [
1319
"dbaeumer.vscode-eslint"

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ about: Create a report to help us improve TypeScript
44
title: ''
55
labels: ''
66
assignees: ''
7+
78
---
9+
810
# Bug Report
911

1012
<!--

.github/ISSUE_TEMPLATE/Feature_request.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ about: Suggest an idea
44
title: ''
55
labels: ''
66
assignees: ''
7+
78
---
9+
810
# Suggestion
911

1012
<!--

.github/ISSUE_TEMPLATE/lib_change.md

Lines changed: 58 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,58 @@
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-
-->
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`,
4+
etc.
5+
title: ''
6+
labels: ''
7+
assignees: ''
8+
9+
---
10+
11+
# lib Update Request
12+
13+
<!--
14+
Please fill in each section completely. Thank you!
15+
16+
Are you here for one of these commonly-requested lib changes?
17+
* Object.keys - see https://stackoverflow.com/questions/55012174/
18+
* Array methods - see https://github.com/microsoft/TypeScript/issues/36554
19+
* parseInt, parseFloat, isFinite, isNaN, etc. - see https://github.com/microsoft/TypeScript/issues/4002
20+
21+
The DOM lib is maintained elsewhere and you can skip a step by filing issues/PRs for the DOM at that repo.
22+
See https://github.com/microsoft/TypeScript-DOM-lib-generator
23+
-->
24+
25+
## Configuration Check
26+
27+
<!--
28+
If you're missing common new methods like Array.includes, you may have a misconfigured project.
29+
Try setting `lib: "es2020"` and checking whether the type you want is present.
30+
You can diagnose further by running `tsc` with `--listFilesOnly` or `--showConfig`.
31+
32+
Conversely, if you are seeing built-in methods you expect to *not* see, check your 'lib' setting
33+
or review your dependencies for lib/reference directives that might be polluting
34+
your global scope. This is common when using the 'node' type library. See https://github.com/microsoft/TypeScript/issues/40184
35+
36+
Replace the text below:
37+
-->
38+
My compilation *target* is `ES2015` and my *lib* is `the default`.
39+
40+
## Missing / Incorrect Definition
41+
42+
<!--
43+
What property, method, function, etc is missing or incorrect?
44+
-->
45+
46+
## Sample Code
47+
48+
<!--
49+
What's some code using this that should work, but doesn't?
50+
-->
51+
52+
## Documentation Link
53+
54+
<!--
55+
Link to relevant documentation (e.g. MDN, W3C, ECMAScript Spec) to consult for this property.
56+
Note that lib.dom.d.ts intentionally does not include browser-specific extensions
57+
or early experimental features.
58+
-->
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Types Not Correct in/with Callback
3+
about: TypeScript assuming the wrong type either after a callback runs, or within
4+
a callback
5+
title: ''
6+
labels: Duplicate
7+
assignees: ''
8+
9+
---
10+
11+
TypeScript has two narrowing-related behaviors that are both intentional. Please do not log additional bugs on this; see #9998 for more discussion.
12+
13+
The first is that *narrowings are not respected in callbacks*. In other words:
14+
```ts
15+
function fn(obj: { name: string | number }) {
16+
if (typeof obj.name === "string") {
17+
// Errors
18+
window.setTimeout(() => console.log(obj.name.toLowerCase());
19+
}
20+
}
21+
```
22+
This is intentional since the value of `obj.name` "could" change types between when the narrowing occurred and when the callback was invoke. See also #11498
23+
24+
The second is that *function calls do not reset narrowings*. In other words:
25+
```ts
26+
function fn(obj: { name: string | number }) {
27+
if (typeof obj.name === "string") {
28+
console.log("Here");
29+
// Does not error
30+
console.log(obj.name.toLowerCase());
31+
}
32+
}
33+
```
34+
This is intentional behavior, *even though `console.log` could have mutated obj*. This rule is consistently applied, even with the function is in-principle inspectable to actually have side effects
35+
```ts
36+
function fn(obj: { name: string | number }) {
37+
if (typeof obj.name === "string") {
38+
mut();
39+
// Does not error
40+
console.log(obj.name.toLowerCase());
41+
}
42+
43+
function mut() {
44+
obj.name = 42;
45+
}
46+
}
47+
```

.github/pr_owners.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ jessetrinity
1212
minestarks
1313
armanio123
1414
gabritto
15+
jakebailey
16+
DanielRosenwasser

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ Please verify that:
99
1010
Refer to CONTRIBUTING.MD for more details.
1111
https://github.com/Microsoft/TypeScript/blob/main/CONTRIBUTING.md
12+
13+
** Please don't send typo fixes! **
14+
Please don't send a PR solely for the purpose of fixing a typo, unless that
15+
typo truly hurts understanding of the text. Each PR represents work for the
16+
maintainers, and that work should provide commensurate value.
17+
18+
If you're interested in sending a PR, the issue tracker has many issues marked `help wanted`.
1219
-->
1320

1421
Fixes #
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Ensures that repos which are related to TypeScript but may not have regular commits
2+
# have their GitHub Actions scheduled jobs still active due to the 6 week timeout
3+
# on OSS repos. This has already triggered a few times with microsoft/TypeScript-Make-Monaco-Builds
4+
# so, better to automate keeping on top of it.
5+
6+
name: Related Repo Commit Bumps
7+
8+
on:
9+
schedule:
10+
# Monthly, https://crontab.guru/#0_0_*_1-12_*
11+
- cron: '0 0 1 * *'
12+
workflow_dispatch: {}
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Configure git
20+
run: |
21+
git config --global user.email "[email protected]"
22+
git config --global user.name "TypeScript Bot"
23+
24+
- uses: actions/checkout@v2
25+
with:
26+
repository: 'microsoft/TypeScript-Website'
27+
path: 'ts-site'
28+
29+
- name: Push Commit to TS Website
30+
run: |
31+
cd ts-site
32+
git commit --allow-empty -m "Monthly Bump"
33+
git config --unset-all http.https://github.com/.extraheader
34+
git push https://${{ secrets.TS_BOT_GITHUB_TOKEN }}@github.com/microsoft/TypeScript-Website.git
35+
36+
- uses: actions/checkout@v2
37+
with:
38+
repository: 'microsoft/TypeScript-Make-Monaco-Builds'
39+
path: 'monaco-builds'
40+
41+
- name: Push Commit to TS Make Monaco Builds
42+
run: |
43+
cd monaco-builds
44+
git commit --allow-empty -m "Monthly Bump"
45+
git config --unset-all http.https://github.com/.extraheader
46+
git push https://${{ secrets.TS_BOT_GITHUB_TOKEN }}@github.com/microsoft/TypeScript-Make-Monaco-Builds.git

.vscode/launch.template.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,15 @@
4848
"outFiles": [
4949
"${workspaceRoot}/built/local/run.js"
5050
],
51-
52-
// NOTE: To use this, you must switch the "type" above to "pwa-node". You may also need to follow the instructions
53-
// here: https://github.com/microsoft/vscode-js-debug#nightly-extension to use the js-debug nightly until
54-
// this feature is shipping in insiders or to a release:
55-
// "customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue"
51+
"customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue",
5652
},
5753
{
5854
// See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code
5955
"type": "node",
6056
"request": "attach",
6157
"name": "Attach to VS Code TS Server via Port",
6258
"processId": "${command:PickProcess}",
63-
64-
// NOTE: To use this, you must switch the "type" above to "pwa-node". You may also need to follow the instructions
65-
// here: https://github.com/microsoft/vscode-js-debug#nightly-extension to use the js-debug nightly until
66-
// this feature is shipping in insiders or to a release:
67-
// "customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue"
59+
"customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue",
6860
}
6961
]
7062
}

.vscode/settings.template.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
// contents into your existing settings.
33
{
44
"eslint.validate": [
5-
{
6-
"language": "typescript",
7-
"autoFix": true
8-
}
5+
"typescript"
96
],
107
"eslint.options": {
118
"rulePaths": ["./scripts/eslint/built/rules/"],
@@ -16,4 +13,4 @@
1613

1714
// To use the locally built compiler, after 'npm run build':
1815
// "typescript.tsdk": "built/local"
19-
}
16+
}

0 commit comments

Comments
 (0)