Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove undefined cases from inputs to all function #11048

Merged
merged 2 commits into from Oct 18, 2022

Commits on Oct 17, 2022

  1. Remove undefined cases from inputs to all function

    Using `all` currently looses type safety around the handling of input values which are possibly undefined.
    By adding the explicit undefined option to each argument, the undefined case outside the inputty type does not get captured.
    
    By removing the explicit `undefined` cases, the undefined is captured by the generic parameter and correctly carried through to the output type.
    
    For example, if an input to `all` is possibly undefined, the value after `all` won't be labeled as possibly undefined.
    
    ```
    // pulumi.Input<string> | undefined
    let input = possiblyUndefinedInput();
    // pulumi.Output<string>
    let original = pulumi.all([input])[0];
    // pulumi.Output<string | undefined>
    let newBehaviour = pulumi.all([input])[0];
    
    function possiblyUndefinedInput(): pulumi.Input<string> | undefined {
      return undefined;
    }
    ```
    danielrbradley committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    072342e View commit details
    Browse the repository at this point in the history
  2. Add to changelog

    danielrbradley committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    3e3f1d6 View commit details
    Browse the repository at this point in the history