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 11// TypeScript Version: 4.1
22
33export type Attributes = Record < string , string > ;
4- export type Props = Attributes ;
4+
5+ export type Props = Record < string , string > & {
6+ style : Record < string , string > ;
7+ } ;
58
69/**
710 * 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 2020 " index.d.ts" ,
2121 " lib/dom-to-react.d.ts" ,
2222 " test/types/index.tsx" ,
23+ " test/types/lib/attributes-to-props.ts" ,
2324 " test/types/lib/dom-to-react.tsx"
2425 ]
2526}
You can’t perform that action at this time.
0 commit comments