8000 feat: Update the way the types work · infinitered/reactotron-redux@d4d973d · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Commit d4d973d

Browse files
committed
feat: Update the way the types work
1 parent 0b9574a commit d4d973d

11 files changed

+63
-82
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"semantic-release": "semantic-release"
3434
},
3535
"peerDependencies": {
36-
"reactotron-core-client": "^2.2.1",
36+
"reactotron-core-client": "^2.5.0-beta.1",
3737
"redux": "^4.0.1"
3838
},
3939
"devDependencies": {
@@ -56,7 +56,7 @@
5656
"jest": "^24.1.0",
5757
"npm-run-all": "^4.1.5",
5858
"prettier": "^1.16.4",
59-
"reactotron-core-client": "^2.2.1",
59+
"reactotron-core-client": "^2.5.0-beta.1",
6060
"redux": "^4.0.1",
6161
"rollup": "^1.1.2",
6262
"rollup-plugin-babel": "^4.3.2",

reactotron-redux.d.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/commandHandler.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import createCommandHandler from "./commandHandler"
22
import { DEFAULT_REPLACER_TYPE } from "./reducer"
3+
import { PluginConfig } from "./pluginConfig"
34

45
// TODO: Write more tests around onBackup and onRestore.
56

src/commandHandler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import stateCleaner from "./helpers/stateCleaner"
22
import pathObject from "./helpers/pathObject"
33
import createSubscriptionsHandler from "./subscriptionsHandler"
4+
import { PluginConfig } from "./pluginConfig"
45

56
export default function createCommandHandler(reactotron: any, pluginConfig: PluginConfig, onReduxStoreCreation: (func: () => void) => void) {
67
const subscriptionsHandler = createSubscriptionsHandler(reactotron, onReduxStoreCreation)

src/customDispatch.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { PluginConfig } from "./pluginConfig"
2+
13
export default function createCustomDispatch(
24
reactotron: any,
35
store: { dispatch: Function },

src/enhancer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import reactotronReducer from "./reducer"
22
import createCustomDispatch from "./customDispatch"
3+
import { PluginConfig } from "./pluginConfig"
34

45
export default function createEnhancer(
56
reactotron: any,

src/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import { StoreEnhancer } from 'redux';
2+
13
import createCommandHander from "./commandHandler"
24
import createSendAction from "./sendAction"
35
import createEnhancer from "./enhancer"
46
import { DEFAULT_REPLACER_TYPE } from "./reducer"
7+
import { PluginConfig } from "./pluginConfig"
58

69
function reactotronRedux(pluginConfig: PluginConfig = {}) {
710
const mergedPluginConfig: PluginConfig = {
@@ -32,3 +35,23 @@ function reactotronRedux(pluginConfig: PluginConfig = {}) {
3235
}
3336

3437
export { reactotronRedux }
38+
39+
declare module "reactotron-react-native" {
40+
// eslint-disable-next-line import/export
41+
export interface Reactotron {
42+
/**
43+
* Enhancer creator
44+
*/
45+
createEnhancer: () => StoreEnhancer
46+
}
47+
}
48+
49+
declare module "reactotron-react-js" {
50+
// eslint-disable-next-line import/export
51+
export interface Reactotron {
52+
/**
53+
* Enhancer creator
54+
*/
55+
createEnhancer: () => StoreEnhancer
56+
}
57+
}

src/pluginConfig.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export interface PluginConfig {
2+
restoreActionType?: string
3+
onBackup?: (state: any) => any
4+
onRestore?: (restoringState: any, reduxState: any) => any
5+
except?: (string | Function | RegExp)[]
6+
isActionImportant?: (action: any) => boolean
7+
}

src/types.d.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
interface PluginConfig {
2-
restoreActionType?: string
3-
onBackup?: (state: any) => any
4-
onRestore?: (restoringState: any, reduxState: any) => any
5-
except?: (string | Function | RegExp)[]
6-
isActionImportant?: (action: any) => boolean
7-
}
1+
declare module "reactotron-react-native" {}
2+
declare module "reactotron-react-js" {}

tsconfig.json

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
{
2-
"compilerOptions": {
3-
"allowJs": false,
4-
"noEmit": true,
5-
"allowSyntheticDefaultImports": true,
6-
"experimentalDecorators": true,
7-
"module": "es2015",
8-
"moduleResolution": "node",
9-
"noImplicitAny": false,
10-
"noImplicitReturns": true,
11-
"noImplicitThis": true,
12-
"noUnusedLocals": true,
13-
"sourceMap": true,
14-
"target": "es2015"
15-
},
16-
"exclude": ["node_modules"],
17-
"include": ["src"]
18-
}
2+
"compilerOptions": {
3+
"allowJs": false,
4+
"declaration": true,
5+
"declarationDir": "dist/types",
6+
"emitDeclarationOnly": true,
7+
"emitDecoratorMetadata": true,
8+
"allowSyntheticDefaultImports": true,
9+
"experimentalDecorators": true,
10+
"module": "es2015",
11+
"moduleResolution": "node",
12+
"noImplicitAny": false,
13+
"noImplicitReturns": true,
14+
"noImplicitThis": true,
15+
"noUnusedLocals": true,
16+
"sourceMap": true,
17+
"target": "es2015"
18+
},
19+
"exclude": ["node_modules"],
20+
"include": ["src"]
21+
}

yarn.lock

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -977,11 +977,6 @@ ansi-escapes@^3.0.0, ansi-escapes@^3.1.0, ansi-escapes@^3.2.0:
977977
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b"
978978
integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==
979979

980-
ansi-escapes@^3.1.0:
981-
version "3.2.0"
982-
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b"
983-
integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==
984-
985980
ansi-regex@^2.0.0:
986981
version "2.1.1"
987982
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
@@ -6684,10 +6679,10 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.7, rc@^1.2.8:
66846679
minimist "^1.2.0"
66856680
strip-json-comments "~2.0.1"
66866681

6687-
reactotron-core-client@^2.2.1:
6688-
version "2.2.1"
6689-
resolved "https://registry.yarnpkg.com/reactotron-core-client/-/reactotron-core-client-2.2.1.tgz#2b7417df7831419ce9bc44b025f86012fda7e582"
6690-
integrity sha512-VINa2vuSMOCqRCaRRdTdk10vrj7xRhRUN1hpbvtANMlZmByQOf+kqRVqR6uad2jPE3nn/47V7F23MAkS8lDNug==
6682+
reactotron-core-client@^2.5.0-beta.1:
6683+
version "2.5.0-beta.1"
6684+
resolved "https://registry.yarnpkg.com/reactotron-core-client/-/reactotron-core-client-2.5.0-beta.1.tgz#da0ff5c56cc5a2bd59fae01f25c3f42ace0a146d"
6685+
integrity sha512-oh3bSQetfaX/clCRqdC/qBKpD7JVhOXlQJhAne4mHRhF5fvMsWaPQePdvOvKAfCMHWv54e0ld7FLU/+gHHw3cg==
66916686

66926687
read-all-stream@^3.0.0:
66936688
version "3.1.0"

0 commit comments

Comments
 (0)
0