Skip to content

Commit d5c5bad

Browse files
Bugfix/types exports causing cra to error (#23)
* Moved MemoryRouterProps to common types * Made typescript v3.8.0 a peer dependency
1 parent 5818189 commit d5c5bad

File tree

6 files changed

+15
-23
lines changed

6 files changed

+15
-23
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
},
121121
"peerDependencies": {
122122
"react": "^16.8.0",
123-
"react-dom": "^16.8.0"
123+
"react-dom": "^16.8.0",
124+
"typescript": "^3.8.0"
124125
}
125126
}

src/common/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,12 @@ export type HistoryActions = {
226226
registerBlock: (blocker: HistoryBlocker) => () => void;
227227
listen: HistoryListen;
228228
};
229+
230+
export type MemoryRouterProps = {
231+
isStatic?: boolean;
232+
location?: string;
233+
routes: Routes;
234+
children: ReactNode;
235+
resourceData?: ResourceStoreData;
236+
resourceContext?: ResourceStoreContext;
237+
};

src/controllers/memory-router/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createMemoryHistory, MemoryHistoryBuildOptions } from 'history';
55
import { Router } from '../router';
66
import { RouterProps } from '../router/types';
77

8-
import { MemoryRouterProps } from './types';
8+
import { MemoryRouterProps } from '../../common/types';
99

1010
const getRouterProps = (memoryRouterProps: MemoryRouterProps) => {
1111
const {
@@ -52,5 +52,3 @@ export const MemoryRouter = (props: MemoryRouterProps) => {
5252
</Router>
5353
);
5454
};
55-
56-
export type { MemoryRouterProps };

src/controllers/memory-router/types.ts

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

src/controllers/static-router/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import React from 'react';
22

33
import { createLocation, createMemoryHistory } from 'history';
44

5-
import { MemoryRouter, MemoryRouterProps } from '../memory-router';
5+
import { MemoryRouterProps } from '../../common/types';
6+
import { MemoryRouter } from '../memory-router';
67
import { getResourceStore } from '../resource-store';
78
import { getRouterStore } from '../router-store';
89

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
"typeRoots": ["./node_modules/@types", "types"],
1313
"baseUrl": ".",
1414
"paths": {
15-
"react-loosely-lazy": ["src"],
16-
"react-loosely-lazy/babel-plugin": ["src/babel"]
15+
"react-resource-router": ["src"]
1716
}
1817
},
1918
"include": ["src/**/*", "examples/**/*"]

0 commit comments

Comments
 (0)