mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add props type for styled-system__should-forward-prop (#43439)
This commit is contained in:
parent
c9a874d204
commit
02a61894ce
@ -1,10 +1,12 @@
|
||||
// Type definitions for @styled-system/should-forward-prop 5.1
|
||||
// Project: https://github.com/styled-system/styled-system/tree/master/packages/should-forward-prop
|
||||
// Definitions by: Tom Picton <https://github.com/tpict>
|
||||
// Definitions by: Tom Picton <https://github.com/tpict>, Jason Maurer <https://github.com/jsonmaur>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
type genericShouldForwardProp = (prop: string) => boolean;
|
||||
|
||||
export const props: string[];
|
||||
export function createShouldForwardProp(props: string[]): genericShouldForwardProp;
|
||||
|
||||
declare const shouldForwardProp: genericShouldForwardProp;
|
||||
export default shouldForwardProp;
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
import shouldForwardProp, {
|
||||
props,
|
||||
createShouldForwardProp
|
||||
} from "@styled-system/should-forward-prop";
|
||||
|
||||
shouldForwardProp("onClick"); // True
|
||||
shouldForwardProp("variant"); // False
|
||||
|
||||
const customShouldForwardProp = createShouldForwardProp(["magic"]);
|
||||
const customShouldForwardProp = createShouldForwardProp([...props, "magic"]);
|
||||
customShouldForwardProp("onClick"); // True
|
||||
customShouldForwardProp("variant"); // False
|
||||
customShouldForwardProp("magic"); // True
|
||||
customShouldForwardProp("you know"); // False
|
||||
|
||||
Loading…
Reference in New Issue
Block a user