Skip to content

fix(types): argument of type 'Date' is not assignable to parameter of type 'never'#2542

Merged
gpbl merged 1 commit into
gpbl:mainfrom
cosminpsk:patch-1
Oct 19, 2024
Merged

fix(types): argument of type 'Date' is not assignable to parameter of type 'never'#2542
gpbl merged 1 commit into
gpbl:mainfrom
cosminpsk:patch-1

Conversation

@cosminpsk

@cosminpsk cosminpsk commented Oct 14, 2024

Copy link
Copy Markdown
Contributor

Pull Request Template

Thanks for your PR! Make sure you have read the CONTRIBUTING guide.

What's Changed

TS2345: Argument of type 'Date' is not assignable to parameter of type 'never'.
    23 |   for (let i = 0; i < 7; i++) {
    24 |     const day = dateLib.addDays(start, i);
  > 25 |     days.push(day);
       |               ^^^
    26 |   }
    27 |   return days;
    28 | }

When starting a new CRA application, the compiler will throw the above error

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Tips for a good PR

  • If you are changing code, please add tests to cover the changes.
  • Some screenshots or screen recording could help to understand the changes.
  • If it is a bug, please provide the code to reproduce it.

Thanks

Additional Notes

Add any extra comments or questions here.

```
TS2345: Argument of type 'Date' is not assignable to parameter of type 'never'.
    23 |   for (let i = 0; i < 7; i++) {
    24 |     const day = dateLib.addDays(start, i);
  > 25 |     days.push(day);
       |               ^^^
    26 |   }
    27 |   return days;
    28 | }
```


When starting a new CRA application, the compiler will throw the above error

Signed-off-by: cosminpsk <84313418+cosminpsk@users.noreply.github.com>
@gpbl

gpbl commented Oct 14, 2024

Copy link
Copy Markdown
Owner

Good find! Which version of TypeScript are you using?

@gpbl gpbl changed the title Update getWeekdays.ts fix(types): argument of type 'Date' is not assignable to parameter of type 'never' Oct 14, 2024
@cosminpsk

Copy link
Copy Markdown
Contributor Author

Good find! Which version of TypeScript are you using?

Im using v4.3.2, this is where i found this issue, and then i updated to the v5.6.2 and the issue still persists.

Can you please give me an estimate on when this will get merged and deployed?

@gpbl

gpbl commented Oct 15, 2024

Copy link
Copy Markdown
Owner

Good find! Which version of TypeScript are you using?

Im using v4.3.2, this is where i found this issue, and then i updated to the v5.6.2 and the issue still persists.

Can you please give me an estimate on when this will get merged and deployed?

I'd like to replicate the issue first. I see where it comes from, but I don't understand why the type check passes here and not there.

I tried create-react-app and built the server without issues. What tsconfig and date-fns version are you using?

@gpbl gpbl merged commit 5934fd7 into gpbl:main Oct 19, 2024
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