From e017e0e1309582c053df6b09a65e7c3c677d7c2c Mon Sep 17 00:00:00 2001 From: Hadrien de Cuzey Date: Wed, 2 Aug 2017 11:04:59 +0300 Subject: [PATCH] Add some basic TypeScript typings --- index.d.ts | 21 +++++++++++++++++++++ package.json | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..efab986 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,21 @@ +declare module 'css-ns' { + interface Options { + namespace: string; + prefix?: string; + include?: RegExp; + exclude?: RegExp; + self?: RegExp; + glue?: string; + React?: any; + } + + type ClassMap = { [className: string]: boolean }; + type ReactElement = any; + + export interface NsFunction { + (classNames: string | any[] | ClassMap): string; + (reactElement: T): T; + } + + export const createCssNs: (options: Options | string) => NsFunction; +} diff --git a/package.json b/package.json index 32a7462..0489aca 100644 --- a/package.json +++ b/package.json @@ -23,5 +23,6 @@ "deploy-gh-pages": "git stash && npm run test-build && cp -r test temp && git checkout gh-pages && mv temp/* . && rm -rf temp && git commit -am 'Automatic gh-pages deploy' && git push origin gh-pages && git checkout -" }, "author": "Jarno Rantanen ", - "license": "MIT" + "license": "MIT", + "types": "./index.d.ts" }