Skip to content

Using FP functions together with Lodash's flow function is no longer properly typed #3641

@Zjaaspoer

Description

@Zjaaspoer

If you would take the following code:

import { addDays, addHours } from 'date-fns/fp'
import flow from 'lodash/fp/flow'

const nowPlusADayAndAnHour = flow(addDays(1), addHours(1))(new Date())
console.log(nowPlusADayAndAnHour)

This used to work with version >= date-fns 2.30.0 (lodash 4.17.21 & @types/lodash: 4.14.202).

But with the new typings of >= 3.0.0 the TypeScript error Expected 0 arguments, but got 1. is thrown for the code new Date()

I haven't found anything breaking in the Changelog that would influence this piece of code, and I believe it still follows the FP Guide.

I would like to understand if my code is wrong or if the types broke. 😅

const nowPlusADayAndAnHour = addDays(1)(addHours(1)(new Date())) is still properly typed, by the way

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions