-
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.
Remove type assertions for Property and ObjectProperty (#921)
- Loading branch information
Showing
14 changed files
with
105 additions
and
155 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"aws-sdk-js-codemod": patch | ||
--- | ||
|
||
Remove type assertions for Property and ObjectProperty |
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
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; | ||
} | ||
} | ||
}; |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.