Skip to content

Commit 29d4bb9

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/rest-param-using-mapped-type-over-union-constraint
# Conflicts: # src/compiler/checker.ts
2 parents ce8483c + 7f292bf commit 29d4bb9

File tree

6,331 files changed

+247903
-1006583
lines changed

Some content is hidden

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

6,331 files changed

+247903
-1006583
lines changed

.eslintrc.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"es6": true
1212
},
1313
"plugins": [
14-
"@typescript-eslint", "no-null", "import", "eslint-plugin-local"
14+
"@typescript-eslint", "no-null", "import", "eslint-plugin-local", "simple-import-sort"
1515
],
1616
"ignorePatterns": [
1717
"**/node_modules/**",
@@ -25,11 +25,8 @@
2525
"/coverage/**"
2626
],
2727
"rules": {
28-
"sort-imports": ["error", {
29-
"ignoreCase": true,
30-
"ignoreDeclarationSort": true,
31-
"allowSeparatedGroups": true
32-
}],
28+
"simple-import-sort/imports": "error",
29+
"simple-import-sort/exports": "error",
3330

3431
"@typescript-eslint/adjacent-overload-signatures": "error",
3532
"@typescript-eslint/array-type": "error",
@@ -180,6 +177,14 @@
180177
{ "name": "exports" }
181178
]
182179
}
180+
},
181+
{
182+
// These files contain imports in a specific order that are generally unsafe to modify.
183+
"files": ["**/_namespaces/**"],
184+
"rules": {
185+
"simple-import-sort/imports": "off",
186+
"simple-import-sort/exports": "off"
187+
}
183188
}
184189
]
185190
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.js linguist-language=TypeScript
2+
**/*.json linguist-language=jsonc
23
* -text

.github/fabricbot.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
{
3232
"name": "addReply",
3333
"parameters": {
34-
"comment": "Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, and @minestarks for you. Feel free to loop in other consumers/maintainers if necessary"
34+
"comment": "Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, @zkat, and @joj for you. Feel free to loop in other consumers/maintainers if necessary"
3535
}
3636
}
3737
],
@@ -487,7 +487,7 @@
487487
{
488488
"name": "addReply",
489489
"parameters": {
490-
"comment": "Thanks for the PR! It looks like you've changed 'preProcess.ts' in some way. Please ensure that any changes here don't break consumers with unique project systems such as Visual Studio. Pinging @sheetalkamat and @minestarks so they are aware of the changes."
490+
"comment": "Thanks for the PR! It looks like you've changed 'preProcess.ts' in some way. Please ensure that any changes here don't break consumers with unique project systems such as Visual Studio. Pinging @sheetalkamat, @zkat, and @joj so they are aware of the changes."
491491
}
492492
}
493493
]

.github/workflows/accept-baselines-fix-lints.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
run: |
1616
git config user.email "[email protected]"
1717
git config user.name "TypeScript Bot"
18-
npm install
19-
git rm -r --quiet tests/baselines/reference :^tests/baselines/reference/docker :^tests/baselines/reference/user
18+
npm ci
19+
git rm -r --quiet tests/baselines/reference
2020
npx hereby runtests-parallel --ci --fix || true
2121
npx hereby baseline-accept
2222
git add ./src

.github/workflows/ci.yml

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ jobs:
3939
- run: npm ci
4040

4141
- name: Tests
42-
run: npm run test -- --bundle=${{ matrix.bundle }}
42+
# run tests, but lint separately
43+
run: npm run test -- --no-lint --bundle=${{ matrix.bundle }}
4344

4445
lint:
4546
runs-on: ubuntu-latest
@@ -91,65 +92,76 @@ jobs:
9192

9293
steps:
9394
- uses: actions/checkout@v3
95+
9496
- uses: actions/setup-node@v3
9597
with:
9698
node-version: "*"
9799
check-latest: true
100+
- run: |
101+
corepack enable npm
102+
npm --version
103+
98104
- run: npm ci
99105

100106
- run: npx hereby lkg
101107
- run: |
102108
npm pack
103109
mv typescript*.tgz typescript.tgz
104-
echo "PACKAGE=$PWD/typescript.tgz" >> $GITHUB_ENV
110+
echo "package=$PWD/typescript.tgz" >> "$GITHUB_OUTPUT"
111+
id: pack
105112
106113
- name: Smoke test
107114
run: |
108115
cd "$(mktemp -d)"
109116
npm init --yes
110-
npm install $PACKAGE tslib
117+
npm install ${{ steps.pack.outputs.package }}
111118
112119
echo "Testing tsc..."
113120
npx tsc --version
114121
115122
echo "Testing tsserver..."
116123
echo '{"seq": 1, "command": "status"}' | npx tsserver
117124
118-
cat > smoke.js << 'EOF'
119-
console.log(`Testing ${process.argv[2]}...`);
120-
const { __importDefault, __importStar } = require("tslib");
121-
const ts = require(process.argv[2]);
122-
123-
// See: https://github.com/microsoft/TypeScript/pull/51474#issuecomment-1310871623
124-
const fns = [
125-
[() => ts.version, true],
126-
[() => ts.default.version, false],
127-
[() => __importDefault(ts).version, false],
128-
[() => __importDefault(ts).default.version, true],
129-
[() => __importStar(ts).version, true],
130-
[() => __importStar(ts).default.version, true],
131-
];
132-
133-
for (const [fn, shouldSucceed] of fns) {
134-
let success = false;
135-
try {
136-
success = !!fn();
137-
}
138-
catch {}
139-
const status = success ? "succeeded" : "failed";
140-
if (success === shouldSucceed) {
141-
console.log(`${fn.toString()} ${status} as expected.`);
142-
}
143-
else {
144-
console.log(`${fn.toString()} unexpectedly ${status}.`);
145-
process.exitCode = 1;
146-
}
147-
}
148-
console.log("ok");
149-
EOF
150-
151-
node ./smoke.js typescript
152-
node ./smoke.js typescript/lib/tsserverlibrary
125+
node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript
126+
node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript/lib/tsserverlibrary
127+
128+
package-size:
129+
runs-on: ubuntu-latest
130+
if: github.event_name == 'pull_request'
131+
132+
steps:
133+
- uses: actions/checkout@v3
134+
with:
135+
path: pr
136+
137+
- uses: actions/checkout@v3
138+
with:
139+
path: base
140+
ref: ${{ github.base_ref }}
141+
142+
- uses: actions/setup-node@v3
143+
with:
144+
node-version: "*"
145+
check-latest: true
146+
- run: |
147+
corepack enable npm
148+
npm --version
149+
150+
- run: npm ci
151+
working-directory: ./pr
152+
153+
- run: npm ci
154+
working-directory: ./base
155+
156+
- run: npx hereby lkg
157+
working-directory: ./pr
158+
159+
- run: npx hereby lkg
160+
working-directory: ./base
161+
162+
- run: |
163+
echo "See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID for more info."
164+
node ./pr/scripts/checkPackageSize.mjs ./base ./pr >> $GITHUB_STEP_SUMMARY
153165
154166
misc:
155167
runs-on: ubuntu-latest

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010

1111
steps:
1212
- uses: actions/setup-node@v3
13+
- run: |
14+
corepack enable npm
15+
npm --version
1316
- uses: actions/checkout@v3
1417
with:
1518
fetch-depth: 5

.github/workflows/nightly.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
with:
2020
# Use NODE_AUTH_TOKEN environment variable to authenticate to this registry.
2121
registry-url: https://registry.npmjs.org/
22+
- run: |
23+
corepack enable npm
24+
npm --version
2225
- name: Setup and publish nightly
2326
run: |
2427
npm whoami

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414
- uses: actions/setup-node@v3
15+
- run: |
16+
corepack enable npm
17+
npm --version
1518
- name: npm install and test
1619
run: |
1720
npm ci

.github/workflows/scorecard.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecard supply-chain security
6+
on:
7+
# For Branch-Protection check. Only the default branch is supported. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9+
branch_protection_rule:
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12+
schedule:
13+
- cron: '19 15 * * 4'
14+
push:
15+
branches: [ "main" ]
16+
17+
# Declare default permissions as read only.
18+
permissions: read-all
19+
20+
jobs:
21+
analysis:
22+
name: Scorecard analysis
23+
runs-on: ubuntu-latest
24+
permissions:
25+
# Needed to upload the results to code-scanning dashboard.
26+
security-events: write
27+
# Needed to publish results and get a badge (see publish_results below).
28+
id-token: write
29+
30+
steps:
31+
- name: "Checkout code"
32+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
33+
with:
34+
persist-credentials: false
35+
36+
- name: "Run analysis"
37+
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
38+
with:
39+
results_file: results.sarif
40+
results_format: sarif
41+
42+
# Publish results to OpenSSF REST API for easy access by consumers
43+
# Allows the repository to include the Scorecard badge.
44+
# See https://github.com/ossf/scorecard-action#publishing-results.
45+
publish_results: true
46+
47+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
48+
# format to the repository Actions tab.
49+
- name: "Upload artifact"
50+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
51+
with:
52+
name: SARIF file
53+
path: results.sarif
54+
retention-days: 5
55+
56+
# Upload the results to GitHub's code scanning dashboard.
57+
- name: "Upload to code-scanning"
58+
uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27
59+
with:
60+
sarif_file: results.sarif

.github/workflows/set-version.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
- uses: actions/checkout@v3
1414
with:
1515
ref: ${{ github.event.client_payload.branch_name }}
16+
- run: |
17+
corepack enable npm
18+
npm --version
1619
# notably, this is essentially the same script as `new-release-branch.yaml` (with fewer inputs), but it assumes the branch already exists
1720
# do note that executing the transform below will prevent the `configurePrerelease` script from running on the source, as it makes the
1821
# `version` identifier no longer match the regex it uses

.github/workflows/update-package-lock.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,23 @@ jobs:
1919
- uses: actions/setup-node@v3
2020
with:
2121
node-version: 16
22+
- run: |
23+
corepack enable npm
24+
npm --version
2225
23-
- name: Configure git and update package-lock.json
26+
- name: Update package-lock.json and push
2427
run: |
25-
git config user.email "[email protected]"
26-
git config user.name "TypeScript Bot"
2728
rm package-lock.json
28-
npm install --package-lock-only --ignore-scripts # This is a no-op if package-lock.json is present.
29+
npm install
2930
git add -f package-lock.json
30-
if git commit -m "Update package-lock.json"; then
31+
32+
if git diff --exit-code --name-only package-lock.json; then
33+
echo "No change."
34+
else
35+
npm test
36+
npx hereby lkg
37+
git config user.email "[email protected]"
38+
git config user.name "TypeScript Bot"
39+
git commit -m "Update package-lock.json"
3140
git push
3241
fi

.gitignore

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ node_modules/
22
.node_modules/
33
built/*
44
tests/cases/rwc/*
5-
tests/cases/test262/*
65
tests/cases/perf/*
76
!tests/cases/webharness/compilerToString.js
87
test-args.txt
@@ -14,7 +13,6 @@ tests/baselines/local.old/*
1413
tests/services/baselines/local/*
1514
tests/baselines/prototyping/local/*
1615
tests/baselines/rwc/*
17-
tests/baselines/test262/*
1816
tests/baselines/reference/projectOutput/*
1917
tests/baselines/local/projectOutput/*
2018
tests/baselines/reference/testresults.tap
@@ -34,7 +32,6 @@ tests/webTestServer.js.map
3432
tests/webhost/*.d.ts
3533
tests/webhost/webtsc.js
3634
tests/cases/**/*.js
37-
!tests/cases/docker/*.js/
3835
tests/cases/**/*.js.map
3936
*.config
4037
scripts/eslint/built/
@@ -59,29 +56,10 @@ internal/
5956
yarn.lock
6057
yarn-error.log
6158
.parallelperf.*
62-
tests/cases/user/*/package-lock.json
63-
tests/cases/user/*/node_modules/
64-
tests/cases/user/*/**/*.js
65-
tests/cases/user/*/**/*.js.map
66-
tests/cases/user/*/**/*.d.ts
67-
!tests/cases/user/zone.js/
68-
!tests/cases/user/bignumber.js/
69-
!tests/cases/user/discord.js/
7059
tests/baselines/reference/dt
7160
.failed-tests
7261
TEST-results.xml
7362
package-lock.json
74-
tests/cases/user/npm/npm
75-
tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
76-
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
77-
tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
78-
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
79-
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
80-
tests/cases/user/create-react-app/create-react-app
81-
tests/cases/user/fp-ts/fp-ts
82-
tests/cases/user/webpack/webpack
83-
tests/cases/user/puppeteer/puppeteer
84-
tests/cases/user/axios-src/axios-src
85-
tests/cases/user/prettier/prettier
8663
.eslintcache
87-
*v8.log
64+
*v8.log
65+
lib/

.vscode/launch.template.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"env": {
4141
"NODE_ENV": "testing"
4242
},
43+
"outFiles": [
44+
"${workspaceFolder}/built/**/*.js",
45+
"${workspaceFolder}/built/**/*.mjs",
46+
"${workspaceFolder}/built/**/*.cjs",
47+
"!**/node_modules/**"
48+
],
4349
"sourceMaps": true,
4450
"smartStep": true,
4551
"preLaunchTask": "npm: build:tests",

0 commit comments

Comments
 (0)