File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1
1
// TypeScript Version: 4.1
2
2
3
3
export type Attributes = Record < string , string > ;
4
- export type Props = Attributes ;
4
+
5
+ export type Props = Record < string , string > & {
6
+ style : Record < string , string > ;
7
+ } ;
5
8
6
9
/**
7
10
* Converts HTML/SVG DOM attributes to React props.
Original file line number Diff line number Diff line change
1
+ import attributesToProps , {
2
+ Attributes ,
3
+ Props
4
+ } from 'html-react-parser/lib/attributes-to-props' ;
5
+
6
+ let attributes : Attributes = { } ;
7
+
8
+ attributes = {
9
+ class : 'my-class' ,
10
+ style : 'color: #bada55; line-height: 42;'
11
+ } ;
12
+
13
+ // $ExpectType Props
14
+ const {
15
+ className,
16
+ style : { color, lineHeight }
17
+ } = attributesToProps ( attributes ) ;
Original file line number Diff line number Diff line change 20
20
" index.d.ts" ,
21
21
" lib/dom-to-react.d.ts" ,
22
22
" test/types/index.tsx" ,
23
+ " test/types/lib/attributes-to-props.ts" ,
23
24
" test/types/lib/dom-to-react.tsx"
24
25
]
25
26
}
You can’t perform that action at this time.
0 commit comments