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

isNil Type Guard #2418

Closed
CanKattwinkel opened this issue Jun 20, 2019 · 2 comments
Closed

isNil Type Guard #2418

CanKattwinkel opened this issue Jun 20, 2019 · 2 comments
Labels
needs triage This issue has not been looked into

Comments

@CanKattwinkel
Copy link

Is there any particular reason for isNil not having a type guard? isUndefined on the other side has one.

I've stumbled across it repeatedly because my IDE prefers importing nest over lodash. Lodash, on the other hand, has a guard. In a project with strict: true it is a little annoying.

https://github.com/nestjs/nest/blob/master/packages/common/utils/shared.utils.ts

Current:

export const isNil = (obj: any): boolean => isUndefined(obj) || obj === null;

Wanted:

export const isNil = (obj: any):  obj is null | undefined => isUndefined(obj) || obj === null;
@CanKattwinkel CanKattwinkel added the needs triage This issue has not been looked into label Jun 20, 2019
@kamilmysliwiec
Copy link
Member

Added in 6.3.2 :) Thanks for reporting!

@lock
Copy link

lock bot commented Nov 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

2 participants