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

.orFail() and Typescript: object can never be null #8417

Closed
fromi opened this issue Dec 10, 2019 · 1 comment
Closed

.orFail() and Typescript: object can never be null #8417

fromi opened this issue Dec 10, 2019 · 1 comment

Comments

@fromi
Copy link

fromi commented Dec 10, 2019

Using Typescript, .orFail() should return a promise that cannot resolve to null. Currently it is not the case:

const foo = await FooModel.findById(id).orFail()
return foo.bar // Error TS2531: Object is possibly 'null'.

Expected behavior: foo should not be typed as nullable when orFail is used.

@vkarpov15
Copy link
Collaborator

Please open up an issue with your typescript bindings, we don't have any officially supported bindings. Follow #8108 for updates.

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

No branches or pull requests

2 participants