-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
Description
Feature Request
Problem description
We use typescript and HOC in our project. There are many cases where we wrap a semantic element and need to remove a property.
For example,
- we have a HOC which wraps Dropdown component and passes
optionthough redux. Then we need to removeoptionfrom props - we introduced a default property but the only clean way to define the typescript is using HOC to change a required prop to be optional
In both cases, we need to utilize Omit (reference) operation to remove a key from Semantic element's prop type definition. However each type definition from Semantic contains [key: string]: any; which makes Omit not working
Proposed solution
export a type definiton without [key: string]: any; for HOC to use.
MVP
Take button as example
Current code:
export interface ButtonProps {
[key: string]: any;
/** An element type to render as (string or function). */
as?: any;
/** A button can show it is currently the active user selection. */
active?: boolean;
}Proposal
export interface ButtonPropsStrict {
/** An element type to render as (string or function). */
as?: any;
/** A button can show it is currently the active user selection. */
active?: boolean;
}
export interface ButtonProps = ButtonPropsStrict & { [key: string]: any; }Reactions are currently unavailable