I am starting to work with NestJS and PostgreSQL databases.
I created a model called User
. In this model is a column named verifiedAt
.
It looks like:
@Column({
type: DataType.DATE,
allowNull: true,
})
verifiedAt: Date | null;
A value of the column can be null. But when I reference this property from another place in my code, the IDE doesn't recognize that it may be null. Shows only the Date
type.
Why it is like this? What should I change to fix this?
I found a resolution. In tsconfig.json the strictNullChecks
flag must be set to true
.