question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typing issue with void functions

See original GitHub issue

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 like Property 'to_csv' does not exist on type 'void | DataFrame'.\n Property 'to_csv' does not exist on type 'void'.

To Reproduce

import { DataFrame } from 'danfojs-node';

const df = new DataFrame([]);
df.drop({ columns, inplace: false }).to_csv();

Expected behavior

It should return void only when using inplace: true. Currently it assumes it could be both, but the parameters should infer which return type it expects.

Typescript version 3.9.10 and danfojs-node version 0.3.3 used

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mebiboucommented, Oct 12, 2021

hum maybe later, I currently cant even use the library because I am on a M1 Mac so…

1reaction
mebiboucommented, Oct 11, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Functions 2: Void (NonValue-Returning) Functions
Void functions are created and used just like value-returning functions except they do not return a value after the function executes.
Read more >
Why any type can be assigned void* but I can not return void ...
void is an incomplete type; it does not specify an integer type, a floating-point type, a structure type, or any other specific type....
Read more >
2.3 — Void functions (non-value returning functions) - Learn C++
A void function will automatically return to the caller at the end of the function. No return statement is required.
Read more >
Optional typing in GDScript: Allow return "void" from ... - GitHub
One reason you might need it is if you are calling a function that you don't know in advance, like if it is...
Read more >
Void in TypeScript - TutorialsTeacher
TypeScript Data Type - Void ... Similar to languages like Java, void is used where there is no data. For example, if a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found