Converter icon indicating copy to clipboard operation
Converter copied to clipboard

Unable to create Slinky component for antd Select

Open steinybot opened this issue 3 years ago • 1 comments

Version 4.22.3 of antd has:

declare const Select: (<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(props: SelectProps<ValueType, OptionType> & {
    children?: React.ReactNode;
} & {
    ref?: React.Ref<BaseSelectRef> | undefined;
}) => React.ReactElement) & {
    SECRET_COMBOBOX_MODE_DO_NOT_USE: string;
    Option: typeof Option;
    OptGroup: typeof OptGroup;
};

This fails to be converted to a Slink component.

See https://github.com/ScalablyTyped/SlinkyDemos/pull/47

There are 2 problems:

  1. The second OptionType type parameter
  2. The outer intersection

This works:

declare const SelectRef: (<ValueType = any>(props: SelectProps<ValueType> & {
    children?: React.ReactNode;
} & {
    ref?: React.Ref<BaseSelectRef> | undefined;
}) => React.ReactElement);
declare type InternalSelectType = typeof SelectRef;
interface SelectInterface extends InternalSelectType {
    SECRET_COMBOBOX_MODE_DO_NOT_USE: string;
    Option: typeof Option;
    OptGroup: typeof OptGroup;
}
declare const Select: SelectInterface;

steinybot avatar Aug 03 '22 23:08 steinybot

this might have been fixed with beta41. at least the japgolly select component reappeared for me again.

an-tex avatar Jan 16 '23 09:01 an-tex