When looking at my code, I encounter an error stating
Argument of type 'Definition | undefined' is not assignable to parameter of type 'Definition'
. Even though I am checking if the object value is not undefined with if (defs[type] != undefined)
, the error persists at this.addDefinition(type, defs[type])
.
public static addDefinitions(defs: Record<string, Definition>): void {
Object.keys(defs).forEach((type: string): void => {
if (defs[type] != undefined) {
this.addDefinition(type, defs[type]);
}
});
}
Could there possibly be a misconfiguration in my tsconfig causing this issue?