From 8024c0702bf3cdc2dc1e26d11312bf595b253915 Mon Sep 17 00:00:00 2001 From: Shean de Montigny-Desautels Date: Thu, 24 Feb 2022 15:09:55 -0500 Subject: [PATCH] fix(types): optional Boolean props as default props --- src/component/componentProps.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/component/componentProps.ts b/src/component/componentProps.ts index ed51d579..f66af446 100644 --- a/src/component/componentProps.ts +++ b/src/component/componentProps.ts @@ -76,7 +76,19 @@ export type ExtractPropTypes = O extends object : { [K in string]: any } type DefaultKeys = { - [K in keyof T]: T[K] extends { default: any } ? K : never + [K in keyof T]: T[K] extends + | { + default: any + } + | BooleanConstructor + | { type: BooleanConstructor } + ? T[K] extends { + type: BooleanConstructor + required: true + } + ? never + : K + : never }[keyof T] // extract props which defined with default from prop options