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.

TypeScript type errors for op methods.

See original GitHub issue

Problem

TypeScript compiler complains when using op as documented.

However, the library functions correctly.

Steps to reproduce

import * as aq from "arquero";

aq.from([{ a: 1 }, { a: 2 }])
  // Error: Type 'number' is not assignable to type 'string | TableExpr'. ts(2322)
  .rollup({ max: aq.op.sum("a") })
  .objects();

Expected Behavior

No compiler error

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jheercommented, May 26, 2021

Thanks for pointing this out. This is a regression due to the more recent “fixes”. I’ll need to look into what support (if any) tsc has for defining overloaded functions from JSDoc.

1reaction
jheercommented, May 19, 2021

Thanks! The types are indeed wrong here. I’ll look into fixing this soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Advanced Types - TypeScript
This page lists some of the more advanced ways in which you can model types, it works in tandem with the Utility Types...
Read more >
Type-Safe Error Handling In TypeScript - DEV Community ‍ ‍
In this post, I introduce the concept of a Result type, which eliminates the need for throwing exceptions, and reduces risk of runtime ......
Read more >
How to declare a function that throws an error in Typescript
There is no such feature in TypeScript. It's possible to specify error type only if a function returns an error, not throws it...
Read more >
Error handling in TypeScript like a pro - Journal - Plain
To start us off I'd like to make a distinction between two types of errors: expected business errors and unexpected errors.
Read more >
A functional (programming) approach to error handling in ...
A functional (programming) approach to error handling in Typescript. Typescript and Javascript provide an error handling strategy based on the try/catch syntax ...
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