Skip to content

Commit 4f856a3

Browse files
committed
docs: clarify docs to help AI work smoothly
1 parent d4a80c2 commit 4f856a3

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

.clinerules

+12
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,15 @@ This project is structured differently from ordinary TypeScript projects. Carefu
99
## Original TypeScript type definitions
1010

1111
Please do not try to read the original type definitions from TypeScript. Those may be very large and you cannot read it. Instead, ask the user to provide relevant code snippets from the original type definitions.
12+
13+
# Development
14+
15+
## Modifying the type definitions
16+
17+
Modify the type definitions in the `lib/` directory to implement an improvement to the standard library.
18+
19+
Note: while editing the files in `lib/`, you may see TypeScript errors. However, these errors are expected because the type definitions in `lib/` are incomplete. Do not worry too much about these errors. Instead, focus on test results to ensure that your changes are correct.
20+
21+
## Adding tests
22+
23+
When you modify the type definitions, you should add tests to ensure that your changes are correct. Add tests to the `test/` directory. Read the CONTRIBUTING.md file to understand how to run the tests.

CONTRIBUTING.md

+26-9
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,42 @@ interface A {
5757

5858
For other declarations, such as type aliases, enums, and namespaces, the replacement is done on per-name basis. If our definition includes an `A` type alias, the entire declaration of `A` is replaced with ours.
5959

60-
### Committing Build Artifacts
60+
#### Precisely duplicate the interface shape
6161

62-
Currently, build artifacts need to be committed. Follow the steps below to build and commit them.
62+
Note that if you are to replace a field of an interface that has type parameters or an `extends` clause, you need to duplicate the entire interface shape for the partial replacement to work.
6363

64-
1. `npm run build:tsc`
65-
2. `npm run build:lib`
66-
3. `npm run build:diff`
67-
4. Commit the build artifacts
64+
```ts
65+
// Original
66+
interface A<T> extends Base<T> {
67+
field1: T;
68+
field2: number;
69+
}
70+
71+
// Our lib/ definition
72+
interface A<T> extends Base<T> {
73+
field1: SomeRefinedType;
74+
}
75+
```
6876

6977
### How to Run Tests
7078

7179
Follow below steps to run tests locally.
7280

73-
1. `npm run build:tsc`
74-
2. `npm run build:lib`
75-
3. `npm run build:package`
81+
1. `npm run build:tsc` (this is required only once, or when you change code in `build/`)
82+
2. `npm run build:lib` (this reflects the changes in `lib/` to `generated/`)
83+
3. `npm run build:package` (this puts the generated files in `package/`)
7684
4. `npm install` in tests directory
7785
5. `npm test` in tests directory
7886

87+
### Committing Build Artifacts
88+
89+
Currently, build artifacts need to be committed. Follow the steps below to build and commit them.
90+
91+
1. `npm run build:tsc`
92+
2. `npm run build:lib`
93+
3. `npm run build:diff`
94+
4. Commit the build artifacts
95+
7996
## Upgrading TypeScript version
8097

8198
Below is the procedure to upgrade TypeScript version.

0 commit comments

Comments
 (0)