Serverless.ts file format and using typed custom variables

All:

Has anyone figured out a good way to handle typed variables in the new serverless.ts format?

eg:

In the yaml format, because of processing, you could do things like this

custom:
  scheduled:
    prod: true
    dev: false
.
.
.
events:
  schedule:
    rate:  2(mins)
    enabled: "${self:custom.scheduled.${opt:stage}"
.
.
.

Because of the way the TS is parsed this is not really an option anymore. Has anyone determined a great way of using custom variables in the new serverless.ts when the typing is forced?

In summary: I want to turn things on/off depending on the stage used for deployment & maybe I am approaching this incorrectly

TLDR: scheduled.enabled is a boolean and needs to be a boolean at transpile time but the string values are not parsed until runtime

Thanks!

I had same issue.
use ‘as’ syntax.

example, i’d like to setting at environment object.

environment: '${self:custom.env.${opt:stage}}' as {}

maybe your case is

events:
  schedule:
    rate:  2(mins)
    enabled: "${self:custom.scheduled.${opt:stage}" as boolean

I hope it helps you.