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 I try use automatically generated data with data accessors like in this example in typescript I get this error:
Type error: Property 'x' does not exist on type 'object'.
91 | samples={100}
92 | style={{ data: { strokeWidth: 1 } }}
> 93 | y={(data) => Math.sin(data.x)}
I could not find a good way from victory to type this and ended up having to do all of this to make it work with typescript:
const sinX: DataGetterPropType = (d) => {
let x = 0
for (const [key, value] of Object.entries(d)) {
if (key == 'x') {
x = value
}
}
return Math.sin( x)
}
and use sinX as the data accessor. This is obviously pretty inconvenient, is this on your radar? Is there a better way I missed? Should I make and issue from this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When I try use automatically generated data with data accessors like in this example in typescript I get this error:
I could not find a good way from
victory
to type this and ended up having to do all of this to make it work with typescript:and use
sinX
as the data accessor. This is obviously pretty inconvenient, is this on your radar? Is there a better way I missed? Should I make and issue from this?Here is my full chart for reference:
Beta Was this translation helpful? Give feedback.
All reactions