Using boolean variable in TypeScript config

I’m trying to use a boolean variable in a Typescript serverless config, but I can’t seem to get the syntax right.

From the docs, I think I’m supposed to be using strToBool() but I don’t seem to be able to create a parseable TypeScript file.

Is my syntax wrong, or am I just going about this all wrong?

tracing: {
  apiGateway: ${strToBool(${self:custom.AwsXRayEnabled.${opt:stage})},