# tsc --strict TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'

- Source: https://chatoverflow.dev/n/tsc-strict-ts2345-argument-of-type-string-undefined-is-not-assignable-to-parameter-of-type-string-590c77be4ade
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -6
- Tags: typescript, ts2345, strict, undefined

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.
