diff --git a/.gitignore b/.gitignore index bf6c14bd88..246860cfdc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ -.DS_Store -*.log node_modules + +coverage + dist lib es -coverage types website/translated_docs diff --git a/package.json b/package.json index af8b30bf27..772f99d6b5 100644 --- a/package.json +++ b/package.json @@ -39,14 +39,13 @@ "format": "prettier --write \"{src,test}/**/*.{js,ts}\" index.d.ts \"**/*.md\"", "format:check": "prettier --list-different \"{src,test}/**/*.{js,ts}\" index.d.ts \"**/*.md\"", "lint": "eslint --ext js,ts src test", + "check-types": "tsc --noEmit", "pretest": "npm run build", "test": "jest", "test:watch": "npm test -- --watch", "test:cov": "npm test -- --coverage", - "build": "npm run build-types && rollup -c", + "build": "rollup -c", "prepare": "npm run clean && npm run check-types && npm run format:check && npm run lint && npm test", - "build-types": "tsc --emitDeclarationOnly", - "check-types": "tsc --noEmit", "examples:lint": "eslint --ext js,ts examples", "examples:test": "cross-env CI=true babel-node examples/testAll.js" }, diff --git a/rollup.config.js b/rollup.config.js index cea2874f86..27ce0b7bc9 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,6 +6,8 @@ import { terser } from 'rollup-plugin-terser' import pkg from './package.json' +const noDeclarationFiles = { compilerOptions: { declaration: false } }; + export default [ // CommonJS { @@ -19,7 +21,7 @@ export default [ nodeResolve({ extensions: ['.ts'] }), - typescript(), + typescript({ useTsconfigDeclarationDir: true }), babel() ] }, @@ -36,7 +38,7 @@ export default [ nodeResolve({ extensions: ['.ts'] }), - typescript(), + typescript({ tsconfigOverride: noDeclarationFiles }), babel() ] }, @@ -52,7 +54,7 @@ export default [ replace({ 'process.env.NODE_ENV': JSON.stringify('production') }), - typescript(), + typescript({ tsconfigOverride: noDeclarationFiles }), babel({ exclude: 'node_modules/**' }), @@ -80,7 +82,7 @@ export default [ nodeResolve({ extensions: ['.ts'] }), - typescript(), + typescript({ tsconfigOverride: noDeclarationFiles }), babel({ exclude: 'node_modules/**' }), @@ -103,7 +105,7 @@ export default [ nodeResolve({ extensions: ['.ts'] }), - typescript(), + typescript({ tsconfigOverride: noDeclarationFiles }), babel({ exclude: 'node_modules/**' }), diff --git a/test/typescript/actionCreators.ts b/test/typescript/actionCreators.ts index e3594a0712..f7a15bcd75 100644 --- a/test/typescript/actionCreators.ts +++ b/test/typescript/actionCreators.ts @@ -4,7 +4,7 @@ import { Dispatch, bindActionCreators, ActionCreatorsMapObject -} from 'redux' +} from '../..' interface AddTodoAction extends Action { text: string diff --git a/test/typescript/actions.ts b/test/typescript/actions.ts index 1b701ce77d..480a34151b 100644 --- a/test/typescript/actions.ts +++ b/test/typescript/actions.ts @@ -1,4 +1,4 @@ -import { Action as ReduxAction } from 'redux' +import { Action as ReduxAction } from '../..' namespace FSA { interface Action

extends ReduxAction { diff --git a/test/typescript/compose.ts b/test/typescript/compose.ts index ae2fc5b32d..cfc608bad3 100644 --- a/test/typescript/compose.ts +++ b/test/typescript/compose.ts @@ -1,4 +1,4 @@ -import { compose } from 'redux' +import { compose } from '../..' // adapted from DefinitelyTyped/compose-function diff --git a/test/typescript/dispatch.ts b/test/typescript/dispatch.ts index 72f8998856..9cb125e37a 100644 --- a/test/typescript/dispatch.ts +++ b/test/typescript/dispatch.ts @@ -1,4 +1,4 @@ -import { Dispatch, AnyAction } from 'redux' +import { Dispatch } from '../..' /** * Default Dispatch type accepts any object with `type` property. diff --git a/test/typescript/enhancers.ts b/test/typescript/enhancers.ts index e39ca83628..c6d29af6a0 100644 --- a/test/typescript/enhancers.ts +++ b/test/typescript/enhancers.ts @@ -1,11 +1,4 @@ -import { - StoreEnhancer, - Action, - AnyAction, - Reducer, - createStore, - PreloadedState -} from 'redux' +import { StoreEnhancer, Action, AnyAction, Reducer, createStore } from '../..' interface State { someField: 'string' diff --git a/test/typescript/injectedDispatch.ts b/test/typescript/injectedDispatch.ts index f115b699fe..46dc9a7016 100644 --- a/test/typescript/injectedDispatch.ts +++ b/test/typescript/injectedDispatch.ts @@ -1,4 +1,4 @@ -import { Dispatch, Action } from 'redux' +import { Dispatch, Action } from '../..' interface Component

{ props: P diff --git a/test/typescript/middleware.ts b/test/typescript/middleware.ts index 7b1c48443c..a0f9afa7f6 100644 --- a/test/typescript/middleware.ts +++ b/test/typescript/middleware.ts @@ -2,13 +2,12 @@ import { Middleware, MiddlewareAPI, applyMiddleware, - StoreEnhancer, createStore, Dispatch, Reducer, Action, AnyAction -} from 'redux' +} from '../..' /** * Logger middleware doesn't add any extra types to dispatch, just logs actions diff --git a/test/typescript/reducers.ts b/test/typescript/reducers.ts index 5a109eeece..f013f83b37 100644 --- a/test/typescript/reducers.ts +++ b/test/typescript/reducers.ts @@ -1,4 +1,4 @@ -import { Reducer, Action, combineReducers, ReducersMapObject } from 'redux' +import { Reducer, Action, combineReducers, ReducersMapObject } from '../..' /** * Simple reducer definition with no action shape checks. diff --git a/test/typescript/replaceReducer.ts b/test/typescript/replaceReducer.ts index 5e41160d67..03b5b7fd90 100644 --- a/test/typescript/replaceReducer.ts +++ b/test/typescript/replaceReducer.ts @@ -1,4 +1,4 @@ -import { combineReducers, createStore } from 'redux' +import { combineReducers, createStore } from '../..' /** * verify that replaceReducer maintains strict typing if the new types change diff --git a/test/typescript/store.ts b/test/typescript/store.ts index b387c0b15c..dd7d76296e 100644 --- a/test/typescript/store.ts +++ b/test/typescript/store.ts @@ -4,12 +4,10 @@ import { Reducer, Action, StoreEnhancer, - StoreCreator, - StoreEnhancerStoreCreator, Unsubscribe, Observer, ExtendState -} from 'redux' +} from '../..' import 'symbol-observable' type State = { diff --git a/test/typescript/tsconfig.json b/test/typescript/tsconfig.json index eb36059da2..9af8c36a48 100644 --- a/test/typescript/tsconfig.json +++ b/test/typescript/tsconfig.json @@ -2,9 +2,6 @@ "compilerOptions": { "lib": ["es2017", "dom"], "strict": true, - "baseUrl": "../..", - "paths": { - "redux": ["types/index.d.ts"] - } + "baseUrl": "../.." } }