andywer / andywer/typed-emitter

Variable Event Names

Offen
#15 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
question
Vorherrschende Sprache
JavaScript
Sterne
285
Forks
29
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hey there!
Is there any way to type events with variable event names?
Specifically, i am trying to type https://github.com/PrismarineJS/prismarine-world/blob/55a6f78b4802519b7bee7ace20daa7e956e6ca7f/src/worldsync.js#L69
The World Class emits events called `blockUpdate:${position}`, which stringifies to `blockUpdate:(123, 123, 123)`.
Is typing this kind of event possible with typed-emitter?
I know that such complex string type matching is possible in Typescript, see Typescript DFA, but is there any way to do this while using typed-emitter?
Thanks for your time!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.