Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typed-emitter

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-emitter - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0-from-event

rxjs/index.d.ts

7

index.d.ts

@@ -35,2 +35,3 @@ export type Arguments<T> = [T] extends [(...args: infer U) => any]

emit<E extends keyof Events> (event: E, ...args: Arguments<Events[E]>): boolean
// The sloppy `eventNames()` return type is to mitigate type incompatibilities - see #5
eventNames (): (keyof Events | string | symbol)[]

@@ -43,4 +44,10 @@ rawListeners<E extends keyof Events> (event: E): Function[]

setMaxListeners (maxListeners: number): this
/**
* required by `FromEvent`
* @see https://github.com/devanshj/rxjs-from-emitter/issues/4#issuecomment-665104646
*/
__events: Events
}
export default TypedEventEmitter

7

package.json
{
"name": "typed-emitter",
"version": "1.4.0",
"version": "1.5.0-from-event",
"license": "MIT",

@@ -15,3 +15,6 @@ "description": "Strictly typed event emitter interface for TypeScript 3.",

"main": "./types.js",
"types": "./index.d.ts"
"types": "./index.d.ts",
"optionalDependencies": {
"rxjs": "*"
}
}

@@ -68,2 +68,19 @@ # Typed-Emitter

## RxJS `fromEvent` types inference
The default `fromEvent` from RxJS will return an `Observable<unknown>` for our typed emitter.
This can be fixed by the following code, by replacing the `fromEvent` type with our enhanced one: `FromEvent`:
```ts
import { fromEvent as rxFromEvent } from "rxjs"
import { FromEvent } from "typed-emitter/rxjs"
// The `Observable` typing can be correctly inferenced
const fromEvent = rxFromEvent as FromEvent
```
Learn more from [rxjs fromEvent compatibility #9](https://github.com/andywer/typed-emitter/issues/9)
for the `fromEvent` compatibility discussions.
## Why another package?

@@ -70,0 +87,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc