From 852e19646963bbedd6cb3b0717c786a60811ace4 Mon Sep 17 00:00:00 2001 From: Mohammad Hasani Date: Mon, 21 Jan 2019 14:01:34 +0330 Subject: [PATCH] fix: convert types.d.ts to types.ts definition types does not exist in the build and cause Reducer type to be any closes #5 --- src/create-handler-map.ts | 1 + src/types.d.ts | 1 - src/types.ts | 4 ++++ tsconfig.build.json | 2 +- tsconfig.spec.json | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) delete mode 100644 src/types.d.ts create mode 100644 src/types.ts diff --git a/src/create-handler-map.ts b/src/create-handler-map.ts index e272349..e19845a 100644 --- a/src/create-handler-map.ts +++ b/src/create-handler-map.ts @@ -1,6 +1,7 @@ import { ActionCreator } from './create-action' import { AnyAction } from './action' import { getType } from './get-type' +import { Reducer } from './types' export type HandlerMap = { [key in Actions['type']]: Reducer diff --git a/src/types.d.ts b/src/types.d.ts deleted file mode 100644 index 11b4763..0000000 --- a/src/types.d.ts +++ /dev/null @@ -1 +0,0 @@ -type Reducer = (prevState: State, action: Actions) => State diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..52e8440 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,4 @@ +export type Reducer = ( + prevState: State, + action: Actions +) => State diff --git a/tsconfig.build.json b/tsconfig.build.json index 787a229..eac0c2c 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,6 +1,6 @@ { "extends": "./tsconfig.json", - "files": ["./src/index.ts", "./src/types.d.ts"], + "files": ["./src/index.ts"], "include": [], "exclude": [], "compilerOptions": { diff --git a/tsconfig.spec.json b/tsconfig.spec.json index 856bdb0..831918b 100644 --- a/tsconfig.spec.json +++ b/tsconfig.spec.json @@ -1,6 +1,6 @@ { "extends": "./tsconfig.json", - "include": ["./src/**/__tests__/*", "./src/types.d.ts"], + "include": ["./src/**/__tests__/*"], "compilerOptions": { "target": "esnext", "esModuleInterop": true