'Is `Union` of strings and `string` achievable? [duplicate]

Is they're a way to have an union of string type that accepts some specific strings AND string ?

type AcceptsWithString =
 | 'optionA'
 | 'optionB'
 | 'optionC'
 | string

playground

The aim here is to have a type that offer auto completion for inputs (list can be long and we can make errors easily in some cases) AND also any string ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source