Skip to content

Commit 7969ef9

Browse files
HsuTinggajus
authored andcommitted
fix: fix throw error (#413)
1 parent d8a3729 commit 7969ef9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/rules/noDupeKeys.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ const create = (context) => {
4949

5050
const builObjectStructure = (properties) => {
5151
return _.map(properties, (property) => {
52-
const element = analizeElement(property.value);
52+
const element = analizeElement(
53+
property.type === 'ObjectTypeSpreadProperty' ?
54+
property.argument :
55+
property.value
56+
);
5357

5458
return {
5559
...element,

tests/rules/assertions/noDupeKeys.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ export default {
107107
},
108108
{
109109
code: 'var a = 1; var b = 1; type f = { get(key: a): string, get(key: b): string }'
110+
},
111+
{
112+
code: 'type a = { b: <C>(config: { ...C, key: string}) => C }'
110113
}
111114
]
112115
};

0 commit comments

Comments
 (0)