forked from reduxjs/redux-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create declaration files with typescript (reduxjs#128)
* refactor(serializableStateInvariantMiddleware): named import instead of default * refactor(build): create types with typescript * fix(build): don't add interfaces to umd/esm modules
- Loading branch information
1 parent
6d1f04a
commit ae1b8a5
Showing
10 changed files
with
32 additions
and
63 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
"main": "dist/redux-starter-kit.cjs.js", | ||
"module": "dist/redux-starter-kit.esm.js", | ||
"unpkg": "dist/redux-starter-kit.umd.js", | ||
"types": "dist/typings.d.ts", | ||
"author": "Mark Erikson <[email protected]>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
|
@@ -45,7 +46,6 @@ | |
}, | ||
"files": [ | ||
"dist", | ||
"index.d.ts", | ||
"src" | ||
], | ||
"dependencies": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,5 @@ | ||
export { combineReducers, compose } from 'redux' | ||
export { default as createNextState } from 'immer' | ||
export { default as createSelector } from 'selectorator' | ||
|
||
export { configureStore, getDefaultMiddleware } from './configureStore' | ||
export { createAction, getType } from './createAction' | ||
export { createReducer } from './createReducer' | ||
export { createSlice } from './createSlice' | ||
export { | ||
default as createSerializableStateInvariantMiddleware, | ||
isPlain | ||
} from './serializableStateInvariantMiddleware' | ||
|
||
// Unfortunately, Babel's TypeScript plugin doesn't let us re-export | ||
// types using the `export { ... } from` syntax. Because it compiles | ||
// modules, independently, it has no way of knowing whether an identifier | ||
// refers to a type or value, and thus cannot strip the type re-exports | ||
// out of the generated JS. | ||
// | ||
// https://github.com/babel/babel/issues/8361 | ||
// | ||
// As a workaround, the root of this repository contains an `index.d.ts` | ||
// that contains all type re-exports. Whenever adding a new public function | ||
// or type, remember to export it in `index.d.ts` as well. | ||
export * from './configureStore' | ||
export * from './createAction' | ||
export * from './createReducer' | ||
export * from './createSlice' | ||
export * from './serializableStateInvariantMiddleware' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export { | ||
Action, | ||
ActionCreator, | ||
AnyAction, | ||
Middleware, | ||
Reducer, | ||
Store, | ||
StoreEnhancer, | ||
combineReducers, | ||
compose | ||
} from 'redux' | ||
export { default as createNextState } from 'immer' | ||
export { default as createSelector } from 'selectorator' | ||
|
||
export * from '.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"emitDeclarationOnly": true, | ||
"esModuleInterop": true, | ||
"declaration": true, | ||
"module": "es2015", | ||
"moduleResolution": "node", | ||
"noEmit": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"outDir": "dist", | ||
"strict": true, | ||
"target": "es2018" | ||
}, | ||
"include": ["src"] | ||
"include": ["src"], | ||
"exclude": ["src/*.test.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters