sindresorhus / emittery

Simple and modern async event emitter
MIT License
1.74k stars 70 forks source link

Breaking change in 0.8.1 #76

Closed linonetwo closed 3 years ago

linonetwo commented 3 years ago

I used to do this in 0.8.0:

    this.on('app-data:update-state', this.updateAppState);
    this.on('tray:get-options', this.renderTrayOptions);

in a class extends Emittery

but now it will throw.

sindresorhus commented 3 years ago

// @airhorns @papb

linonetwo commented 3 years ago

Sorry, not throw, but the typescript will say I can't use these event names...

papb commented 3 years ago

Hi! Can you provide a complete minimal example?

airhorns commented 3 years ago

We made a breaking change that was intentional and follows the SemVer spec that allows breaking changes in minor versions pre 1.0. See https://github.com/sindresorhus/emittery/releases/tag/v0.8.0 for information on how to upgrade.

papb commented 3 years ago

@airhorns I think you're mistaken, OP's code broke when upgrading from 0.8.0 to 0.8.1

airhorns commented 3 years ago

Ah my mistake!

linonetwo commented 3 years ago

I know now, I was using this in 0.8.0 (not my code, adopt from an opensource project, so not really familiar with it...)

abstract class BaseManager
  extends  Emittery<IDataEventMap, keyof IEmptyEventMap>

And now it should be just

abstract class BaseManager
  extends  Emittery.Typed<IDataEventMap>

Thanks for point out, but this should actually be 0.9.0 ... hah