Material-ui-pickers: No default export

Created on 25 Oct 2018  路  5Comments  路  Source: mui-org/material-ui-pickers

After upgrading to version ^1.0.0 there is an typescript error.

Environment

| Tech | Version |
|---------------------|---------|
| material-ui-pickers | ^1.0.0 |
| material-ui | ^3.3.1 |
| React | ^16.6.0 |
| Browser | irrelevant |
| Peer library | "date-fns": "2.0.0-alpha.16" |

Error

/node_modules/material-ui-pickers/utils/date-fns-utils/index.d.ts (2,8): Module ''date-fns/locale/en-US'' has no default export.

Workaround

Until this is fixed, you can use "skipLibCheck": true option in your tsconfig.json.

Most helpful comment

PR is appreciated

All 5 comments

Could you enable esModuleInterop option in ts config?

Yep, that solves the problem. Could you mention it in docs or somewhere else, because the default for this option is false. (https://www.typescriptlang.org/docs/handbook/compiler-options.html)

PR is appreciated

Would not be better to fix it for date-fns as it is suggested for moment in this PR https://github.com/dmtrKovalenko/material-ui-pickers/pull/712 ?

I don't think so. Default behaviour is wrong and makes ecosystem broken. Imported namespace cannot be callable.

Was this page helpful?
0 / 5 - 0 ratings