Skip to content

Commit

Permalink
fix: Remove "key" property to fix reducer's typings
Browse files Browse the repository at this point in the history
fix #19
  • Loading branch information
rand0me committed Sep 20, 2018
1 parent c7a2a43 commit 656be58
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 60 deletions.
99 changes: 45 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"jest": {
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
".(ts|tsx)": "ts-jest"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": [
Expand Down Expand Up @@ -107,7 +107,7 @@
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-typescript2": "^0.17.0",
"semantic-release": "^15.9.3",
"ts-jest": "^23.1.2",
"ts-jest": "^23.10.0",
"ts-node": "^7.0.0",
"tslint": "^5.8.0",
"tslint-config-prettier": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/redux-appinsights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function createAppInsightsMiddleware(
* @param propName Property name to read from your Actions
*/
export function createAppInsightsReducer(propName = 'appinsights') {
return (state = { events: [] as InsightsEvent[], key: null }, action: AnyAction) => {
return (state = { events: [] as InsightsEvent[] }, action: AnyAction) => {
if (action[propName]) {
return { events: state.events.concat(action[propName]) }
} else {
Expand Down
4 changes: 2 additions & 2 deletions test/redux-appinsights.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '../src/redux-appinsights'

const middlewareAPIMock = {
dispatch(fn) {
dispatch(fn: any) {
return fn()
},
getState() {
Expand Down Expand Up @@ -44,7 +44,7 @@ describe('AppInsights Test', () => {

it('reducer skips common action', () => {
const reducer = createAppInsightsReducer('ai')
const state = reducer({ events: [], key: null }, { type: 'ACTION', payload: null })
const state = reducer({ events: [] }, { type: 'ACTION', payload: null })

expect(state.events.length).toBe(0)
})
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"strict": true,
"moduleResolution": "node",
"target": "es5",
"module":"es2015",
"lib": ["es2015", "es2016", "es2017", "dom"],
"strict": true,
"sourceMap": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 656be58

Please sign in to comment.