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.

shared return type / throws / emits / requires

See original GitHub issue

When you have a polymorphic function and all its signatures share the same return type/throws/emits/requires, it should be written only once. Obviously only allowed if everything is shared.

e.g.

interface Options {
  capture: Boolean,
  once: Boolean,
  passive Boolean,
  mozSystemGroup: Boolean
}

interface addEventListener {
  (type: String, listener: Function | Event, Options?),
  (type: String, listener: Function | Event, useCapture: Boolean),
  (type: String, listener: Function | Event, useCapture: Boolean, wantsUntrusted?: Boolean)
} => Void




/*
} => Type,
  throws: ErrorType,
  requires: example,
  emits: { … }
*/

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ericelliottcommented, Sep 27, 2016

I love this.

0reactions
Mouvediacommented, Mar 28, 2017

Well I won’t address this issue in that PR. Let’s KISS.

Ill just add the alternative form.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS Swift Combine: Emit Publisher with single value
The flatMap operator requires the transform to return a fixed Publisher type, but it doesn't have to return AnyPublisher .
Read more >
Error handling in Combine explained with code examples
Error handling in Swift Combine explained by covering operators like mapError, catch, replaceError, assertOnFailure, and how to map to the ...
Read more >
ILGenerator.ThrowException(Type) Method - Microsoft Learn
The following code sample demonstrates the contextual usage of ThrowException to throw an exception inside the MSIL of a dynamic method.
Read more >
Mono (reactor-core 3.5.1)
Returns a Mono that emits a Boolean value that indicates whether two Publisher sequences are the same by comparing the items emitted by...
Read more >
TSConfig Reference - Docs on every TSConfig option
Controls whether TypeScript will emit a byte order mark (BOM) when writing output files. Some runtime environments require a BOM to correctly interpret...
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