AsyncBanana / microdiff

A fast, zero dependency object and array comparison library. Significantly faster than most other deep comparison libraries and has full TypeScript support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

➕ Feature - Export DIFFERENCE Type so it can be imported in Ts projects

GabrielCTroia opened this issue · comments

❗ Is your feature request related to a problem? Please describe.
Yes. I cannot use the ReturnType in Typescript because it fails with this error:

Exported variable 'myFn' has or is using name 'DifferenceCreate' from external module "node_modules/microdiff/dist/index" but cannot be named.ts(4023)

✅ Describe the solution you'd like
I believe simply exporting all the types would be sufficient, or putting them under the "microdiff" module.

↗️ Describe alternatives you've considered
None yet

➕ Additional context
This happens with Typescript 4.9

Cheers!

Hey @GabrielCTroia this is a workaround, but typescript does let you extract the return type of a function using ReturnType, like so:

import diff from 'microdiff';

export type Difference = ReturnType<typeof diff>[0];

This should be fixed in v1.3.2