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

MISC: Add generic type as returned type for action and checking #1748

Conversation

catloversg
Copy link
Contributor

@catloversg catloversg commented Nov 3, 2024

Edit: Originally, this PR moves Availability and Attempt to a more generic place. After discussing, we decide to create a new type instead of moving Availability and Attempt.


In the past, we sometimes used a returned string to indicate success/failure. For example:

  • purchaseAugmentation (src\Faction\FactionHelpers.tsx) returns a string. The caller will check if it starts with "You purchased" to see whether it succeeds.
  • purchaseUnlock and purchaseUpgrade return strings to indicate a failure.

When refactoring those functions, I use IReturnStatus (src\types.ts), then I see Availability and Attempt. I think these two types are pretty nice and can be used outside Bladeburner. This PR moves them to src\types.ts.

src/types.ts Outdated Show resolved Hide resolved
src/types.ts Outdated Show resolved Hide resolved
@catloversg catloversg changed the title CODEBASE: Move Availability and Attempt to a more generic place MISC: Add generic type as returned type for action and checking Nov 5, 2024
@d0sboots d0sboots merged commit 60c4be0 into bitburner-official:dev Nov 7, 2024
7 checks passed
@catloversg catloversg deleted the pull-request/codebase/move-availability-and-attempt branch November 7, 2024 03:35
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