-
-
Notifications
You must be signed in to change notification settings - Fork 194
Closed
Labels
✔️ Feature Accepted💥 Targeting unplanned majorBreaking change for an upcoming major version, but not blocker for any major.Breaking change for an upcoming major version, but not blocker for any major.🚀 Feature Request
Description
🚀 Feature Request
- declare function constantFrom<T = never>(...values: T[]): Arbitrary<T>;
+ declare function constantFrom<const T = never>(...values: T[]): Arbitrary<T>;
Motivation
Right now fc.constantFrom('a', 'b', 'c')
returns Arbitrary<string>
, which is a bit inconvenient because often the reason you are using fc.constantFrom
in the first place is that you need the specific type represented by the constants. You can fix this by writing fc.constantFrom<'a' | 'b' | 'c'>('a', 'b', 'c')
, but that requires duplicating the constants between the types and the values. const
generics solve this problem.
Example
hsommerlandreason and LRNZ09
Metadata
Metadata
Assignees
Labels
✔️ Feature Accepted💥 Targeting unplanned majorBreaking change for an upcoming major version, but not blocker for any major.Breaking change for an upcoming major version, but not blocker for any major.🚀 Feature Request