Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typescript definitions #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add typescript definitions #9

wants to merge 1 commit into from

Conversation

orgads
Copy link
Contributor

@orgads orgads commented Feb 7, 2024

No description provided.

Copy link
Member

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

Sorry for the late review, I had a few questions

@@ -0,0 +1,9 @@
import { Schema } from "mongoose";
declare namespace wrapCallback {
Copy link
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
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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants