-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Closed
Copy link
Labels
Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionDailyKSv2KSv2ImprovementItem broken or needs improvement.Item broken or needs improvement.NewFeatureSomething to build that is a new item.Something to build that is a new item.
Description
Coming from #32992 (review)...
Problem
Currently, the object returned by validate is just a Record<string, string>, but we know that the return type should be a map of formInputID: translationKey, so we're missing an opportunity to be precise and expressive with our type definitions. Some more specific problems with this implementation are:
- It's easy to put whatever string you want in the return type (for example, I was mistakenly using
translate(translationKey), when all I needed wastranslationKey). - If you use a constant for a form inputID (which is a good practice), then you'll get a type error referencing it in the return type of validate and have to cast it to a normal string (with
as string).
Solution
Implement the fixes @blazejkustra laid out here.
Reactions are currently unavailable
Metadata
Metadata
Labels
Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionDailyKSv2KSv2ImprovementItem broken or needs improvement.Item broken or needs improvement.NewFeatureSomething to build that is a new item.Something to build that is a new item.