Skip to content

Proper fix for using both date-fns and luxon in same project #584

@fatso83

Description

@fatso83

I inherited a TypeScript project that has not been compiling in a long time, it seems. One error deals with it having both date-fns and luxon in the same project, along with corresponding types, that seem to crash.

node_modules/@date-io/date-fns/type/index.d.ts:2:15 - error TS2300: Duplicate identifier 'DateType'.

2   export type DateType = Date;
                ~~~~~~~~

  node_modules/@date-io/luxon/type/index.d.ts:4:15
    4   export type DateType = DateTime;
                    ~~~~~~~~
    'DateType' was also declared here.

node_modules/@date-io/luxon/type/index.d.ts:4:15 - error TS2300: Duplicate identifier 'DateType'.

4   export type DateType = DateTime;
                ~~~~~~~~

  node_modules/@date-io/date-fns/type/index.d.ts:2:15
    2   export type DateType = Date;
                    ~~~~~~~~
    'DateType' was also declared here.

Aside from the fact that these two libraries are overlapping in functionality (and I should probably refactor to just have one), what is the proper fix here? My quick fix was simply to remove one of the offending files in node_modules, but that's hardly a proper solution ... (although it does the job when paired with patch-package)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions