type DndBoxProps = React.PropsWithChildren<{
accepts?: any[];
// "all"
// "left" | "right" | "top" | "bottom"
edge?: string[];
}>
If I pass ‘all’, then cannot pass ‘top’, ‘right’, ‘left’, ‘bottom’.
type DndBoxProps = React.PropsWithChildren<{
accepts?: any[];
// "all"
// "left" | "right" | "top" | "bottom"
edge?: string[];
}>
If I pass ‘all’, then cannot pass ‘top’, ‘right’, ‘left’, ‘bottom’.
2
Answers
Thanks for the reply! I don't think this solution of yours is good enough.
// ==== This has the same check as your answer =============
// =====I have now changed it to==============================
You can add custom type using discriminating union
This way
<DndBox edgeConfig={{edges: ['all', 'left']}} />
– will raise error