diff --git a/index.d.ts b/index.d.ts index d85babf..b565538 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,8 +1,13 @@ import * as React from 'react'; -export function autoBind(el: React.ReactNode, options?: any): React.ReactNode; +interface AutoBindOptions { + include?: Array + exclude?: Array +} + +export function autoBind(element: React.ReactNode, options?: AutoBindOptions): React.ReactNode; -export function classNames(...args: any[]): string; +export function classNames(...args: Array): string; export function isStatelessComponent(component: React.ComponentClass): boolean; @@ -31,8 +36,8 @@ export class Choose extends React.Component { } interface ForProps { - of: any[]; - render?: (item: any, index: number) => React.ReactNode; + of: unknown[]; + render?: (item: unknown, index: number) => React.ReactNode; } export class For extends React.Component {} diff --git a/index.test-d.ts b/index.test-d.ts new file mode 100644 index 0000000..41a8880 --- /dev/null +++ b/index.test-d.ts @@ -0,0 +1,4 @@ +import {expectType} from 'tsd-check'; +import {classNames} from '.'; + +expectType(classNames('foo', {bar: true})); diff --git a/package.json b/package.json index 9b7c1e4..0e49f56 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ }, "scripts": { "build": "babel index.js auto-bind.js class-names.js --out-dir=dist", - "test": "xo && ava", + "test": "xo && ava && tsd-check", "prepublishOnly": "npm run build" }, "files": [ @@ -58,6 +58,7 @@ "react": "^16.7.0", "react-dom": "^16.7.0", "react-test-renderer": "^16.7.0", + "tsd-check": "^0.3.0", "xo": "^0.23.0" }, "peerDependencies": {