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: README.md
+27
Original file line number
Diff line number
Diff line change
@@ -821,6 +821,33 @@ partialStateUpdate({foo: 2}) // this works
821
821
Note that there are some TS users who don't agree with using `Partial` as it behaves today. See [subtle pitfalls of the above example here](https://twitter.com/ferdaber/status/1084798596027957248), and check out this long discussion on [why @types/react uses Pick instead of Partial](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365).
822
822
</details>
823
823
824
+
## The Types I need weren't exported!
825
+
826
+
This can be annoying but here are ways to grab the types!
827
+
828
+
- Grabbing the Prop types of a component: Use `typeof`, and optionally `Omit` any overlapping types
829
+
830
+
```tsx
831
+
import {Button} from 'library' // but doesn't export ButtonProps
832
+
type ButtonProps = React.ComponentProps<typeofButton> // grab your own
833
+
type AlertButtonProps = Omit<ButtonProps, 'onClick'> // modify
0 commit comments