-
-
Notifications
You must be signed in to change notification settings - Fork 919
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
Use enum for male/female references #352
Comments
I would suggest to use type literals like Beside that, I would highly like to have something like |
I much prefer |
I like to provide enums, but not to force the usage export enum Sex {
MALE = 'male',
FEMALE = 'female',
INTERSEX = 'intersex'
}
export type SexType = 'male' | 'female' | 'intersex' | number
firstName(gender?: SexType): string { /*...*/ } |
Yes as to the external usage we should accept more than just the enum. But for the internal usage I want to see |
Please no magic numbers. Or what is your intention? EIDT: Backwards compatibility. |
What would |
IMO this issue is already implemented. faker/src/modules/name/index.ts Lines 3 to 6 in 8369e19
|
I was only scanning the issues. If it's already implemented, we should close it. @griest024 wdyt? |
Btw. there is #353 suggesting renaming |
Clear and concise description of the problem
References to male and female are done with hardcoded strings and numbers.
faker/src/name.ts
Lines 29 to 35 in 44628ec
Suggested solution
These should be replaced with enum values:
Alternative
No response
Additional context
As an aside,
gender
is an inaccurate name for male and female. The correct term issex
.The text was updated successfully, but these errors were encountered: