UNPKG
@discostudioteam/react-code-blocks
Version:
latest (0.1.1-0)
0.1.1-0
0.1.0-0
0.0.2-0
0.0.1-0
Modified rajinwonderland's modification of Atlaskit's Code Block!
@discostudioteam/react-code-blocks
/
src
/
hooks
/
with-defaults.ts
13 lines
(10 loc)
•
305 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
import
React
from
'react'
;
const
withDefaults = <P,
DP
>
(
component
:
React
.
ComponentType
<P>,
defaultProps
: DP
) =>
{
type
Props
=
Partial
<
DP
> &
Omit
<P, keyof
DP
>; component.
defaultProps
= defaultProps;
return
component
as
React
.
ComponentType
<
Props
>; };
export
default
withDefaults;