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

Faker.date generates ts error when passed into faker.unique #1258

Closed
9 of 10 tasks
ollebergkvist opened this issue Aug 11, 2022 · 3 comments
Closed
9 of 10 tasks

Faker.date generates ts error when passed into faker.unique #1258

ollebergkvist opened this issue Aug 11, 2022 · 3 comments
Assignees
Labels
breaking change Cannot be merged when next version is not a major release c: bug Something isn't working p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug

Comments

@ollebergkvist
Copy link

Pre-Checks

Describe the bug

Faker.date and it's children methods can't be used with unique method.

Generates the following TS error:

Argument of type '(years?: number, refDate?: string | number | Date) => Date' is not assignable to parameter of type '(...parameters: any[]) => RecordKey'.
  Type 'Date' is not assignable to type 'RecordKey'.ts(2345)

Minimal reproduction code

const date = faker.unique(faker.date.past)

Additional Context

No response

Environment Info

System:
    OS: macOS 12.5
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 1.48 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.asdf/installs/nodejs/16.16.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.11.0 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Chrome: 104.0.5112.79
    Firefox: 103.0.2
    Safari: 15.6

Which module system do you use?

  • CJS
  • ESM

Used Package Manager

yarn

@ollebergkvist ollebergkvist added c: bug Something isn't working s: pending triage Pending Triage labels Aug 11, 2022
@ollebergkvist ollebergkvist changed the title faker.date generates ts error when passed into faker.unique Faker.date generates ts error when passed into faker.unique Aug 11, 2022
@Shinigami92 Shinigami92 moved this to Todo in Faker Roadmap Aug 11, 2022
@ST-DDT ST-DDT added s: accepted Accepted feature / Confirmed bug and removed s: pending triage Pending Triage labels Aug 11, 2022
@ST-DDT ST-DDT added this to the v7 - Current Major milestone Aug 11, 2022
@ST-DDT
Copy link
Member

ST-DDT commented Aug 11, 2022

I can reproduce the error locally.
I'm not sure whether the bug can be fixed in a non breaking way.

@ST-DDT
Copy link
Member

ST-DDT commented Sep 29, 2022

This requires breaking changes because the current api takes a Record to store the values.
We will change the unique store to be either a Set<T> or an T[] or add(T) => boolean.

@ST-DDT ST-DDT added p: 1-normal Nothing urgent breaking change Cannot be merged when next version is not a major release labels Jan 14, 2023
@Shinigami92
Copy link
Member

Team decision: we will not work on this anymore

@Shinigami92 Shinigami92 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 27, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Faker Roadmap Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Cannot be merged when next version is not a major release c: bug Something isn't working p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants