`createNodeGroup` on a `eks.Cluster` takes an `ins...
# general
f
createNodeGroup
on a
eks.Cluster
takes an
instanceType
parameter which must be a
aws.ec2.InstanceType
. I'd like to pass in a string from a config file. How can I do this without Typescript complaining?
b
If the string is in a variable named, say,
instanceType
, you would say either
createNodeGroup(..., instanceType as aws.ec2.InstanceType, ...)
or
createNodeGroup(..., <aws.ec2.InstanceType>instanceType, ...)
. This simply asserts the type, it doesn't actually check that it's a valid instance type. More info here https://www.typescriptlang.org/docs/handbook/basic-types.html#type-assertions.
f
Yep, that does it. Thank you!
👍 1