[3.16.5][Typescript] 1:20 error HolidaysTypes not found in 'date-holidays' import/named
MartinX3 opened this issue · 2 comments
MartinX3 commented
It happens now and worked before.
eslint --ext ".js,.ts,.vue" --ignore-path .gitignore --fix .
1:20 error HolidaysTypes not found in 'date-holidays' import/named
✖ 1 problem (1 error, 0 warnings)
Process finished with exit code 1
IntelliJ tells me
ESLint: HolidaysTypes not found in 'date-holidays'(import/named)
My code
import Holidays, { HolidaysTypes } from 'date-holidays'
import EventBuilder from '~/models/builder/events/calendar/EventBuilder'
import EEvent from '~/models/enums/EEvent'
export default function useCalendar() {
const holidays = new Holidays('DE', { languages: ['de'] })
return {
getHolidays: (year: number) =>
holidays.getHolidays(year).map((it: HolidaysTypes.Holiday) => new EventBuilder().allDay(true).category(EEvent.Feiertag).date(it.start, it.end).name(it.name).build()),
}
}
commenthol commented
HI @MartinX3,
I am sorry but I can't help here. The type definitions have not been touched for some while.
So please try to be more specific and try to reproduce which version works and since when it is broken.
Please also make sure that your tsconfig matches your project changes...
Feel free to reopen the issue if you have more information for us.
MartinX3 commented
I fixed it by using
import Holidays, * as DateHolidays from 'date-holidays'
it: DateHolidays.HolidaysTypes.Holiday
Maybe caused by import-js/eslint-plugin-import#1883 or import-js/eslint-plugin-import#1845 while using up to date packages.