Skip to content

Commit 9c19ea7

Browse files
committed
chore: remove type assertion in getRequireDeclaratorsWithObjectPattern
1 parent 66c6361 commit 9c19ea7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/transforms/v2-to-v3/modules/getRequireDeclaratorsWithObjectPattern.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import type { Collection, JSCodeshift, ObjectProperty, Property } from "jscodeshift";
1+
import type { Collection, JSCodeshift } from "jscodeshift";
22

3-
import { OBJECT_PROPERTY_TYPE_LIST } from "../config";
43
import { getRequireDeclarators } from "./requireModule";
54

65
export interface GetRequireDeclaratorsWithObjectPattern {
@@ -19,8 +18,9 @@ export const getRequireDeclaratorsWithObjectPattern = (
1918
}
2019
const { properties } = declarator.value.id;
2120
return properties.some((property) => {
22-
if (!OBJECT_PROPERTY_TYPE_LIST.includes(property.type)) return false;
23-
const propertyValue = (property as Property | ObjectProperty).value;
24-
return propertyValue.type === "Identifier" && propertyValue.name === identifierName;
21+
if (property.type !== "Property" && property.type !== "ObjectProperty") {
22+
return false;
23+
}
24+
return property.value.type === "Identifier" && property.value.name === identifierName;
2525
});
2626
});

0 commit comments

Comments
 (0)