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

TimeScaleTimeOptions requires parser #12003

Open
rtmotiondev opened this issue Jan 18, 2025 · 0 comments
Open

TimeScaleTimeOptions requires parser #12003

rtmotiondev opened this issue Jan 18, 2025 · 0 comments
Labels
type: bug type: types Typescript type changes

Comments

@rtmotiondev
Copy link

Expected behavior

parser in TimeScaleTimeOptions should be optional.

Current behavior

Why is parser a required field for TimeScaleTimeOptions?

When using a date adapter like chartjs-adapter-date-fns, everything is already set up, so there’s no need to specify the parser again. However, in this case, we are forced to do so, and there’s no clean way to obtain the underlying parser.

        const scaleFormat: TimeScaleTimeOptions = {
            unit: "year",
            displayFormats: {
                month: "yy",
            },
            tooltipFormat: "eeee, MMM dd, yyyy",
            parser: ??,
            round: false,
            isoWeekday: false,
            minUnit: "millisecond"
        };

"chart.js": "^4.4.7",
"chartjs-adapter-date-fns": "^3.0.0",

Reproducible sample

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYQBYENYBo4BVQCmAygMboA2B+IBA8mDMBAHYDOcAvnAGZQQhwA5CQywAdACtWggNwBYAFCKA9MrgB1VAWZwArq2DMA5nHRwAJuhgFTlhgShxywANY2RmGFIC06O9ahvS2tvbjY4AgA3BwBPGFRDE2B2CigCPxi4VgIYXTAsiDh4hwJBdmZC5gICcyLC1jACEmBuTOK4MExsx3QjdEMxOEUSFlZ4VjJKADFoECsALjxCUgoqQnpGUbgAXkRFOAO9ZmAYRYAiGPSoM6x9w-NksHJ0GJmoOZhWRYQ7w8OQFjxc4xGI3X6cW4KP4wCAQciMMBvD7narVHAAWUxFnMOBBILBUMOnSg3XOBL+fF0zHMi24FGykL+yQg6mqLksMVp9IIjP+hgAqsdTnAziBgORnNkRtSzooOPIlIrIpg4CQYAAPHYWCAkXQ0ZgwMRGHIAUUo+pgACEYgBJcwAClFMTQnjOAEpTOwABK4dEAGWQ6GYytYZoIFoVyscIGdonguyqAHcUHH7Wr1TgfoSDjAYo1FoJnFVBLyDsF0N9wX9ngAjAjkL5wADaZwASjUbiLLeRdARO2cAJr18gQRP9gDiaW0-YACrooE8+zgzrQoEHjWcALqlv4WKzobKfRZNrO7s9OdB18gFgDEcAg3DgADUINZpDvz3uYBXmwBGABMOC-gAnDgADMOAAKw4IBcBgduVaHBwm7ghwO4QAwTBsJW2aHBMqyNqe57qjhn4HIhBxoRRcCcnsuFntRHCIUxuEsRwboyEAA

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

Using chartjs with Typescript in strict mode

chart.js version

4.4.7

Browser name and version

No response

Link to your project

No response

@LeeLenaleee LeeLenaleee added the type: types Typescript type changes label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug type: types Typescript type changes
Projects
None yet
Development

No branches or pull requests

2 participants