Description
Is this a bug report?
Yes, but i'm not sure if the bug is caused by CRA
Did you try recovering your dependencies?
npm --version
6.4.1
Which terms did you search for in User Guide?
Environment
npx create-react-app --info
doesn't work. It's an open issue - #5757
I'm using Windows 10 though.
Description of bug
I've been trying to refactor a create-react-app-typescript app by following the blog post recommended in the docs - https://vincenttunru.com/migrate-create-react-app-typescript-to-create-react-app/
After i went through the steps and started the app i got this error:
Type error: Type '(value: number | Range) => void' is not assignable to type '(value: number | import("bla-bla/node_modules/react-input-range/react-input-range").Range) => void'.
Types of parameters 'value' and 'value' are incompatible.
Type 'number | import("bla-bla/node_modules/react-input-range/react-input-range").Range' is not assignable to type 'number | Range'.
Type 'Range' is not assignable to type 'number | Range'.
Type 'import("bla-bla/node_modules/react-input-range/react-input-range").Range' is not assignable to type 'Range'.
Property 'commonAncestorContainer' is missing in type 'Range'. TS2322
this is the method that triggers it:
public changeRangeValue = (type: string) => (value: Range | number) => {
if (value instanceof Range) {
return;
}
this.handleValueChange(type, value);
};
and this is the component that uses the method
import InputRange from 'react-input-range';
<InputRange
value={homeValue}
onChange={this.changeRangeValue('homeValue')}
/>
For some reason the app is trying to import Range from one of the libraries i'm using
import("C:/Users/by/Desktop/Projects/maqan-frontend/node_modules/react-input-range/react-input-range").Range
instead of using the appropriate TS interface.
Does anyone know why this is happening and how it stop it?
N.B. This app, with the same packages is working fine with react-scripts-ts
, this bug started when i migrated to react-scripts