Add types for @styled-system/should-forward-prop (#39129)

This commit is contained in:
Tom Picton
2019-10-15 16:07:19 -07:00
committed by Andrew Branch
parent 2704228c72
commit 5c96fac575
4 changed files with 49 additions and 0 deletions
+10
View File
@@ -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 <https://github.com/tpict>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type genericShouldForwardProp = (prop: string) => boolean;
export function createShouldForwardProp(props: string[]): genericShouldForwardProp;
declare const shouldForwardProp: genericShouldForwardProp;
export default shouldForwardProp;
@@ -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
@@ -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"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }