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
Copy file name to clipboardExpand all lines: .clinerules
+12
Original file line number
Diff line number
Diff line change
@@ -9,3 +9,15 @@ This project is structured differently from ordinary TypeScript projects. Carefu
9
9
## Original TypeScript type definitions
10
10
11
11
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.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+26-9
Original file line number
Diff line number
Diff line change
@@ -57,25 +57,42 @@ interface A {
57
57
58
58
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.
59
59
60
-
###Committing Build Artifacts
60
+
#### Precisely duplicate the interface shape
61
61
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.
63
63
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
+
interfaceA<T> extendsBase<T> {
67
+
field1:T;
68
+
field2:number;
69
+
}
70
+
71
+
// Our lib/ definition
72
+
interfaceA<T> extendsBase<T> {
73
+
field1:SomeRefinedType;
74
+
}
75
+
```
68
76
69
77
### How to Run Tests
70
78
71
79
Follow below steps to run tests locally.
72
80
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/`)
76
84
4.`npm install` in tests directory
77
85
5.`npm test` in tests directory
78
86
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
+
79
96
## Upgrading TypeScript version
80
97
81
98
Below is the procedure to upgrade TypeScript version.
0 commit comments