lukeed / klona

A tiny (240B to 501B) and fast utility to "deep clone" Objects, Arrays, Dates, RegExps, and more!
MIT License
1.62k stars 43 forks source link

[TypeScript] Incorrectly declared types #18

Closed hakimio closed 4 years ago

hakimio commented 4 years ago

The current type definition results in an error when using library with TypeScript: TypeError: klona.default is not a function

To fix this error, type definitions should be changed to the following:

export = klona;
declare function klona<T>(val: T): T

Just like dayjs does it. More info about the error.

hakimio commented 4 years ago

@lukeed Now trying to import klona, results in an error saying: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export. The fix didn't fix anything.

lukeed commented 4 years ago

It did fix things in some instances -- but it broke others. Will be addressed in next release.