Skip to content
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

Merged
merged 2 commits into from
Jul 28, 2022
Merged

Conversation

nicolapalavecino
Copy link
Contributor

Solves #180, #179 and #177

Updates TS definitions according to [email protected]

Copy link
Owner

@icebob icebob left a 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?

Copy link
Contributor Author

@nicolapalavecino nicolapalavecino left a 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;
Copy link
Contributor Author

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

Suggested change
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
Copy link
Contributor Author

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

Suggested change
* @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

@icebob icebob merged commit ec9ebe4 into icebob:master Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants