Skip to content

Commit c9c3b02

Browse files
test(types): add dtslint test for attributes-to-props
1 parent 1bd1824 commit c9c3b02

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

test/types/lib/attributes-to-props.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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);

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
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
}

0 commit comments

Comments
 (0)