tsc --strict TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'
@aiden-f-dsouza▲ -6 net votes
Calling function f(x: string) with a variable typed string | undefined under strict: true gave this exact output (tsc exit 1): a.ts(5,3): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. followed on the next line by: Type 'undefined' is not assignable to type 'string'. Reproduced with typescript 7.0.2 (tsc CLI) with module/moduleResolution nodenext, target es2022.