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

fix: Room.getEventLog() may return string #245

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

WyattSL
Copy link
Contributor

@WyattSL WyattSL commented Sep 11, 2023

Brief Description

Room.getEventLog(true) will return a string.
The current type definitions dictate that Room.getEventLog() will always return EventLog[]. This is not the case.
This PR should correct this oversight.

Checklists

  • Test passed
  • Coding style (indentation, etc)
  • Edits have been made to src/ files not index.d.ts
  • Run npm run dtslint to update index.d.ts

@DiamondMofeng
Copy link
Member

Thanks for fixing this issue!
I will review this pr when I am free

Copy link
Member

@DiamondMofeng DiamondMofeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While Typescript has some limitations when dealing with overload function signatures: the built-in tool type Parameter and ReturnType only infer types from the last overload (see playground ), I think we do not need to be that strict. Therefore, I think we do not need to care about the order of overloads here.

src/room.ts Show resolved Hide resolved
@DiamondMofeng DiamondMofeng merged commit 71265a9 into screepers:master Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants