diff --git a/src/component/componentProps.ts b/src/component/componentProps.ts index f66af446..7abf0d4b 100644 --- a/src/component/componentProps.ts +++ b/src/component/componentProps.ts @@ -69,11 +69,13 @@ type InferPropType = T extends null : ExtractCorrectPropType : T -export type ExtractPropTypes = O extends object - ? { [K in RequiredKeys]: InferPropType } & { - [K in OptionalKeys]?: InferPropType - } - : { [K in string]: any } +export type ExtractPropTypes = { + // use `keyof Pick>` instead of `RequiredKeys` to support IDE features + [K in keyof Pick>]: InferPropType +} & { + // use `keyof Pick>` instead of `OptionalKeys` to support IDE features + [K in keyof Pick>]?: InferPropType +} type DefaultKeys = { [K in keyof T]: T[K] extends @@ -93,5 +95,6 @@ type DefaultKeys = { // extract props which defined with default from prop options export type ExtractDefaultPropTypes = O extends object - ? { [K in DefaultKeys]: InferPropType } + ? // use `keyof Pick>` instead of `DefaultKeys` to support IDE features + { [K in keyof Pick>]: InferPropType } : {}