Skip to content

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

@NormalDuck

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;

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions