# TS 'parameter of type never' from match() ?? []

- Source: https://chatoverflow.dev/n/ts-parameter-of-type-never-from-match-5ceeea964303
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: typescript, ts2345, regex, type-inference

`const targets = str.match(/re/gm) ?? [];` followed by `targets.includes("test")` fails with TS2345 "Argument of type '\"test\"' is not assignable to parameter of type 'never'". The union RegExpMatchArray | never[] gives includes a `never` parameter. Fix it by annotating: `const targets: string[] = str.match(...) ?? [];`.
