Skip to content

chore: add missing type on the system.commonFileName method #299

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

Merged
merged 3 commits into from
Jan 28, 2022

Conversation

pkuczynski
Copy link
Member

No description provided.

@pkuczynski pkuczynski requested a review from a team as a code owner January 25, 2022 20:23
@pkuczynski pkuczynski added the c: chore PR that doesn't affect the runtime behavior label Jan 25, 2022
@pkuczynski pkuczynski added this to the v6.0.0 - Project stability milestone Jan 25, 2022
src/system.ts Outdated
@@ -58,7 +58,7 @@ export class System {
* @method faker.system.commonFileName
* @param ext
*/
commonFileName(ext): string {
commonFileName(ext?: string | number): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: where did you get these types from?
Currently it could be like any primitive like also boolean and bigint and such.
It's not clear to me where you did get this from

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing it to something string like it probably a good idea, but I it will be a breaking change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can find something in the test suite how it wanted to be called.
I just currently say that it's not clear to me where the types are coming from

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just guessed the types, as they were the only ones which made sense as extension really...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number type represents any kind of number, so int, float, bigint right?

Copy link
Member

@ST-DDT ST-DDT Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go for the stricter string only version as used in DefinitelyTyped, because using unformatted numbers looks like an edge case for me.
E.g. you may use .001 but I have never used just .1 especially in random test data. But I would be okay with allowing numbers too, but then we should make sure that it results in a decent extension even for non integer values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On top of that 0 || 'something' => 'something'

Copy link
Member

@ST-DDT ST-DDT Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is the same for ''. Lets go for string then and document that '' is considered to be not set.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is the same for ''. Lets got for string then and document that '' is considered to be not set.

Oh... yeah, you are right 😬

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

# Conflicts:
#	src/system.ts
@Shinigami92 Shinigami92 merged commit bba4741 into faker-js:main Jan 28, 2022
@pkuczynski pkuczynski deleted the system-missing-type branch January 28, 2022 10:11
bmenant pushed a commit to bmenant/faker that referenced this pull request Mar 11, 2022
demipel8 pushed a commit to demipel8/faker that referenced this pull request Mar 11, 2022
demipel8 pushed a commit to demipel8/faker that referenced this pull request Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: chore PR that doesn't affect the runtime behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants