Skip to content

Commit e1c1466

Browse files
committed
Merge branch 'main' of https://github.com/microsoft/typescript-go into fix/1374
2 parents 88a3b75 + ed2d8c9 commit e1c1466

File tree

19,244 files changed

+441894
-568562
lines changed

Some content is hidden

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

19,244 files changed

+441894
-568562
lines changed

.custom-gcl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/custom-gcl.jsonschema.json
22

3-
version: v2.3.0
3+
version: v2.5.0
44

55
destination: ./_tools
66

.dprint.jsonc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@
3939
},
4040
"exec": {
4141
"cwd": "${configDir}",
42-
"cacheKey": "4",
4342
"commands": [
44-
{ "command": "go tool mvdan.cc/gofumpt -lang=go1.24", "exts": ["go"] }
43+
{ "command": "go tool mvdan.cc/gofumpt", "exts": ["go"], "cacheKeyFiles": ["go.mod"] }
4544
]
4645
},
4746
"excludes": [
@@ -59,9 +58,9 @@
5958
// Note: if adding new languages, make sure settings.template.json is updated too.
6059
// Also, if updating typescript, update the one in package.json.
6160
"plugins": [
62-
"https://plugins.dprint.dev/typescript-0.95.8.wasm",
61+
"https://plugins.dprint.dev/typescript-0.95.11.wasm",
6362
"https://plugins.dprint.dev/json-0.20.0.wasm",
6463
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.1.wasm",
65-
"https://plugins.dprint.dev/exec-0.5.1.json@492414e39dea4dccc07b4af796d2f4efdb89e84bae2bd4e1e924c0cc050855bf"
64+
"https://plugins.dprint.dev/exec-0.6.0.json@a054130d458f124f9b5c91484833828950723a5af3f8ff2bd1523bd47b83b364"
6665
]
6766
}

.github/actions/setup-go/action.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Setup Go
44
inputs:
55
go-version:
66
description: Go version range to set up.
7-
default: '>=1.24.0'
7+
default: '>=1.25.0'
88
create:
99
description: Create the cache
1010
default: 'false'
@@ -18,7 +18,7 @@ runs:
1818
steps:
1919
- name: Install Go
2020
id: install-go
21-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
21+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
2222
with:
2323
go-version: ${{ inputs.go-version }}
2424
cache: false
@@ -39,15 +39,15 @@ runs:
3939
4040
- if: ${{ inputs.create != 'true' }}
4141
name: Restore Go modules
42-
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
42+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
4343
with:
4444
key: ${{ steps.cache-info.outputs.modules-key }}
4545
path: |
4646
~/go/pkg/mod
4747
4848
- if: ${{ inputs.create != 'true' }}
4949
name: Restore Go build cache
50-
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
50+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
5151
with:
5252
key: unused-key-${{ github.run_id }}
5353
restore-keys: ${{ steps.cache-info.outputs.build-key }}-
@@ -58,7 +58,7 @@ runs:
5858
5959
- if: ${{ inputs.create != 'true' && inputs.lint-cache == 'true' }}
6060
name: Restore golangci-lint cache
61-
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
61+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
6262
with:
6363
key: unused-key-${{ github.run_id }}
6464
restore-keys: ${{ steps.cache-info.outputs.lint-key }}-
@@ -89,8 +89,13 @@ runs:
8989

9090
- if: ${{ inputs.create == 'true' }}
9191
shell: bash
92+
id: setup-go-test
9293
run: npx hereby test
9394

95+
- if: ${{ failure() && inputs.create == 'true' && steps.setup-go-test.conclusion == 'failure' }}
96+
shell: bash
97+
run: git diff --diff-filter=AM --no-index ./testdata/baselines/reference ./testdata/baselines/local
98+
9499
- if: ${{ inputs.create == 'true' }}
95100
shell: bash
96101
run: npx hereby test --coverage
@@ -109,15 +114,15 @@ runs:
109114

110115
- if: ${{ inputs.create == 'true' }}
111116
name: Save Go modules
112-
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
117+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
113118
with:
114119
key: ${{ steps.cache-info.outputs.modules-key }}
115120
path: |
116121
~/go/pkg/mod
117122
118123
- if: ${{ inputs.create == 'true' }}
119124
name: Save Go build cache
120-
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
125+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
121126
with:
122127
key: ${{ steps.cache-info.outputs.build-key }}-${{ github.run_id }}
123128
path: |
@@ -127,7 +132,7 @@ runs:
127132
128133
- if: ${{ inputs.create == 'true' }}
129134
name: Save golangci-lint cache
130-
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
135+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
131136
with:
132137
key: ${{ steps.cache-info.outputs.lint-key }}-${{ github.run_id }}
133138
path: ${{ env.GOLANGCI_LINT_CACHE }}

.github/copilot-instructions.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ Most of our development takes place in the `internal` directory, and most behavi
99

1010
Most development on the codebase is in Go.
1111
Standard Go commands and practices apply, but we primarily use a tool called `hereby` to build, run tests, and other tasks.
12-
Run `npx hereby --list` to see all available commands.
12+
Run `npx hereby --tasks` to see all available commands.
1313

1414
```sh
15-
npx hereby build # Build the project
15+
npx hereby build # Build the tsgo binary (not required for tests)
1616
npx hereby test # Run tests
1717
npx hereby format # Format the code
1818
npx hereby lint # Run linters
1919

2020
# To run a specific compiler test:
21-
go test -run='TestSubmodule/<test name>' ./internal/testrunner # For submodule tests in _submodules/TypeScript
22-
go test -run='TestLocal/<test name>' ./internal/testrunner # For local tests in testdata/tests/cases
21+
go test -run='TestSubmodule/<test name>' ./internal/testrunner # For pre-existing "submodule" tests in _submodules/TypeScript
22+
go test -run='TestLocal/<test name>' ./internal/testrunner # For new "local" tests created in testdata/tests/cases
2323
```
2424

25-
Always make sure code is formatted, linted, and tested before sending a pull request.
26-
25+
Always make sure code is formatted, linted, and tested before sending a pull request.
26+
2727
## Compiler Features, Fixes, and Tests
2828

2929
When fixing a bug or implementing a new feature, at least one minimal test case should always be added in advance to verify the fix.
@@ -56,10 +56,10 @@ export interface Person {
5656
function greet(person) {
5757
console.log(`Hello, ${person.name}!`);
5858
}
59-
```
60-
61-
**New compiler tests should always enable strict mode (`@strict: true`) unless the bug specifically involves non-strict mode behavior.**
62-
59+
```
60+
61+
**New compiler tests should always enable strict mode (`@strict: true`) unless the bug specifically involves non-strict mode behavior.**
62+
6363
Tests don't always need the above `@option`s specified, but they are common to specify or modify.
6464
Tests can be run with multiple settings for a given option by using a comma-separated list (e.g. `@option: settingA,settingB`).
6565
`@filename` is only required when a test has multiple files, or when writing a test for a single JavaScript file (where `allowJs` or `checkJs` is enabled).

.github/workflows/ci.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
build:
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
27+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
28+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
2929
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
3030
- uses: ./.github/actions/setup-go
3131

@@ -44,8 +44,8 @@ jobs:
4444
extension:
4545
runs-on: ubuntu-latest
4646
steps:
47-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
48-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
47+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
48+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
4949
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
5050

5151
- run: npm ci
@@ -102,10 +102,10 @@ jobs:
102102
- run: git config --system core.longpaths true
103103
if: ${{ matrix.config.os == 'windows-latest' }}
104104

105-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
105+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
106106
with:
107107
submodules: ${{ !matrix.config.no-submodules }}
108-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
108+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
109109
with:
110110
node-version: 'lts/*'
111111
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
@@ -142,7 +142,7 @@ jobs:
142142

143143
- run: git add .
144144

145-
- uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
145+
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
146146
if: ${{ always() && matrix.config.coverage && github.event_name != 'merge_group' }}
147147
with:
148148
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
@@ -191,8 +191,8 @@ jobs:
191191
TSGO_HEREBY_NOEMBED: ${{ (matrix.config.noembed && 'true') || 'false' }}
192192

193193
steps:
194-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
195-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
194+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
195+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
196196
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
197197
- uses: ./.github/actions/setup-go
198198
with:
@@ -214,8 +214,8 @@ jobs:
214214
format:
215215
runs-on: ubuntu-latest
216216
steps:
217-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
218-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
217+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
218+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
219219
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
220220
- uses: ./.github/actions/setup-go
221221

@@ -226,10 +226,10 @@ jobs:
226226
generate:
227227
runs-on: ubuntu-latest
228228
steps:
229-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
229+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
230230
with:
231231
submodules: true
232-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
232+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
233233
with:
234234
node-version: '>=22.16.0'
235235
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
@@ -251,7 +251,7 @@ jobs:
251251
tidy:
252252
runs-on: ubuntu-latest
253253
steps:
254-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
254+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
255255
- uses: ./.github/actions/setup-go
256256

257257
- run: go mod tidy -diff
@@ -260,10 +260,10 @@ jobs:
260260
smoke:
261261
runs-on: ubuntu-latest
262262
steps:
263-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
263+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
264264
with:
265265
submodules: true
266-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
266+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
267267
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
268268
- uses: ./.github/actions/setup-go
269269

@@ -288,18 +288,18 @@ jobs:
288288
misc:
289289
runs-on: ubuntu-latest
290290
steps:
291-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
291+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
292292
- uses: ./.github/actions/setup-go
293293

294294
- run: go -C ./_tools run ./cmd/checkmodpaths $PWD
295295

296296
baselines:
297297
runs-on: ubuntu-latest
298298
steps:
299-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
299+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
300300
with:
301301
submodules: true
302-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
302+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
303303
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
304304
- uses: ./.github/actions/setup-go
305305

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ jobs:
4444

4545
steps:
4646
- name: Checkout repository
47-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4848

4949
# Initializes the CodeQL tools for scanning.
5050
- name: Initialize CodeQL
51-
uses: github/codeql-action/init@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
51+
uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
5252
with:
5353
config-file: ./.github/codeql/codeql-configuration.yml
5454
# Override language selection by uncommenting this and choosing your languages
@@ -58,7 +58,7 @@ jobs:
5858
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5959
# If this step fails, then you should remove it and run the build manually (see below).
6060
- name: Autobuild
61-
uses: github/codeql-action/autobuild@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
61+
uses: github/codeql-action/autobuild@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
6262

6363
# ℹ️ Command-line programs to run using the OS shell.
6464
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -72,4 +72,4 @@ jobs:
7272
# make release
7373

7474
- name: Perform CodeQL Analysis
75-
uses: github/codeql-action/analyze@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
75+
uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5

.github/workflows/copilot-setup-steps.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ jobs:
1616
# You can define any steps you want, and they will run before the agent starts.
1717
# If you do not check out your code, Copilot will do this for you.
1818
steps:
19-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2020
with:
2121
submodules: true
22-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
22+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
2323
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
2424
- uses: ./.github/actions/setup-go
2525
with:
26-
# Updated to 1.25.0-rc.1 to improve compilation time
27-
go-version: '>=1.25.0-rc.1'
2826
lint-cache: 'true'
2927
- run: npm i -g @playwright/[email protected]
3028
- run: npm ci

.github/workflows/create-cache.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,18 @@ jobs:
2828
- windows-latest
2929
- macos-latest
3030
go-version:
31-
- '>=1.24.0'
32-
33-
include:
34-
# Temporary for the Copilot setup steps
35-
- os: ubuntu-latest
36-
go-version: '>=1.25.0-rc.1'
31+
- '>=1.25.0'
3732

3833
runs-on: ${{ matrix.os }}
3934

4035
steps:
4136
- run: git config --system core.longpaths true
4237
if: ${{ matrix.os == 'windows-latest' }}
4338

44-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4540
with:
4641
submodules: true
47-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
42+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
4843
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
4944

5045
- uses: ./.github/actions/setup-go

0 commit comments

Comments
 (0)