Closed henrinormak closed 4 years ago
just as an example, here's express' type declarations in DefinitelyTyped
I think the original premise of this issue might be a little off.
a.default is not a function
That is correct: https://github.com/FormidableLabs/react-fast-compare/blob/master/index.js#L118
We don't do a default export. We instead assign module.exports
to the function.
after looking at this, the key flaw that this PR fixes is
export default isEqual
There is no default export in the module, so the typing was off. Hence the export=isEqual
@henrinormak can you explain the purpose of
declare namespace isEqual {}
I'm pretty sure it's just dead code, especially after talking with @kitten.
While trying to use this from TS, I noticed that I got the following error:
a.default is not a function
, which hinted at some import problem with this package.After looking at the source code (specifically this line), it is evident that this package is what TS calls a "module library" - http://www.typescriptlang.org/docs/handbook/declaration-files/library-structures.html#identifying-a-module-library-from-code). Looking at other similar packages (namely
request
), you can see that their type definitions are not usingexport default
.As such, it seems that the types in this package should be changed: