moment / luxon

⏱ A library for working with dates and times in JS
https://moment.github.io/luxon
MIT License
15.05k stars 728 forks source link

`defaultWeekSettings` does not exist on type `typeof Settings` #1561

Closed hokwanhung closed 6 months ago

hokwanhung commented 6 months ago

Describe the bug I am trying to override the defaultWeekSettings for the MUI Date Calendar with TypeScript. However, it appears that TypeScript does not find the type in Settings.js.

To Reproduce Edit luxon-defaultWeekSettings-error-with-TypeScript

Actual vs Expected behavior Actual behaviour: The below TypeScript error occurs.

TS2339: Property 'defaultWeekSettings' does not exist on type 'typeof Settings'.

Expected behaviour: Can successfully get the defaultWeekSettings without any errors.

Desktop (please complete the following information):

Additional context Suspected related parts of code in Settings.js:

  /**
   * @typedef {Object} WeekSettings
   * @property {number} firstDay
   * @property {number} minimalDays
   * @property {number[]} weekend
   */

  /**
   * @return {WeekSettings|null}
   */
  static get defaultWeekSettings() {
    return defaultWeekSettings;
  }
diesieben07 commented 6 months ago

Do you have @types/luxon installed? Typescript types for Luxon are not part of this project, they are maintained by DefinitelyTyped: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/luxon They do not contain the defaultWeekSettings yet. I suggest you open an issue there.

hokwanhung commented 6 months ago

@diesieben07 Yes, I have @types/luxon installed; thank you for your comments, and I will transfer the issue there. Great thanks and hope you had a lovely New Year's Eve.