Skip to content
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

Could not find a declaration file for module 'luxon' #688

Closed
vajkayrene opened this issue Aug 16, 2023 · 12 comments · Fixed by #689 · May be fixed by a11ywatch/core#420, a11ywatch/core#431 or a11ywatch/core#433
Closed

Could not find a declaration file for module 'luxon' #688

vajkayrene opened this issue Aug 16, 2023 · 12 comments · Fixed by #689 · May be fixed by a11ywatch/core#420, a11ywatch/core#431 or a11ywatch/core#433
Labels
released type:bug Bug reports and bug fixes

Comments

@vajkayrene
Copy link

Description

The following error message is thrown from the cron module (using Typescript):

node_modules/cron/types/index.d.ts:11:26 - error TS7016: Could not find a declaration file for module 'luxon'. '/api/node_modules/luxon/build/node/luxon.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/luxon` if it exists or add a new declaration (.d.ts) file containing `declare module 'luxon';`

The issue is caused by a missing type definition for the luxon library. The docs for the library states it should be installed as a developer dependency separately for typescript.

Screenshots

Screenshot 2023-08-16 at 11 58 11

Additional information

No response

@sheerlox sheerlox self-assigned this Aug 16, 2023
@sheerlox sheerlox added the type:bug Bug reports and bug fixes label Aug 16, 2023
@sheerlox
Copy link
Collaborator

sheerlox commented Aug 16, 2023

You're absolutely right! Typescript cached a version of @types/luxon on my machines, so I didn't notice that error, thank you for reporting the issue!

@vajkayrene
Copy link
Author

You're absolutely right! Typescript cached a version of @types/luxon on my machines, so I didn't notice that error, thank you for reporting the issue!

Yes, I had the same issue. 😄 Typescript cached the library on my local machine and I was scratching my head for 30 minutes about why it fails on the CI/CD server.

@sheerlox
Copy link
Collaborator

If we'd add @types/luxon to this project, it would need to be added to the regular dependencies, so it would be installed for all users (even JS ones). The issue is that the package size is 115 kB while cron is only 59.2 kB.
Would you find installing the @types/cron package in your development dependencies a good solution until we convert the library to TS? If so I'll update the README to include a section about this.

@sheerlox
Copy link
Collaborator

On the other hand luxon is 4.06 MB so I guess adding 115 kB is not the end of the world

@vajkayrene
Copy link
Author

If we'd add @types/luxon to this project, it would need to be added to the regular dependencies, so it would be installed for all users (even JS ones). The issue is that the package size is 115 kB while cron is only 59.2 kB. Would you find installing the @types/cron package in your development dependencies a good solution until we convert the library to TS? If so I'll update the README to include a section about this.

I tried to install @types/cron, but the fact is typescript still gives me the original issue. I was able to fix it by installing @types/luxon to my devDependecies.

@sheerlox
Copy link
Collaborator

sheerlox commented Aug 16, 2023

I'm sorry I made a mistake in my message, I meant @types/luxon indeed 😅
@types/cron is deprecated since we imported their types and now ship them directly within cron.

@sheerlox
Copy link
Collaborator

I've made a PR to add @types/luxon to our dependencies, it should be merged soon :) thanks for the heads up!

@vajkayrene
Copy link
Author

No problem, thanks for the quick fix!

@sheerlox sheerlox mentioned this issue Aug 16, 2023
9 tasks
sheerlox added a commit that referenced this issue Aug 26, 2023
## Description
- added `@types/luxon` to dependencies
- updated Luxon from `v3.2.1` to `v3.3.0` (avoided `v3.4.0` since types
aren't available for that version yet).

## Related Issue
Fixes #688.

## Motivation and Context
This library needs to depend on `@types/luxon` since we now export our
own types. See the related issue for the error this fixes.

## How Has This Been Tested?
- checked that TypeScript now correctly loads the Luxon types
- ran tests locally

## Types of changes
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:
- [X] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [X] All new and existing tests passed.
- [ ] If my change introduces a breaking change, I have added a `!`
after the type/scope in the title (see the Conventional Commits
standard).
ncb000gt pushed a commit that referenced this issue Aug 26, 2023
## [2.4.2](v2.4.1...v2.4.2) (2023-08-26)

### 🐛 Bug Fixes

* **deps:** update dependency luxon to v3.3.0 & add [@types](https://github.com/types)/luxon ([#689](#689)) ([c95a449](c95a449)), closes [#688](#688)
@ncb000gt
Copy link
Member

🎉 This issue has been resolved in version 2.4.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@SirAndrii
Copy link

SirAndrii commented Aug 31, 2023

I've made a PR to add @types/luxon to our dependencies, it should be merged soon :) thanks for the heads up!
Hi, after update and clean build I started receiving
node_modules/@types/luxon/src/settings.d.ts:27:16 - error TS2380: 'get' and 'set' accessor must have the same type.

27 static get defaultZone(): Zone;
~~~~~~~~~~~

node_modules/@types/luxon/src/settings.d.ts:28:16 - error TS2380: 'get' and 'set' accessor must have the same type.

28 static set defaultZone(zone: Zone | string);
image

To fix it, I needed to downgrade back to 2.4.0 version. My current TS version is 4.2.3

@sheerlox
Copy link
Collaborator

sheerlox commented Sep 1, 2023

@SirAndrii thanks for reporting on this, let's track this here: #692

sheerlox added a commit to sheerlox/node-cron that referenced this issue Sep 10, 2023
…ktiv#689)

## Description
- added `@types/luxon` to dependencies
- updated Luxon from `v3.2.1` to `v3.3.0` (avoided `v3.4.0` since types
aren't available for that version yet).

## Related Issue
Fixes kelektiv#688.

## Motivation and Context
This library needs to depend on `@types/luxon` since we now export our
own types. See the related issue for the error this fixes.

## How Has This Been Tested?
- checked that TypeScript now correctly loads the Luxon types
- ran tests locally

## Types of changes
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:
- [X] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [X] All new and existing tests passed.
- [ ] If my change introduces a breaking change, I have added a `!`
after the type/scope in the title (see the Conventional Commits
standard).
ncb000gt pushed a commit that referenced this issue Sep 10, 2023
## [3.0.0-beta.4](v3.0.0-beta.3...v3.0.0-beta.4) (2023-09-10)

### 🐛 Bug Fixes

* **deps:** update dependency luxon to v3.3.0 & add [@types](https://github.com/types)/luxon ([#689](#689)) ([c95a449](c95a449)), closes [#688](#688)
* fix range parsing when upper limit = 0 ([#687](#687)) ([d96746f](d96746f))

### 🚨 Tests

* add TS types check ([#690](#690)) ([f046016](f046016))
@ncb000gt
Copy link
Member

🎉 This issue has been resolved in version 3.0.0-beta.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

patrickm68 added a commit to patrickm68/node-cron-types that referenced this issue Sep 14, 2023
## [2.4.2](kelektiv/node-cron@v2.4.1...v2.4.2) (2023-08-26)

### 🐛 Bug Fixes

* **deps:** update dependency luxon to v3.3.0 & add [@types](https://github.com/types)/luxon ([#689](kelektiv/node-cron#689)) ([c95a449](kelektiv/node-cron@c95a449)), closes [#688](kelektiv/node-cron#688)
sheerlox added a commit that referenced this issue Sep 27, 2023
## Description
- added `@types/luxon` to dependencies
- updated Luxon from `v3.2.1` to `v3.3.0` (avoided `v3.4.0` since types
aren't available for that version yet).

## Related Issue
Fixes #688.

## Motivation and Context
This library needs to depend on `@types/luxon` since we now export our
own types. See the related issue for the error this fixes.

## How Has This Been Tested?
- checked that TypeScript now correctly loads the Luxon types
- ran tests locally

## Types of changes
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:
- [X] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [X] All new and existing tests passed.
- [ ] If my change introduces a breaking change, I have added a `!`
after the type/scope in the title (see the Conventional Commits
standard).
sheerlox pushed a commit that referenced this issue Sep 27, 2023
## [2.4.2](v2.4.1...v2.4.2) (2023-08-26)

### 🐛 Bug Fixes

* **deps:** update dependency luxon to v3.3.0 & add [@types](https://github.com/types)/luxon ([#689](#689)) ([c95a449](c95a449)), closes [#688](#688)
sheerlox added a commit to sheerlox/node-cron that referenced this issue Sep 27, 2023
…ktiv#689)

## Description
- added `@types/luxon` to dependencies
- updated Luxon from `v3.2.1` to `v3.3.0` (avoided `v3.4.0` since types
aren't available for that version yet).

## Related Issue
Fixes kelektiv#688.

## Motivation and Context
This library needs to depend on `@types/luxon` since we now export our
own types. See the related issue for the error this fixes.

## How Has This Been Tested?
- checked that TypeScript now correctly loads the Luxon types
- ran tests locally

## Types of changes
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:
- [X] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [X] All new and existing tests passed.
- [ ] If my change introduces a breaking change, I have added a `!`
after the type/scope in the title (see the Conventional Commits
standard).
sheerlox pushed a commit to sheerlox/node-cron that referenced this issue Sep 27, 2023
## [2.4.2](kelektiv/node-cron@v2.4.1...v2.4.2) (2023-08-26)

### 🐛 Bug Fixes

* **deps:** update dependency luxon to v3.3.0 & add [@types](https://github.com/types)/luxon ([kelektiv#689](kelektiv#689)) ([c95a449](kelektiv@c95a449)), closes [kelektiv#688](kelektiv#688)
sheerlox added a commit to sheerlox/node-cron that referenced this issue Sep 29, 2023
…ktiv#689)

## Description
- added `@types/luxon` to dependencies
- updated Luxon from `v3.2.1` to `v3.3.0` (avoided `v3.4.0` since types
aren't available for that version yet).

## Related Issue
Fixes kelektiv#688.

## Motivation and Context
This library needs to depend on `@types/luxon` since we now export our
own types. See the related issue for the error this fixes.

## How Has This Been Tested?
- checked that TypeScript now correctly loads the Luxon types
- ran tests locally

## Types of changes
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:
- [X] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [X] All new and existing tests passed.
- [ ] If my change introduces a breaking change, I have added a `!`
after the type/scope in the title (see the Conventional Commits
standard).
sheerlox pushed a commit to sheerlox/node-cron that referenced this issue Sep 29, 2023
## [2.4.2](kelektiv/node-cron@v2.4.1...v2.4.2) (2023-08-26)

### 🐛 Bug Fixes

* **deps:** update dependency luxon to v3.3.0 & add [@types](https://github.com/types)/luxon ([kelektiv#689](kelektiv#689)) ([c95a449](kelektiv@c95a449)), closes [kelektiv#688](kelektiv#688)
sheerlox added a commit to sheerlox/node-cron that referenced this issue Sep 29, 2023
…ktiv#689)

## Description
- added `@types/luxon` to dependencies
- updated Luxon from `v3.2.1` to `v3.3.0` (avoided `v3.4.0` since types
aren't available for that version yet).

## Related Issue
Fixes kelektiv#688.

## Motivation and Context
This library needs to depend on `@types/luxon` since we now export our
own types. See the related issue for the error this fixes.

## How Has This Been Tested?
- checked that TypeScript now correctly loads the Luxon types
- ran tests locally

## Types of changes
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:
- [X] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [X] All new and existing tests passed.
- [ ] If my change introduces a breaking change, I have added a `!`
after the type/scope in the title (see the Conventional Commits
standard).
@sheerlox sheerlox removed their assignment Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment