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

dayjs.locale() defined incorrectly in typescript #870

Closed
gregveres opened this issue Apr 15, 2020 · 1 comment · Fixed by #871
Closed

dayjs.locale() defined incorrectly in typescript #870

gregveres opened this issue Apr 15, 2020 · 1 comment · Fixed by #871
Labels

Comments

@gregveres
Copy link

Describe the bug
The docs page for checking local says that you can call dayjs.locale() with no arguments to get the currently loaded locale. However, the type definition does not allow this. The current definition says that a parameter called preset must be present. This causes typescript to forbid calling locale with no arguments.

Expected behavior
I expected to be able to call locale from typescript like this:

dayjs.locale();

but that is a syntax error

I would have expected the locale definition to be one of the following:

  export function locale(preset?: string | ILocale, object?: Partial<ILocale>, isLocal?: boolean): string

Information

  • Day.js Version: 1.8.24
  • OS: windows
  • Browser: compile time problem w/ TS
  • Time zone: EST
@iamkun
Copy link
Owner

iamkun commented Apr 21, 2020

🎉 This issue has been resolved in version 1.8.25 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants