diff --git a/types/styled-system__should-forward-prop/index.d.ts b/types/styled-system__should-forward-prop/index.d.ts new file mode 100644 index 0000000000..2a90cef276 --- /dev/null +++ b/types/styled-system__should-forward-prop/index.d.ts @@ -0,0 +1,10 @@ +// 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 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type genericShouldForwardProp = (prop: string) => boolean; + +export function createShouldForwardProp(props: string[]): genericShouldForwardProp; +declare const shouldForwardProp: genericShouldForwardProp; +export default shouldForwardProp; diff --git a/types/styled-system__should-forward-prop/styled-system__should-forward-prop-tests.ts b/types/styled-system__should-forward-prop/styled-system__should-forward-prop-tests.ts new file mode 100644 index 0000000000..206e6fc029 --- /dev/null +++ b/types/styled-system__should-forward-prop/styled-system__should-forward-prop-tests.ts @@ -0,0 +1,10 @@ +import shouldForwardProp, { + createShouldForwardProp +} from "@styled-system/should-forward-prop"; + +shouldForwardProp("onClick"); // True +shouldForwardProp("variant"); // False + +const customShouldForwardProp = createShouldForwardProp(["magic"]); +customShouldForwardProp("magic"); // True +customShouldForwardProp("you know"); // False diff --git a/types/styled-system__should-forward-prop/tsconfig.json b/types/styled-system__should-forward-prop/tsconfig.json new file mode 100644 index 0000000000..256eb9edce --- /dev/null +++ b/types/styled-system__should-forward-prop/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "paths": { + "@styled-system/should-forward-prop": [ + "styled-system__should-forward-prop" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "styled-system__should-forward-prop-tests.ts" + ] +} diff --git a/types/styled-system__should-forward-prop/tslint.json b/types/styled-system__should-forward-prop/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/styled-system__should-forward-prop/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }