Error import/default when importing react-date-picker
See original GitHub issueI want to import “react-date-picker” (https://github.com/wojtekmaj/react-date-picker) in a Typescript source file:
import DatePicker from 'react-date-picker'
When I use “eslint-import-resolver-typescript” by applying this snippet
settings: {
"import/resolver": {
"typescript": {}
}
}
in .eslintrc.js there’s an error
1:8 error No default export found in imported module "react-date-picker" import/default
However, “react-date-picker” contains this default:
declare module "react-date-picker" {
export default function DatePicker(props: DatePickerProps): JSX.Element;
...
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Webpack error importing Date picker · Issue #546 - GitHub
Hi, I'm new in webpack and React. When trying to use this library with webpack could not import it. this is the error:...
Read more >Attempted import error: 'DatePicker' is not exported from 'gestalt'
I want to use DatePicker in gestalt but getting errors like the title. Everything else provided gestalt such as TextField, Box, ...
Read more >Upgraded to TS 4.6, getting error for __importDefault - Reddit
Just add this __importDefault definition to webpack, and this will start working, but I am unable to understand, why is is importing this ......
Read more >@y0c/react-datepicker - npm
Start using @y0c/react-datepicker in your project by running `npm i ... import Calendar Component import React, { Component } from 'react'; ...
Read more >Adding Styles to the React Date Picker - DevCamp
In this video we're going to start by styling our date picker. So let's go back to the react date picker. And you'll...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Okay, thanks! So I won’t report it against the resolver for the time being.
@jeffrson
The typings file in
react-date-picker
can be omitted asThe
declare module
block is just redundant as its own declaration file.I’ve raised https://github.com/wojtekmaj/react-date-picker/pull/419 to cleanup.