TypeScript like type in Swift

Solution for TypeScript like type in Swift
is Given Below:

I’m just wondering if we can do something like this (TypeScript) in Swift ?

enum SomeEnum {
    a, b, c, d

const someFunction = (param: SomeEnum.a | SomeEnum.b) => {


const anotherFunction = () => {
    // this gives me a warning 

Basically, I have an Enum and but someFunction only accepts some parts of that Enum. So when you use that function it gives you a warning. Can we do something similar in Swift ? I don’t want to create new Enum type just to do this …