Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NormalDuck opened this issue Jun 21, 2024 · 0 comments
Open

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

NormalDuck opened this issue Jun 21, 2024 · 0 comments

Comments

@NormalDuck
Copy link

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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant