First you need to define a generic type using conditional and recursive logic.
type MyCommaSeparatedType<T,K> =
T extends `${infer R1},${infer R2}` ?
R1 extends K ?
`${R1},${MyCommaSeparatedType<R2,K>}` : never : T extends K ?
T : never;
Then use this type as type of the argument in a helper function.
const MyCommaSeparatedFunction = <T,K extends ActionType = ActionType>(value: MyCommaSeparatedType<T,K>) => value
Now you can use this function to achieve what you intended.
Examples:
const value1 = MyCommaSeparatedFunction("TypeA")
//value1 type is "TypeA"
const value2 = MyCommaSeparatedFunction("TypeB,TypeA,TypeC")
//value2 type is "TypeB,TypeA,TypeC"
const value3 = MyCommaSeparatedFunction("TypeC$TypeA")
// value3 type is never