Skip to content

Commit 6f1e7af

Browse files
authored
Merge pull request #1147 from primer/colebemis/replace-index.d.ts
Replace index.d.ts with generated type definitions
2 parents 7a4a226 + db47820 commit 6f1e7af

File tree

12 files changed

+142
-962
lines changed

12 files changed

+142
-962
lines changed

.changeset/clever-dancers-nail.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
"@primer/components": major
3+
---
4+
5+
Type definitions are now being generated by TypeScript instead of manually maintained. These new type definitions may differ from the previous type definitions and cause breaking changes. If you experience any new TypeScript errors, feel free to create an [issue](https://github.com/primer/components/issues) or reach out in Slack (#design-systems).
6+
7+
### Breaking changes
8+
9+
* The following types are no longer exported:
10+
11+
```
12+
BaseProps
13+
UseDetailsProps
14+
AnchoredPositionHookSettings
15+
AnchorAlignment
16+
AnchorSide
17+
PositionSettings
18+
PaginationHrefBuilder
19+
PaginationPageChangeCallback
20+
PositionComponentProps
21+
```
22+
23+
* Props are now defined with types instead of interfaces which means in some cases you may not be able to create interfaces that `extend` them. To work around this issue, you may need to convert your interfaces to types:
24+
25+
```diff
26+
import {BoxProps} from '@primer/components'
27+
28+
- interface MyFancyBox extends BoxProps {...}
29+
+ type MyFancyBox = BoxProps & {...}
30+
```
31+
32+
* Some components now expect more specific ref types. For example:
33+
34+
```diff
35+
- const ref = React.useRef<HTMLElement>(null)
36+
+ const ref = React.useRef<HTMLButtonElement>(null)
37+
38+
return <Button ref={ref}>...</Button>
39+
```

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ lib/
88
lib-esm/
99
public/
1010
stats.html
11-
types

0 commit comments

Comments
 (0)