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

CanKattwinkel opened this issue Jun 20, 2019 · 1 comment


Copy link

commented Jun 20, 2019

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.


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


export const isNil = (obj: any):  obj is null | undefined => isUndefined(obj) || obj === null;
kamilmysliwiec added a commit that referenced this issue Jun 22, 2019

This comment has been minimized.

Copy link

commented Jun 22, 2019

Added in 6.3.2 :) Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.