-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove type assertion in getWaiterConfig
- Loading branch information
Showing
1 changed file
with
5 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
import type { ObjectExpression, ObjectProperty, Property } from "jscodeshift"; | ||
|
||
import { OBJECT_PROPERTY_TYPE_LIST } from "../config"; | ||
import type { ObjectExpression } from "jscodeshift"; | ||
|
||
export const getWaiterConfig = (originalConfig: ObjectExpression): ObjectExpression | undefined => { | ||
for (const property of originalConfig.properties) { | ||
if (!OBJECT_PROPERTY_TYPE_LIST.includes(property.type)) { | ||
if (property.type !== "Property" && property.type !== "ObjectProperty") { | ||
continue; | ||
} | ||
const propertyKey = (property as Property | ObjectProperty).key; | ||
const propertyValue = (property as Property | ObjectProperty).value; | ||
if (propertyKey.type !== "Identifier" || propertyValue.type !== "ObjectExpression") { | ||
if (property.key.type !== "Identifier" || property.value.type !== "ObjectExpression") { | ||
continue; | ||
} | ||
if (propertyKey.name === "$waiter") { | ||
return propertyValue; | ||
if (property.key.name === "$waiter") { | ||
return property.value; | ||
} | ||
} | ||
}; |