lukeed / klona

A tiny (240B to 501B) and fast utility to "deep clone" Objects, Arrays, Dates, RegExps, and more!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[TypeScript] Incorrectly declared types

hakimio opened this issue · comments

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.

@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.

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