You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a let chartInstance: Chart<TType> where TType is a generic such that: TType extends ChartType, accessing chartInstance.config.options?.plugins should cause no problems.
Current behavior
When using a let chartInstance: Chart<TType> where TType is a generic such that: TType extends ChartType, it turns out that accessing chartInstance.config.options?.plugins causes the following error:
Property 'plugins' does not exist on type '_DeepPartialArray<unknown> | (CoreChartOptions<TType> & ElementChartOptions<TType> & PluginChartOptions<TType> & DatasetChartOptions<...> & ScaleChartOptions<...>) | (Function & ... 4 more ... & ScaleChartOptions<...>) | _DeepPartialObject<...>'.
Property 'plugins' does not exist on type '_DeepPartialArray<unknown>'.(2339)
Most likely, to the ChartOptions interface, some part of the code introduces a DeepPartial<unknown[]> or alike. This results in ChartOptions<ChartType> being a union containing _DeepPartialArray<unknown>, which in turn breaks everything.
The most primitive and functional solution is excluding it manually from the ChartOptions type by wrapping the DeepPartial<...> with Exclude<..., DeepPartial<unknown[]>>.
Context
No response
chart.js version
4.4.3
Browser name and version
No response
Link to your project
No response
The text was updated successfully, but these errors were encountered:
Expected behavior
When using a
let chartInstance: Chart<TType>
whereTType
is a generic such that:TType extends ChartType
, accessingchartInstance.config.options?.plugins
should cause no problems.Current behavior
When using a
let chartInstance: Chart<TType>
whereTType
is a generic such that:TType extends ChartType
, it turns out that accessingchartInstance.config.options?.plugins
causes the following error:Reproducible sample
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYQBYENYBoUdgFQE8wBTOAXzgDMoIQ4ByAYzxgDoArAZwYG4BYAFBCAbpjhMYADzgBeOABMITAK4gSAO3YBzEjACiAGxLqtAIUIBJBQAoARCEJpMMOwEo46LnAAS+ALIAMsjoGmJcRiaaMAKCYlBwjs6wcnAaJADuuC42klI4CEJwxXAwxCQAXIwARirV1cYMWEUlCugw6FWFgiW9cIbo1SSGXFUA2nYASiQKdjh2ZoYqJHNwdgCaw4YQGat2AOJQJJp7AAoqUGDGewDyUKG6dgC6zT19xW0dXHqjcGPd73eAyGhiqDAAxHAIFQ4AA1CAwEg8V6AvqfTp-ACMACYcJiAJw4ADMOAArDhcXAiS8Wu9yE9aRQUSUIGAYMAIBpfgC+lwmOhjNzGb0pF1hX1xcVyMz3oQxW9UZKKOLyIzVYJyG5YkIqCoNJIORo4LoYKcltpgFybmzDVwADz4IikOAkKSIjQKbzJGBOkgAPlyrCq3odvr9bh5RxgFyNLBcbFZ7M5XAA-GwrioLVzYuqgA
Optional extra steps/info to reproduce
No response
Possible solution
Most likely, to the
ChartOptions
interface, some part of the code introduces aDeepPartial<unknown[]>
or alike. This results inChartOptions<ChartType>
being a union containing_DeepPartialArray<unknown>
, which in turn breaks everything.The most primitive and functional solution is excluding it manually from the
ChartOptions
type by wrapping theDeepPartial<...>
withExclude<..., DeepPartial<unknown[]>>
.Context
No response
chart.js version
4.4.3
Browser name and version
No response
Link to your project
No response
The text was updated successfully, but these errors were encountered: