Skip to content

Commit

Permalink
Fix TS definitions
Browse files Browse the repository at this point in the history
The source code uses `module.exports = ...`, not `exports.default = ...`:

https://github.com/nunofgs/clean-deep/blob/9d8313db868b239b990f9db352215844ad7ae65a/src/index.js#L14-L22

Given this, TS definitions should use `export =`, not `export default`. See microsoft/TypeScript#7185 (comment).

This matters when the project is compiled _without_ the `"esModuleInterop": true` flag. In that case, doing

```ts
import cleanDeep from 'clean-deep'

cleanDeep(...)
```

would throw an error like `TypeError: clean_deep_1.default is not a function`.
  • Loading branch information
iamakulov authored Jun 15, 2020
1 parent 9d8313d commit c4ba043
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare function cleanDeep<T>(object: T, options?: CleanOptions): Partial<T>;

export default cleanDeep;
export = cleanDeep;

export type CleanOptions = {
cleanKeys?: string[];
Expand Down

0 comments on commit c4ba043

Please sign in to comment.