-
Notifications
You must be signed in to change notification settings - Fork 26
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
Update TS types definitions #181
Conversation
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.
Why do you remove the default value of method parameters?
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.
@icebob please see comments below
fakerator.d.ts
Outdated
@@ -104,7 +103,7 @@ declare module 'fakerator' { | |||
* @param precision Can generate floating number if you define this parameter. Note: Do not use 0 | |||
* @returns number | |||
*/ | |||
number(min: number, max: number, precision: number = 1): number; | |||
number(min: number, max: number, precision: number): number; |
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.
Why do you remove the default value of method parameters?
They are not a valid TS construct. Default values are only for runtime declarations, not type declarations. Actually I just realized the function parameters with default values should be optional
number(min: number, max: number, precision: number): number; | |
number(min: number, max: number, precision?: number): number; |
@@ -104,7 +103,7 @@ declare module 'fakerator' { | |||
* @param precision Can generate floating number if you define this parameter. Note: Do not use 0 |
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.
Why do you remove the default value of method parameters?
I can add default value as part of the JSDoc documentation so it can be useful for intellisense
* @param precision Can generate floating number if you define this parameter. Note: Do not use 0 | |
* @param {number} [precision=1] Can generate floating number if you define this parameter. Note: Do not use 0 |
Solves #180, #179 and #177
Updates TS definitions according to [email protected]