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

Update instanceOf to support constructors that have required arguments #308

Merged
merged 1 commit into from
Jun 27, 2019

Conversation

Jessidhia
Copy link
Contributor

No description provided.

instanceOf(RegExp);

// $ExpectType Decoder<Promise<string>, unknown>
instanceOf<Promise<string>>(Promise);
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 originally just used this as an example of a class with a required argument but, because it is generic, the type that shows up on $ExpectType will depend on your TypeScript version.

It actually should be Promise<unknown> in TS 3.6 but for some reason dtslint is seeing it as Promise<{}>; so I gave up and just specified the argument here 🤔

Copy link
Owner

@nvie nvie left a comment

Choose a reason for hiding this comment

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

Thx so much, this is a great addition 👍

@nvie nvie merged commit 636cfc4 into nvie:master Jun 27, 2019
@Jessidhia Jessidhia deleted the instanceof branch June 27, 2019 06:44
@nvie
Copy link
Owner

nvie commented Jun 27, 2019

This is now published as part of v1.15.0 🙏

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