[Solved] When using `import * as aws from "@pulumi...
# general
e
[Solved] When using
import * as aws from "@pulumi/aws";
command, I get errors assigning values via a variable to my ec2 instanceType, but if I use the old format
const aws = require("@pulumi/aws")
the error goes away and my code runs just fine. Thoughts?
g
What error do you get?
e
I have
let size = "t2.micro"
and then calling that later as
instanceType: size
error I get is
Type 'string' is not assignable to type 'Input<InstanceType>'.ts(2322)
but only when I use that import command instead of the require
w
Yes - when you use
import
you get strong typing, when you use
require
you don’t get any type checking. In this case you can appease TypeScript by saying
let size: aws.ec2.InstanceType = “t2.micro”
.
e
aah, thank you. clearly I am new to both typescript & pulumi