-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
What happened?
The typescript typing definitions for the date utils getMaxDate and getMinDate functions are incorrect. As a result, using these functions in typescript with a spread operator raises a TS2556 error.
The typings should not require the first date argument be passed separately from the remainder and should instead define a single rest parameters. i.e.
function getMaxDate(
...args: (Date | number | string)[]
): Date;
function getMinDate(
...args: (Date | number | string)[]
): Date;What did you expect to happen?
The getMaxDate and getMinDate utility functions can be used with an array spread operator, as shown in the docs, without causing the incorrect typescript compiler TS2556 error.
Reproduction URL
https://jsfiddle.net/zp29djhy/1/
How to reproduce?
- Setup a project including quasar and typescript
- In a typescript file include the following code using a spread operator with getMaxDate
import { date } from 'quasar';
const exampleDates: Date[] = [ new Date(2025, 1, 25, 10, 30), new Date(2025, 1, 26, 10, 30), new Date(2025, 1, 27, 10, 30) ];
const maxDate = date.getMaxDate(...exampleDates);- Run the typescript compiler to type check for errors. The
...exampleDatesspread will raise a TS2556 error.
NOTE: I include a jsFiddle link with this code since the issue template says it is required, but this is a build time issue not a runtime issue so the bug is not reflected in the jsfiddle itself.
Flavour
Vite Plugin (@quasar/vite-plugin)
Areas
TypeScript Support
Platforms/Browsers
No response
Quasar info output
Relevant log output
Additional context
No response