Closed mebibou closed 2 years ago
@mebibou Have you tried this:
df.drop({ columns, inplace: false })?.to_csv();
?
is when the function can be undefined
, doesn't circumvent the void
. Same error
The only thing that currently works is (df.to_csv() as DataFrame)
. Works but not pretty
FYI, this can be fixed this way: https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads
FYI, this can be fixed this way: https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads
Thanks for sharing. Would you like to work on this fix?
hum maybe later, I currently cant even use the library because I am on a M1 Mac so...
FIXED and released in the latest TS version.
If you need help migrating to the latest version, see: https://danfo.jsdata.org/examples/migrating-to-the-stable-version-of-danfo.js
Describe the bug
When using typescript and operation like
drop
, it cannot be chained directly to another operation or the compiler will throw an error likeProperty 'to_csv' does not exist on type 'void | DataFrame'.\n Property 'to_csv' does not exist on type 'void'.
To Reproduce
Expected behavior
It should return
void
only when usinginplace: true
. Currently it assumes it could be both, but the parameters should infer which return type it expects.Typescript version
3.9.10
anddanfojs-node
version0.3.3
used