diff --git a/packages/backpack-web/src/bpk-component-modal/src/customPropTypes-test.js b/packages/backpack-web/src/bpk-component-modal/src/customPropTypes-test.ts similarity index 99% rename from packages/backpack-web/src/bpk-component-modal/src/customPropTypes-test.js rename to packages/backpack-web/src/bpk-component-modal/src/customPropTypes-test.ts index 045a98d5ee..5b8f4110ea 100644 --- a/packages/backpack-web/src/bpk-component-modal/src/customPropTypes-test.js +++ b/packages/backpack-web/src/bpk-component-modal/src/customPropTypes-test.ts @@ -16,8 +16,6 @@ * limitations under the License. */ -/* @flow strict */ - import { titlePropType, onClosePropType } from './customPropTypes'; describe('titlePropType', () => { diff --git a/packages/backpack-web/src/bpk-component-modal/src/customPropTypes.js b/packages/backpack-web/src/bpk-component-modal/src/customPropTypes.ts similarity index 78% rename from packages/backpack-web/src/bpk-component-modal/src/customPropTypes.js rename to packages/backpack-web/src/bpk-component-modal/src/customPropTypes.ts index 35512ada10..d336c1ecb8 100644 --- a/packages/backpack-web/src/bpk-component-modal/src/customPropTypes.js +++ b/packages/backpack-web/src/bpk-component-modal/src/customPropTypes.ts @@ -16,13 +16,20 @@ * limitations under the License. */ -/* @flow strict */ +type ValidatorProps = { + showHeader?: boolean; + title?: string; + onClose?: () => void; + [key: string]: unknown; +}; -export const titlePropType = ( - props: Object, +export type Validator = ( + props: ValidatorProps, propName: string, componentName: string, -): ?Error => { +) => Error | null; + +export const titlePropType: Validator = (props, propName, componentName) => { const titleValue = props[propName]; if (props.showHeader && (!titleValue || typeof titleValue !== 'string')) { @@ -34,11 +41,7 @@ export const titlePropType = ( return null; }; -export const onClosePropType = ( - props: Object, - propName: string, - componentName: string, -): ?Error => { +export const onClosePropType: Validator = (props, propName, componentName) => { const onCloseValue = props[propName]; if (