How can you specify the `${opt:region, 'us-west-'}` in a Typescript Serverless File?

Does anyone know how you’d do something similar to ${opt:region, 'us-west-2'} in serverless.ts?

// serverless.ts
const serverlessConfiguration: AWS = {
  provider: {
    region: ???

The AWS interface shows that region is a type that can only be:

// index.d.ts
  | "us-east-1"
  | "us-east-2"
  | "us-west-1"
  | "us-west-2"

What I’ve Tried

The compiler complains at the below statement because the region is not abiding by the interface above.

region: '${opt:region, "us-west-2"}',

I think issue is is that TypeScript validation won’t allow variable syntax, which is perfectly fine and welcome by the Framework.

I’d call it as limitation of TypeScript resolver. Please open issue at GitHub - serverless/typescript: TypeScript definitions for Serverless Framework service configuration and ask for recommendations

After setting up a normal SLS YAML file and using opt, I got deprecation warnings when I deployed.

That is a sign to not use opt, and instead, use Environment Variables.