Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Schema } from "mongoose";
declare namespace wrapCallback {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this declare namespace call about? Shouldn't we just have interface WrapCallbackOptions {} and just use that? And export default function wrapCallback()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why, but without the namespace I get the following error.

test.ts:1:31 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.

1 import * as wrapCallback from '.';

test.ts is:

import * as wrapCallback from '.';

wrapCallback({} as any);

interface Options {
mode?: 'scope' | 'emit';
}
}
declare function wrapCallback(schema: Schema, options?: wrapCallback.Options): void;

export = wrapCallback;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "0.0.4",
"description": "Mongoose plugin providing experimental support for Node.js `async_hooks`",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"docs": "acquit-markdown -r acquit-ignore -p './test/example.test.js' -h './HEADER.md' > README.md",
"test": "mocha test/*.js"
Expand Down