I'm encountering an issue while attempting to create a function that verifies the validity of an object.
const isPeriodValid = (period: Period | null): boolean => {
return period && period.start && period.end;
}
export interface Period {
start: number,
end: number
}
The error message from my IDE reads: TS2322: Type 'number | null' is not assignable to type 'boolean'. Type 'null' is not assignable to type 'boolean'. The suggested fix is to return: null | 0 | number
What could be causing this issue?