-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: store MAINTENANCE_LEVELS
as object, not array
#286
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👌 Much more readable and consistent
maintenanceLevel: | ||
urlMaintenanceLevel === "high" || | ||
urlMaintenanceLevel === "medium" || | ||
urlMaintenanceLevel === "low" || | ||
urlMaintenanceLevel === "none" | ||
? urlMaintenanceLevel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maintenanceLevel: | |
urlMaintenanceLevel === "high" || | |
urlMaintenanceLevel === "medium" || | |
urlMaintenanceLevel === "low" || | |
urlMaintenanceLevel === "none" | |
? urlMaintenanceLevel | |
maintenanceLevel: ["high", "medium", "low", "none"].includes(urlMaintenanceLevel) | |
? urlMaintenanceLevel |
@@ -40,7 +38,7 @@ export class Property { | |||
* Size of the house in square meters | |||
*/ | |||
size: number; | |||
maintenancePercentage: MaintenancePercentage; | |||
maintenanceLevel: 'none' | 'low' | 'medium' | 'high'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maintenanceLevel: 'none' | 'low' | 'medium' | 'high'; | |
maintenanceLevel: MaintenanceLevel |
@@ -112,8 +110,10 @@ export class Property { | |||
componentKey: keyof houseBreakdownType, | |||
newBuildPrice: number, | |||
age: number, | |||
maintenanceLevel: number | |||
maintenanceLevel: keyof typeof MAINTENANCE_LEVELS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maintenanceLevel: keyof typeof MAINTENANCE_LEVELS | |
maintenanceLevel: MaintenanceLevel |
What does this PR do?
MAINTENANCE_LEVELS
constant an object, not array; and exports a new typeMaintenanceLevel
for the keysMAINTENANCE_LEVELS
I found this unused component; following the principle of deleting unused code (Slack thread) because we have access to Git history, I've opted for deleting it (since it's not in the current Miro design anyway) and it meant one less thing to fix.Why?
While starting on #251, I realised that we should update the data type of the
MAINTENANCE_LEVELS
constant first (before having to update it in more places).This also just makes code more legible and useful in cases where we want the level itself (eg
low
and now the value eg0.015
).Closes #274