I think I'm missing something obvious. I have a Pu...
# getting-started
c
I think I'm missing something obvious. I have a Pulumi.yaml that defines a specific configuration parameter as being an array as documented here: https://www.pulumi.com/docs/intro/concepts/config/#strongly-typed-configuration However, when I try to fetch the value (typescript) there is a type mismatch that breaks hard:
Copy code
let hostAnnotation: { [key: string]: string } = {};
  if (cfg.get("traefikHosts")) {
    hostAnnotation = {
      "somekey": (
        cfg.require("hosts") as unknown as string[]
      ).join(","),
    };
  }
I get:
TypeError: cfg.require(...).join
is not a function I cannot for the life of me work out how to make the type checker happy 😞
s
require
gives back a string. Use
requireObject
instead:
Copy code
new Config().requireObject<string[]>('hosts')
c
nice! Thanks @steep-toddler-94095