dmtrKovalenko / dmtrKovalenko/date-io

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

Open
#584 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
754
Forks
92
PR merge metrics
No merged PRs in 30d

Description

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][1])

[1]: https://www.npmjs.com/package/patch-package

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.