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.

Methods like getFirstChildOrThrow should have typeguard overloads

See original GitHub issue

This should be possible to infer automatically, since isBlock is a type guard.

return methodDeclaration.getFirstChildOrThrow(TypeGuards.isBlock)

Right now, we have to explicitly cast it (with a simple as Block at the end).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dsherretcommented, Jul 16, 2018

In 12.6.0.

1reaction
dsherretcommented, Jul 14, 2018

@lazarljubenovic thanks that works!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type guard function overloading is infered not properly ...
prototype.filter . When a function is passed to a parameter, could you explain how the signature is inferred from the overload of the...
Read more >
5 Methods to use Type Guards in TypeScript
Type Guards come into the picture with the usage of TypeScript. This technique is used to identify or narrow down the type of...
Read more >
TypeScript — Make types “real”, the type guard functions
User-Defined Type Guards: write your own Type Guard ; function argument type, like for overloads, should be as open as possible ; user...
Read more >
Documentation - Advanced Types
To define a type guard, we simply need to define a function whose return type is a type ... The in operator also...
Read more >
How to correctly use a type guard when looping through ...
I still need the type guard to ensure I'm on the right branch, but then I have to cast the array, dataArr as...
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