Computing ApiGateway URL on serverless.ts using httpApi event

With serverless definitions as TS instead of YAML, I’m trying to compute the API Gateway generated URL:

custom: {
    apiGatewayEndpoint: {
      'Fn::Join': [
        '',
        [
          'https://',
          '${!Ref ApiGatewayRestApi}',
          '.execute-api.',
          '${self:provider.region}',
          '.amazonaws.com/',
          '${self:provider.stage}',
        ],
      ],
    },
}

This fails with:

Cannot resolve variable at […] String value consist of variable which resolve with non-string value,

I tried using only strings in case there is a bug with the ts conversion:

custom: {
    apiGatewayId: '!Ref ApiGatewayRestApi',
    apiGatewayEndpoint:
      'https://${self:custom.apiGatewayId}.execute-api.${self:provider.region}.amazonaws.com/${self:provider.stage}/app',
}

But serverless print outputs this, which doesn’t look like a valid template.

  apiGatewayId: '!Ref ApiGatewayRestApi'
  apiGatewayEndpoint: https://!Ref ApiGatewayRestApi.execute-api.eu-west-3.amazonaws.com/dev/app

What am I doing wrong?
Another question: Is the ApiGatewayRestApi variable available for httpApi events too?