Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
feat: Update the way the types work
Browse files Browse the repository at this point in the history
  • Loading branch information
rmevans9 committed Mar 2, 2019
1 parent 0b9574a commit d4d973d
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 82 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"semantic-release": "semantic-release"
},
"peerDependencies": {
"reactotron-core-client": "^2.2.1",
"reactotron-core-client": "^2.5.0-beta.1",
"redux": "^4.0.1"
},
"devDependencies": {
Expand All @@ -56,7 +56,7 @@
"jest": "^24.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^1.16.4",
"reactotron-core-client": "^2.2.1",
"reactotron-core-client": "^2.5.0-beta.1",
"redux": "^4.0.1",
"rollup": "^1.1.2",
"rollup-plugin-babel": "^4.3.2",
Expand Down
47 changes: 0 additions & 47 deletions reactotron-redux.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/commandHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import createCommandHandler from "./commandHandler"
import { DEFAULT_REPLACER_TYPE } from "./reducer"
import { PluginConfig } from "./pluginConfig"

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

Expand Down
1 change: 1 addition & 0 deletions src/commandHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import stateCleaner from "./helpers/stateCleaner"
import pathObject from "./helpers/pathObject"
import createSubscriptionsHandler from "./subscriptionsHandler"
import { PluginConfig } from "./pluginConfig"

export default function createCommandHandler(reactotron: any, pluginConfig: PluginConfig, onReduxStoreCreation: (func: () => void) => void) {
const subscriptionsHandler = createSubscriptionsHandler(reactotron, onReduxStoreCreation)
Expand Down
2 changes: 2 additions & 0 deletions src/customDispatch.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { PluginConfig } from "./pluginConfig"

export default function createCustomDispatch(
reactotron: any,
store: { dispatch: Function },
Expand Down
1 change: 1 addition & 0 deletions src/enhancer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import reactotronReducer from "./reducer"
import createCustomDispatch from "./customDispatch"
import { PluginConfig } from "./pluginConfig"

export default function createEnhancer(
reactotron: any,
Expand Down
23 changes: 23 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { StoreEnhancer } from 'redux';

import createCommandHander from "./commandHandler"
import createSendAction from "./sendAction"
import createEnhancer from "./enhancer"
import { DEFAULT_REPLACER_TYPE } from "./reducer"
import { PluginConfig } from "./pluginConfig"

function reactotronRedux(pluginConfig: PluginConfig = {}) {
const mergedPluginConfig: PluginConfig = {
Expand Down Expand Up @@ -32,3 +35,23 @@ function reactotronRedux(pluginConfig: PluginConfig = {}) {
}

export { reactotronRedux }

declare module "reactotron-react-native" {
// eslint-disable-next-line import/export
export interface Reactotron {
/**
* Enhancer creator
*/
createEnhancer: () => StoreEnhancer
}
}

declare module "reactotron-react-js" {
// eslint-disable-next-line import/export
export interface Reactotron {
/**
* Enhancer creator
*/
createEnhancer: () => StoreEnhancer
}
}
7 changes: 7 additions & 0 deletions src/pluginConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface PluginConfig {
restoreActionType?: string
onBackup?: (state: any) => any
onRestore?: (restoringState: any, reduxState: any) => any
except?: (string | Function | RegExp)[]
isActionImportant?: (action: any) => boolean
}
9 changes: 2 additions & 7 deletions src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
interface PluginConfig {
restoreActionType?: string
onBackup?: (state: any) => any
onRestore?: (restoringState: any, reduxState: any) => any
except?: (string | Function | RegExp)[]
isActionImportant?: (action: any) => boolean
}
declare module "reactotron-react-native" {}
declare module "reactotron-react-js" {}
37 changes: 20 additions & 17 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{
"compilerOptions": {
"allowJs": false,
"noEmit": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",
"noImplicitAny": false,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"sourceMap": true,
"target": "es2015"
},
"exclude": ["node_modules"],
"include": ["src"]
}
"compilerOptions": {
"allowJs": false,
"declaration": true,
"declarationDir": "dist/types",
"emitDeclarationOnly": true,
"emitDecoratorMetadata": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",
"noImplicitAny": false,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"sourceMap": true,
"target": "es2015"
},
"exclude": ["node_modules"],
"include": ["src"]
}
13 changes: 4 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -977,11 +977,6 @@ ansi-escapes@^3.0.0, ansi-escapes@^3.1.0, ansi-escapes@^3.2.0:
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b"
integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==

ansi-escapes@^3.1.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b"
integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==

ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
Expand Down Expand Up @@ -6684,10 +6679,10 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.7, rc@^1.2.8:
minimist "^1.2.0"
strip-json-comments "~2.0.1"

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

read-all-stream@^3.0.0:
version "3.1.0"
Expand Down

0 comments on commit d4d973d

Please sign in to comment.