You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: A Go and TypeScript expert who can easily figure out how to port PRs from one language to another
4
+
---
5
+
6
+
This repository is a port of `microsoft/TypeScript` from TypeScript to Go. Since the port began, the following pull request was applied to microsoft/TypeScript. An equivalent change now needs to be applied here. The user will give you a link to the PR and you will need to try to port it to this repo.
7
+
8
+
Instructions
9
+
- Use `curl` to fetch e.g. `https://api.github.com/repos/microsoft/typescript/pulls/59767` to view the merge commit SHA
10
+
- Then use `curl` to fetch e.g. `https://github.com/microsoft/TypeScript/commit/bd3d70058c30253209199cc9dfeb85e72330d79b.patch` to download the diff patch
11
+
- Use Playwright MCP if you have other information from github you need, since you won't have MCP access to the TypeScript repo
12
+
- Apply the edits made in that PR to this codebase, translating them from TypeScript to Go.
13
+
- The change may or may not be applicable. It may have already been ported. Do not make any significant changes outside the scope of the diff. If the change cannot be applied without significant out-of-scope changes, explain why and stop working.
14
+
- Tip: search for functions and identifiers from the diff to find the right location to apply edits. Some files in microsoft/TypeScript have been split into multiple.
15
+
- Tip: some changes have already been ported, like changes to diagnostic message text. Tests do not need to be ported as they are imported from the submodule.
16
+
- Check that the code builds by running npx hereby build in the terminal.
17
+
- Run tests. It is expected that tests will fail due to baseline changes.
18
+
- Run `npx hereby test` in a terminal. They should fail with messages about baseline changes.
19
+
- Tip: to run a single baseline test from the submodule, run go test ./internal/testrunner -run '^TestSubmodule/NAME_OF_TEST_FILE'
20
+
- Run npx hereby baseline-accept to adopt the baseline changes.
21
+
- Run git diff 'testdata/**/*.diff'. If your change is correct, these diff files will be reduced or completely deleted.
22
+
- Iterate until you are satisfied with your change. Commit everything, including the baseline changes in testdata, and open a PR.
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+24-11Lines changed: 24 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,21 +9,34 @@ Most of our development takes place in the `internal` directory, and most behavi
9
9
10
10
Most development on the codebase is in Go.
11
11
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.
13
13
14
14
```sh
15
-
npx hereby build # Build the project
15
+
npx hereby build # Build the tsgo binary (not required for tests)
16
16
npx hereby test# Run tests
17
17
npx hereby format # Format the code
18
18
npx hereby lint # Run linters
19
19
20
20
# 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
23
+
```
24
+
25
+
Always make sure code is formatted, linted, and tested before sending a pull request.
26
+
27
+
<critical>
28
+
YOU MUST RUN THESE COMMANDS AT THE END OF YOUR SESSION!
29
+
IF THESE COMMANDS FAIL, CI WILL FAIL, AND YOUR PR WILL BE REJECTED OUT OF HAND.
30
+
FIXING ERRORS FROM THESE COMMANDS IS YOUR HIGHEST PRIORITY.
31
+
ENSURE YOU DO THE RIGHT THINGS TO MAKE THEM PASS.
32
+
```sh
33
+
npx hereby build # Build the project
34
+
npx hereby test# Run tests
35
+
npx hereby lint # Run linters
36
+
npx hereby format # Format the code
23
37
```
38
+
</critical>
24
39
25
-
Always make sure code is formatted, linted, and tested before sending a pull request.
26
-
27
40
## Compiler Features, Fixes, and Tests
28
41
29
42
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 +69,10 @@ export interface Person {
56
69
function greet(person) {
57
70
console.log(`Hello, ${person.name}!`);
58
71
}
59
-
```
60
-
61
-
**New compiler tests should always enable strict mode (`@strict: true`) unless the bug specifically involves non-strict mode behavior.**
62
-
72
+
```
73
+
74
+
**New compiler tests should always enable strict mode (`@strict: true`) unless the bug specifically involves non-strict mode behavior.**
75
+
63
76
Tests don't always need the above `@option`s specified, but they are common to specify or modify.
64
77
Tests can be run with multiple settings for a given option by using a comma-separated list (e.g. `@option: settingA,settingB`).
65
78
`@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).
@@ -96,4 +109,4 @@ The TypeScript submodule serves as the reference implementation for behavior and
96
109
# Other Instructions
97
110
98
111
- Do not add or change existing dependencies unless asked to.
99
-
112
+
- Do not remove any debug assertions or panic calls. Existing assertions are never too strict or incorrect.
0 commit comments