Thread
#typescript
    b

    busy-lion-51883

    6 months ago
    s

    steep-toddler-94095

    6 months ago
    Pulumi exports it as a type
    import { Region } from "@pulumi/aws";
    const region = new pulumi.Config("aws").require('region') as Region
    You will run into runtime errors if the region in the config isn't actually a valid region, but this will pass compile checks
    b

    busy-lion-51883

    6 months ago
    Is there a difference/preference between using ‘as’ and specifying the type on the variable? eg:
    const region: aws.Region = new pulumi.Config("aws").require('region')
    s

    steep-toddler-94095

    6 months ago
    in this specific case, no. both will work fine. though i think what you have above is preferred in most cases