diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/index.d.ts @@ -0,0 +1 @@ + diff --git a/index.test-d.ts b/index.test-d.ts new file mode 100644 index 0000000..6a31513 --- /dev/null +++ b/index.test-d.ts @@ -0,0 +1,17 @@ +import { expectType, expectError } from 'tsd'; + +import buildInitial from './src/buildInitial'; + +expectType<{}>(buildInitial()); + +type MyState = { + foo: { + bar: number + }, + baz: string, +} + +expectType(buildInitial()); + +expectError( buildInitial({ foo: { bar: "potato" } }) ); + diff --git a/src/buildInitial/index.js b/src/buildInitial/index.js deleted file mode 100644 index 7df345e..0000000 --- a/src/buildInitial/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import fp from 'lodash/fp'; - -export default function buildInitial( - initial= {}, - subduxes = {}, -) { - return fp.isPlainObject(initial) ? fp.mergeAll([subduxes, initial]) : initial; -} diff --git a/src/buildInitial/index.ts b/src/buildInitial/index.ts new file mode 100644 index 0000000..96e2878 --- /dev/null +++ b/src/buildInitial/index.ts @@ -0,0 +1,11 @@ +import fp from 'lodash/fp'; + +function buildInitial( initial?: Partial, subduxes?: Partial ): S; +function buildInitial( + initial = {}, + subduxes = {} , +) { + return fp.isPlainObject(initial) ? fp.mergeAll([subduxes, initial]) : initial; +} + +export default buildInitial; diff --git a/src/buildInitial/test-d.js b/src/buildInitial/test-d.js deleted file mode 100644 index e69de29..0000000 diff --git a/tsconfig.json b/tsconfig.json index 63ebd76..29bc38a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,23 @@ { + "include": [ + "./src/**/*" + ], "compilerOptions": { /* Basic Options */ "incremental": true, /* Enable incremental compilation */ "target": "ES2019", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": [ "dom", "es2019" ], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ + "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ + "declaration": false, /* Generates corresponding '.d.ts' file. */ + "declarationMap": false, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + "sourceMap": false, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ "outDir": "./dist", /* Redirect output structure to the directory. */ "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ + //"composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ @@ -24,7 +27,7 @@ /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ + "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */