firebase-functions
                                
                                 firebase-functions copied to clipboard
                                
                                    firebase-functions copied to clipboard
                            
                            
                            
                        Refactor: Make `defineString` generic for better type-safety
Description
The defineString function does not narrow the type when adding input.select.options. This means we have to typecast in certain situations, even though we know what the types should be.
Code sample
const environmentParam = params.defineString("ENVIRONMENT", {
      default: "production", // This will now error out if it does not match one of the options
      input: {
        select: {
          options: [
            { label: "Production", value: "production" },
            { label: "Staging", value: "staging" },
            { label: "Development", value: "development" },
          ],
        },
      },
});
const environment = environmentParam.value();
// ^? "production" | "staging" | "development"
Limitations
- If defaultValueis provided with no options the value is still wide, rather than loose autocomplete