Giter Club home page Giter Club logo

Comments (6)

commenthol avatar commenthol commented on July 16, 2024

Hi, I personally don't use typescript in my projects so I can't help with this. Sorry...
@johnolos could you please help here?

from date-holidays.

johnolos avatar johnolos commented on July 16, 2024

I'll take a look once I got time. Just saw this now.

For the record, we use this in our code-base and it's working just fine. What TypeScript version are you using?

Our tsconfig.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "outDir": "build/dist",
    "module": "esnext",
    "target": "es5",
    "lib": ["es2017", "dom"],
    "sourceMap": true,
    "allowJs": true,
    "jsx": "react",
    "moduleResolution": "node",
    "rootDir": "src",
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "strictNullChecks": false,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": true,
    "allowSyntheticDefaultImports": true
  },
  "exclude": [
    "node_modules",
    "build",
    "scripts",
    "acceptance-tests",
    "webpack",
    "jest",
    "src/setupTests.ts"
  ]
}

from date-holidays.

commenthol avatar commenthol commented on July 16, 2024

@tonakai Any news on this issue from your side?

from date-holidays.

tonakai avatar tonakai commented on July 16, 2024

hi,
sorry i must have missed the emails,
similar to #45 my tsconfig contains, "module": "commonjs", changing it to esnext causes bunch of errors on other imports, looks like a similar issue however this is a node project instead of angular

from date-holidays.

commenthol avatar commenthol commented on July 16, 2024

@tonakai this problem seams to be unrelated to this project. Could you please confirm by closing this issue?

from date-holidays.

pero5ar avatar pero5ar commented on July 16, 2024

I'm having the same issue, the problem is that the module is exported as module.exports = Holiday, and typings for those kinds of exports should look like export = Holiday, export default Holidays could be used if the module was exported something like module.exports = { ...Holiday, default: Holiday } (the default property needs to have a value if you want to use a default import).

Note that when you do change the typings to export = ... you might encounter this issue and you have to import it as import * as Holidays from 'date-holidays'.
Because of the linked issue, you'll probably need to somehow exclude the entire typings file and write your own.

The way I resolved this issue was to fall back to date-holidays: 1.2.7 (the last version without typings) and wrote my own version of the typings.
There is probably a better way to do this, but going back to an old version wasn't really an issue for my project so it was the easiest for me.

In case someone asks, my tsconfing.json has module: "commonjs" and I'm using Typescript version 3.3.3333

from date-holidays.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.