function getReffedThing()

in src/shared/cloudformation/cloudformation.ts [696:718]


    function getReffedThing(
        ref: Ref,
        template: Template,
        thingType: ThingType
    ): number | string | string[] | undefined {
        const param = getReffedParam(ref, template)
        // every other type, including List<Number>, is formatted as a string.
        if (
            (thingType === 'number' && param.Type === 'Number') ||
            (thingType === 'string' && param.Type !== 'Number') ||
            (thingType === 'array' && samParamArrayTypes.includes(param.Type))
        ) {
            if (param.Default && (thingType === 'array' ? 'string' : thingType) !== typeof param.Default) {
                throw new Error(`Default value for Parameter "${ref.Ref}" is not a ${thingType}`)
            }

            // attempt to convert to str array if array
            // returns undefined if no default value is present
            return param.Default && thingType === 'array' ? param.Default.toString().split(',') : param.Default
        }

        throw new Error(`Parameter ${ref.Ref} is not a ${thingType}`)
    }