Skip to content

Moving from 4.3.0 to 4.3.1 break most of my already existing code due to types #11420

@dperera-innerspec

Description

@dperera-innerspec

Expected behavior

Updating a patch version shouldn't cause types to start bleeding or crash. This has already happened before already. I get that this is to ease development, but having 2 different types for a value doesn't seem like a good practice.

Current behavior

It seems the new types for many structures like legend and tooltips have been allowed to be either a boolean or a structure, so when updating legend.display or tooltips.enable the types will crash.

Reproducible sample

https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgYQBYENZwL5wGZQQhwDkAxhrAHQBWAziQNwCwAUGwG6ZxkwAecALxwAJhDIBXEAFMAdjCoBzaTACiAG2kz5AIQCeASREAKAEQg9aTDFMBKOOjpwAEgBUAsgBlk6WVzoaWnIwLKxcUHAWVljCstIA7iiUMMa8fAA0iGxwcDB6YNIAXKTqwHEk6dmi6DDoxQhVOeroAEbS6nTFANqmAErSIqaZpjrqEtJDcKYAmu3qEPGTpgDiUNJySwAKElBgmksA8lC+yqYAupWsOTkiNY4qnXBdDVfXTa3txSQAxHAQeHAAGoQGDSBiXN43O7dACMACZMjCAJyZADMmQArJkEXBURdGjgzlVsBC-mAYMAILJHi83nsJIoyjSCTkYBAIOoKWB6izrnJWpoRMU8OgOtJedgCSSCXQyKKwTzXm8+IqJaS3npVUrrpLtbqcrrsLZQmxgADjFFklQIOTKdSqPTGdSAPxUNkcrlwACEsQk6nUtiqlus1ttVLoDrGToj7s5wDAVH5LUFQlyUHGjCAA

Optional extra steps/info to reproduce

No response

Possible solution

Either keep the old structure instead of a boolean / structure format; or add a property "enable" that will act as the new boolean so when false the rest of properties do not need to be set.

Context

No response

chart.js version

v4.3.1

Browser name and version

No response

Link to your project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions