Skip to content

Support for variable resolution pattern from Serverless #11

Open
@ryansonshine

Description

@ryansonshine

Use case description

Region is defined as a union of string literals which works fine if the region is being implicitly set, however when attempting to use Serverless variables a type error is raised.

The following is valid:

const serverlessConfiguration: AWS = {
  provider: {
    name: "aws",
    runtime: "nodejs12.x",
    region: "us-east-1",
  },
}

The following is considered invalid:

const serverlessConfiguration: AWS = {
  provider: {
    name: "aws",
    runtime: "nodejs12.x",
    region: "${opt:region, 'us-east-1'}",
  },
}

Proposed Solution

Add string type to the end of the union type for region to address this issue. The tradeoff being we lose type safety but keep auto completion and fix the issue of variables being used for region. I'm open to any/all other proposed solutions if anyone has any ideas.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions