Skip to content

index.d.ts listen method should use Player instead of Player? #17

Description

@NormalDuck

I think the typing should switch from player?: Player to player: Player. This is because some arguments require Player, but the listen method returns Player | undefined which triggers the type system to raise an error. I have to use as keyword to force it to be Player type which is unnecessary. I am pretty sure player argument will return nil on the client side, I don't find any use case for using the nil so making the type from player?: Player to player: Player is more suitable I guess?
before:

listen: (callback: (data: T["value"], player?: Player) => void) => void; 

after:

listen: (callback: (data: T["value"], player: Player) => void) => void;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions