AS a package user, I want to be able to interact with the "sortBy" variable using pre-defined string types #76

Closed
opened 2023-07-02 14:43:12 +01:00 by Vylpes · 4 comments
Owner

Epic:
Story Points: 1


AS a package user, I want to be able to interact with the "sortBy" variable using pre-defined string types
SO THAT I can easily use a pre-defined list and know it exists

Acceptance Criteria

AS a package user
GIVEN I'm using the package in TypeScript
WHEN I specify the "sortBy" parameter
THEN the type should only let me use the strings of the allowed values

AS a package user
GIVEN I'm using the package in JavaScript
WHEN I specify the "sortBy" parameter
THEN it should still work with a string
AND validation will be done as previously

Subtasks

  • Update sortBy type
  • Update tests
  • Update documentation

Notes

No notes

Epic: \ Story Points: 1 --- AS a package user, I want to be able to interact with the "sortBy" variable using pre-defined string types SO THAT I can easily use a pre-defined list and know it exists ## Acceptance Criteria AS a package user GIVEN I'm using the package in TypeScript WHEN I specify the "sortBy" parameter THEN the type should only let me use the strings of the allowed values AS a package user GIVEN I'm using the package in JavaScript WHEN I specify the "sortBy" parameter THEN it should still work with a string AND validation will be done as previously ## Subtasks - [x] Update sortBy type - [x] Update tests - [x] Update documentation ## Notes *No notes*
Vylpes added the
type
story
needs criteria
needs estimate
labels 2023-07-02 14:43:20 +01:00
Vylpes changed title from Make "sortBy" variable an enum to AS a package user, I want to be able to interact with the "sortBy" variable using an enum 2023-11-19 14:36:02 +00:00
Author
Owner

Can enums be defined as strings? This might be helpful to do if so, if not we should make the type string OR enum, so we can interact with it like how it is right now (no change in API)

Can enums be defined as strings? This might be helpful to do if so, if not we should make the type string OR enum, so we can interact with it like how it is right now (no change in API)
Vylpes added the
question
label 2023-11-19 14:37:14 +00:00
Author
Owner

Would we be better off not making it an enum and instead enforce string names in typescript? E.g. sortBy: "hot" | "new"

Would we be better off not making it an enum and instead enforce string names in typescript? E.g. `sortBy: "hot" | "new"`
Author
Owner

Would we be better off not making it an enum and instead enforce string names in typescript? E.g. sortBy: "hot" | "new"

Yeah, I prefer this choice

> Would we be better off not making it an enum and instead enforce string names in typescript? E.g. `sortBy: "hot" | "new"` Yeah, I prefer this choice
Vylpes removed the
question
label 2023-12-31 14:26:16 +00:00
Vylpes changed title from AS a package user, I want to be able to interact with the "sortBy" variable using an enum to AS a package user, I want to be able to interact with the "sortBy" variable using pre-defined string types 2023-12-31 14:26:30 +00:00
Vylpes removed the
needs criteria
label 2023-12-31 14:28:45 +00:00
Vylpes removed the
needs estimate
label 2024-04-07 14:13:01 +01:00
Vylpes added this to the 2.3.0 milestone 2024-06-02 16:29:33 +01:00
Vylpes added this to the 2.3 Sprint 1 project 2024-06-09 14:35:20 +01:00
Vylpes self-assigned this 2024-06-19 17:10:11 +01:00
Member

This has passed testing, the variable now errors when its not valid

image
This has passed testing, the variable now errors when its not valid <img width="887" alt="image" src="/attachments/9c2626c2-ce19-4796-bac2-b064fd8d7d2f">
VylpesTester added spent time 2024-06-22 15:22:09 +01:00
5 minutes
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Total time spent: 5 minutes
VylpesTester
5 minutes
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: RabbitLabs/random-bunny#76
No description provided.