Skip to content

Commit

Permalink
docs: improve Emitter section
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Aug 5, 2024
1 parent ab5682f commit d80fa1f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ emitter.on('hello', () => 1) // ✅
emitter.on('hello', () => 'oops') // ❌ string not assignable to type number

emitter.emit('hello', 'John') //
emitter.on('hello', 123) // ❌ number is not assignable to type string
emitter.on('hello') // ❌ missing data argument of type string
emitter.emit('hello', 123) // ❌ number is not assignable to type string
emitter.emit('hello') // ❌ missing data argument of type string

emitter.emit('unknown') // ❌ "unknown" does not satisfy "hello"
```

### `.on(type, listener)`
Expand Down

0 comments on commit d80fa1f

Please sign in to comment.