I'm getting an error from Typescript (4.8.2) STRICT:
Argument of type 'State | undefined' is not assignable to parameter of type 'State'.
Type 'undefined' is not assignable to type 'State'. ts(2345)
using this code:
enum State {
Completed = "COMPLETED",
Discontinued = "DISCONTINUED",
}
type Player = {
description: Scalars["String"];
state: State;
team?: Maybe<Team>;
};
let player: Partial<Player>;
const isOK = [State.Completed, State.Discontinued].includes(player.state);
How can I fix?
It's because of Partial<Player>?