In TypeScript 3.7, a breaking change is introduced affecting local and imported type declarations:
https://devblogs.microsoft.com/typescript/announcing-typescript-3-7-rc/#local-and-imported-type-declarations-now-conflict
This breaks type declarations like this one (https://github.com/mui-org/material-ui-pickers/blob/v3.2.7/lib/src/index.ts):
import { MaterialUiPickersDate } from './typings/date';
export type MaterialUiPickersDate = MaterialUiPickersDate;
Error:
Import declaration conflicts with local declaration of 'MaterialUiPickersDate'
The solution is to simply re-export the type:
export { MaterialUiPickersDate } from './typings/date';
| Tech | Version |
| -------------------- | ------- |
| typescript | 3.7.1-rc |
| @material-ui/pickers | 3.2.7 |
| material-ui | 4.5.2 |
| React | 16.11.0 |
| Browser | Chrome |
| Peer library | [email protected] | |
Code compiles OK.
Error:
Import declaration conflicts with local declaration of 'MaterialUiPickersDate'
I confirm the issue with 3.7.2
Has anyone got any ideas of a workaround for this problem in the meantime? We'd really like to upgrade to TS 3.7 asap.
Found a workaround. Importing from @material-ui/pickers/DatePicker/DatePicker instead of @material-ui/pickers/DatePicker avoids this issue.
Found a workaround. Importing from
@material-ui/pickers/DatePicker/DatePickerinstead of@material-ui/pickers/DatePickeravoids this issue.
@mvestergaard That seems to do it, thanks for the workaround!
@mvestergaard that worked for me, too. Thanks!
WIP
node_modules/@material-ui/core/Portal/Portal.d.ts:2:10 - error TS2440: Import declaration conflicts with local declaration of 'PortalProps'.
2 import { PortalProps } from '../Portal';
getting a error in this.
@deeptikanta Do you have a reproduction with v4.0.0-alpha.5?
@oliviertassinari no
Most helpful comment
Found a workaround. Importing from
@material-ui/pickers/DatePicker/DatePickerinstead of@material-ui/pickers/DatePickeravoids this issue.