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
I'm attempting to use a functional programming style to the extent it is possible to do so using the JavaScript frameworks I am using.
As part of this effort, I am defining my arguments and data constructs as readonly using TypeScript so that my data is not mutable.
However, I am experiencing an issue with Victory in that the TypeScript interface for the data property (on the VictoryLine component for example) cannot accept a readonly value because its typescript definition is using the mutable any type.
I get the following error:
The type 'ChartData' is 'readonly' and cannot be assigned to the mutable type 'any[]'.
In limited testing I tried changing the definition for the data property from any[] to any[] | readonly any[] and this solved the TypeScript error, but I haven't tested this properly.
If this issue is accepted, and the above is deemed an acceptable solution, then I will create a PR that modifies the TypeScript interfaces in the correct places.
The text was updated successfully, but these errors were encountered:
Thanks for reporting this issue! We have been working on a Typescript conversion on our end, and there might be some kinks to work out with some of the typings. FYI @scottrippey.
The Problem
I'm attempting to use a functional programming style to the extent it is possible to do so using the JavaScript frameworks I am using.
As part of this effort, I am defining my arguments and data constructs as readonly using TypeScript so that my data is not mutable.
However, I am experiencing an issue with Victory in that the TypeScript interface for the
data
property (on theVictoryLine
component for example) cannot accept a readonly value because its typescript definition is using the mutableany
type.I get the following error:
The type 'ChartData' is 'readonly' and cannot be assigned to the mutable type 'any[]'.
Reproduction
https://codesandbox.io/s/winter-tree-00wu4z?file=/index.tsx
Potential Solution
In limited testing I tried changing the definition for the
data
property fromany[]
toany[] | readonly any[]
and this solved the TypeScript error, but I haven't tested this properly.If this issue is accepted, and the above is deemed an acceptable solution, then I will create a PR that modifies the TypeScript interfaces in the correct places.
The text was updated successfully, but these errors were encountered: