Skip to content

Commit

Permalink
Only use a CommonJS export for the TypeScript definition
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 14, 2020
1 parent d8ab8a2 commit 5f4251b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
9 changes: 0 additions & 9 deletions index.d.ts
Expand Up @@ -82,8 +82,6 @@ declare namespace onChange {
}

declare const onChange: {
default: typeof onChange;

/**
Watch an object or array for changes. It works recursively, so it will even detect if you modify a deep property like `obj.a.b[0].c = true`.
Expand Down Expand Up @@ -168,13 +166,6 @@ declare const onChange: {
options?: onChange.Options
): ObjectType;

// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function onChange<ObjectType extends {[key: string]: unknown}>(
// object: ObjectType,
// onChange: (this: ObjectType, path: string, value: unknown, previousValue: unknown) => void
// ): ObjectType;
// export = onChange;

/**
@param object - Object that is already being watched for changes.
@returns The original unwatched object.
Expand Down
2 changes: 0 additions & 2 deletions index.js
Expand Up @@ -300,5 +300,3 @@ onChange.target = proxy => proxy[TARGET] || proxy;
onChange.unsubscribe = proxy => proxy[UNSUBSCRIBE] || proxy;

module.exports = onChange;
// TODO: Remove this for the next major release
module.exports.default = onChange;

0 comments on commit 5f4251b

Please sign in to comment.