-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript errors #168
Comments
Working for me with this implementation: // holidays.ts
import * as DateHolidays from 'date-holidays';
const holidays = new DateHolidays.default();
holidays.init('FR');
export default holidays; |
Thanks, I'll try that one out. But it seems to be more of a workaround than a fix on the behalf of this library. |
Nope, still the same error. it doesn't even recognize the |
I have same error on 3.2.0 |
I got the same issue. tsconfig.json
sample
|
im using import Holidays, * as HolidayDefinition from 'date-holidays';
const germanCountryHolidays = new (HolidayDefinition as any)('de') as Holidays;
console.log(germanCountryHolidays.getHolidays(2021)) |
I'm also seeing this issue with fresh create-react-app starting in version 3. |
This help me for that issue in Typescript. |
I used this to make it work. This issue is also open since more than a year, if you don't intend to fix it, would be nice at least to update documentation. |
This was the only form that worked for me, but it's the jankiest import I've ever used. Is there a straightforward way that the typescript support could be improved? |
Following up on @winterec comment...I have to agree with him. Is there going to be a better Typescript support for this library? |
3.16.14 works fine with typescript 4.8.4
|
I stopped using this library, since my usecase was very small and I was able to use the Gauss Algorithm for detecting Easter Sunday. Everything else can be built on top of Easter Sunday. |
Maybe related: the published types for (cc @commenthol)
|
Also some 2 errors and 2 warnings on
|
Still having this same issue when running test on date-holidays version 3.23.8 see here: |
I tried several configurations when trying to use typescript with this library:
Initial setup
tsconfig.json
:My usage
results in
node
,ts-node
andtsnd
:this is what I got after replacing the
import * as Holidays ...
withimport Holidays ...
:...with
Ranker.ts:14:28
being the lineconst holidays: Holidays = new Holidays();
Maybe this is related to #102 but they didn't give any useful info on the issue so I hope this helps!
If you don't know any fix to this, could you provide a known good
tsconfig.json
? Maybe my compiler settings are not the way you tested with TS.[Edit 1]
I used all of the settings of your
types/tsconfig.json
but with the same result:TypeError: date_holidays_1.default is not a constructor
The text was updated successfully, but these errors were encountered: