Closed ravshansbox closed 3 years ago
I think problem here is with history package. React router type definition is including latest version of history type definition which is v4 (v5 has type definitions built in) and there is a breaking change between v4 and v5 types.
React Router 4.x/5.x only work with history 4.x. Only React Router 6.x (in beta) supports history 5.x. If you're including history manually (you shouldn't need to), then make sure it's a 4.x version.
Good to know. So, I did...
pnpm install react-router-dom@next
pnpm install @types/react-router-dom
Just added a <Router>
around my components and still got a gazillion of following lines...
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3057,14): error TS2300: Duplicate identifier 'LibraryManagedAttributes'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3068,13): error TS2717: Subsequent property declarations must have the same type. Property 'a' must be of type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>', but here has type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3069,13): error TS2717: Subsequent property declarations must have the same type. Property 'abbr' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3070,13): error TS2717: Subsequent property declarations must have the same type. Property 'address' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3071,13): error TS2717: Subsequent property declarations must have the same type. Property 'area' must be of type 'DetailedHTMLProps<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>', but here has type 'DetailedHTMLProps<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3072,13): error TS2717: Subsequent property declarations must have the same type. Property 'article' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3073,13): error TS2717: Subsequent property declarations must have the same type. Property 'aside' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3074,13): error TS2717: Subsequent property declarations must have the same type. Property 'audio' must be of type 'DetailedHTMLProps<AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>', but here has type 'DetailedHTMLProps<AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3075,13): error TS2717: Subsequent property declarations must have the same type. Property 'b' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3076,13): error TS2717: Subsequent property declarations must have the same type. Property 'base' must be of type 'DetailedHTMLProps<BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>', but here has type 'DetailedHTMLProps<BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3077,13): error TS2717: Subsequent property declarations must have the same type. Property 'bdi' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3078,13): error TS2717: Subsequent property declarations must have the same type. Property 'bdo' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3079,13): error TS2717: Subsequent property declarations must have the same type. Property 'big' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3080,13): error TS2717: Subsequent property declarations must have the same type. Property 'blockquote' must be of type 'DetailedHTMLProps<BlockquoteHTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<BlockquoteHTMLAttributes<HTMLElement>, HTMLElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3081,13): error TS2717: Subsequent property declarations must have the same type. Property 'body' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3082,13): error TS2717: Subsequent property declarations must have the same type. Property 'br' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLBRElement>, HTMLBRElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLBRElement>, HTMLBRElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3083,13): error TS2717: Subsequent property declarations must have the same type. Property 'button' must be of type 'DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>', but here has type 'DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>'.
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3084,13): error TS2717: Subsequent property declarations must have the same type. Property 'canvas' must be of type 'DetailedHTMLProps<CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>', but here has type 'DetailedHTMLProps<CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>'.
...
...
...
../../node_modules/.pnpm/@types+react@17.0.14/node_modules/@types/react/index.d.ts(3245,13): error TS2717: Subsequent property declarations must have the same type. Property 'view' must be of type 'SVGProps<SVGViewElement>', but here has type 'SVGProps<SVGViewElement>'.
../../node_modules/.pnpm/@types+react@17.0.3/node_modules/@types/react/index.d.ts(2976,14): error TS2300: Duplicate identifier 'LibraryManagedAttributes'.
../../node_modules/.pnpm/react-router-dom@6.0.0-beta.0_react-dom@17.0.2+react@17.0.2/node_modules/react-router-dom/index.d.ts(3,27): error TS2307: Cannot find module 'history' or its corresponding type declarations.
../../node_modules/.pnpm/react-router@6.0.0-beta.0_react@17.0.2/node_modules/react-router/index.d.ts(3,100): error TS2307: Cannot find module 'history' or its corresponding type declarations.
Version
5.2.0
Test Case
https://github.com/ravshansbox/react-router-sample
Steps to reproduce
npm install --global pnpm
pnpm install
pnpm run tsc
Expected Behavior
Compile successfully
Actual Behavior
Compile error