mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Fix react/redux TypeScript build errors caused by breaking changes in dependencies. Fixes #529, #582, #583
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { createStore, applyMiddleware, compose, combineReducers, GenericStoreEnhancer } from 'redux';
|
import { createStore, applyMiddleware, compose, combineReducers, GenericStoreEnhancer, Store as ReduxStore } from 'redux';
|
||||||
import thunk from 'redux-thunk';
|
import thunk from 'redux-thunk';
|
||||||
import { routerReducer } from 'react-router-redux';
|
import { routerReducer } from 'react-router-redux';
|
||||||
import * as Store from './store';
|
import * as Store from './store';
|
||||||
@@ -16,7 +16,7 @@ export default function configureStore(initialState?: Store.ApplicationState) {
|
|||||||
|
|
||||||
// Combine all reducers and instantiate the app-wide store instance
|
// Combine all reducers and instantiate the app-wide store instance
|
||||||
const allReducers = buildRootReducer(Store.reducers);
|
const allReducers = buildRootReducer(Store.reducers);
|
||||||
const store = createStoreWithMiddleware(allReducers, initialState) as Redux.Store<Store.ApplicationState>;
|
const store = createStoreWithMiddleware(allReducers, initialState) as ReduxStore<Store.ApplicationState>;
|
||||||
|
|
||||||
// Enable Webpack hot module replacement for reducers
|
// Enable Webpack hot module replacement for reducers
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"name": "music-store",
|
"name": "music-store",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/history": "^2.0.0",
|
||||||
"@types/react": "^0.14.29",
|
"@types/react": "^0.14.29",
|
||||||
"@types/react-bootstrap": "^0.0.35",
|
"@types/react-bootstrap": "^0.0.35",
|
||||||
"@types/react-dom": "^0.14.14",
|
"@types/react-dom": "^0.14.14",
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
"redux-typed": "^2.0.0",
|
"redux-typed": "^2.0.0",
|
||||||
"style-loader": "^0.13.0",
|
"style-loader": "^0.13.0",
|
||||||
"ts-loader": "^0.8.1",
|
"ts-loader": "^0.8.1",
|
||||||
"typescript": "2.0.3",
|
"typescript": "^2.0.3",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^1.13.2",
|
"webpack": "^1.13.2",
|
||||||
"webpack-hot-middleware": "^2.12.2",
|
"webpack-hot-middleware": "^2.12.2",
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"types": [ "webpack-env", "whatwg-fetch" ]
|
"types": [ "webpack-env", "whatwg-fetch" ],
|
||||||
|
"paths": {
|
||||||
|
// Fix "Duplicate identifier" errors caused by multiple dependencies fetching their own copies of type definitions.
|
||||||
|
// We tell TypeScript which type definitions module to treat as the canonical one (instead of combining all of them).
|
||||||
|
"history": ["./node_modules/@types/history/index"],
|
||||||
|
"redux": ["./node_modules/@types/redux/index"],
|
||||||
|
"react": ["./node_modules/@types/react/index"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"name": "WebApplicationBasic",
|
"name": "WebApplicationBasic",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/history": "^2.0.0",
|
||||||
"@types/react": "^0.14.29",
|
"@types/react": "^0.14.29",
|
||||||
"@types/react-dom": "^0.14.14",
|
"@types/react-dom": "^0.14.14",
|
||||||
"@types/react-redux": "^4.4.29",
|
"@types/react-redux": "^4.4.29",
|
||||||
@@ -39,7 +40,7 @@
|
|||||||
"redux-thunk": "^2.1.0",
|
"redux-thunk": "^2.1.0",
|
||||||
"style-loader": "^0.13.0",
|
"style-loader": "^0.13.0",
|
||||||
"ts-loader": "^0.8.1",
|
"ts-loader": "^0.8.1",
|
||||||
"typescript": "2.0.3",
|
"typescript": "^2.0.3",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^1.13.2",
|
"webpack": "^1.13.2",
|
||||||
"webpack-hot-middleware": "^2.12.2",
|
"webpack-hot-middleware": "^2.12.2",
|
||||||
|
|||||||
@@ -10,8 +10,11 @@
|
|||||||
"lib": ["es6", "dom"],
|
"lib": ["es6", "dom"],
|
||||||
"types": [ "webpack-env", "whatwg-fetch" ],
|
"types": [ "webpack-env", "whatwg-fetch" ],
|
||||||
"paths": {
|
"paths": {
|
||||||
// Fixes "Duplicate identifier 'Redux'" error when packages were installed via Yarn (by specifying which .d.ts file is authoritative)
|
// Fix "Duplicate identifier" errors caused by multiple dependencies fetching their own copies of type definitions.
|
||||||
"redux": ["./node_modules/@types/redux/index"]
|
// We tell TypeScript which type definitions module to treat as the canonical one (instead of combining all of them).
|
||||||
|
"history": ["./node_modules/@types/history/index"],
|
||||||
|
"redux": ["./node_modules/@types/redux/index"],
|
||||||
|
"react": ["./node_modules/@types/react/index"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"skipDefaultLibCheck": true
|
"skipDefaultLibCheck": true,
|
||||||
|
"paths": {
|
||||||
|
// Fix "Duplicate identifier" errors caused by multiple dependencies fetching their own copies of type definitions.
|
||||||
|
// We tell TypeScript which type definitions module to treat as the canonical one (instead of combining all of them).
|
||||||
|
"history": ["./node_modules/@types/history/index"],
|
||||||
|
"react": ["./node_modules/@types/react/index"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"bin",
|
"bin",
|
||||||
|
|||||||
Reference in New Issue
Block a user