Skip to content

Commit e2bee5f

Browse files
committed
docs: fix outdated explanation for contributing type definitions
1 parent 58a19ca commit e2bee5f

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

CONTRIBUTING.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,30 @@ Below are the guidelines for submitting a pull request.
2424

2525
better-typescript-lib replaces the built-in type definitions with its own ones. The renewed definitions are in the `lib/` directory.
2626

27-
Replacement is done on per-name basis; if our definition includes an `A` interface, the entire declaration of `A` is replaced with ours. Other declarations are not affected and the original ones are kept.
28-
29-
### Commiting Build Artifacts
27+
For interfaces, replacement is done on per-field basis. As illustrated below, if our definition includes an `A` interface with a `field1` field, the original `field1` type of the `A` interface is replaced with our definition. Other fields are not affected and the original ones are kept.
28+
29+
```ts
30+
// Original
31+
interface A {
32+
field1: string;
33+
field2: number;
34+
}
35+
36+
// Our lib/ definition
37+
interface A {
38+
field1: SomeRefinedType;
39+
}
40+
41+
// Result
42+
interface A {
43+
field1: SomeRefinedType;
44+
field2: number;
45+
}
46+
```
47+
48+
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.
49+
50+
### Committing Build Artifacts
3051

3152
Currently, build artifacts needs to be committed. Follow the following steps to build and commit them.
3253

0 commit comments

Comments
 (0)