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

fix(core): Make filterUndefined null-safe #2789

Merged
merged 1 commit into from
Jun 7, 2019

Commits on Jun 7, 2019

  1. fix(core): Make filterUndefined null-safe

    There are a couple of places where fields accept values that are typed
    as `Json` per the JSII type specification. This conveys that literal
    `null` values may be passed and need to be preserved (as far as JSII is
    concerned - see aws/jsii#523). However in the CloudFormation domain,
    `null` is semantically equivalent to `undefined`.
    
    Now enters Javascript's confusing type system, where `null` is an
    `object` that cannot be converted to `object` (you read this correctly):
    
    ```js
    typeof null === 'object'
    // => true
    
    Object.entries(null);
    // => Thrown:
    //    TypeError: Cannot convert undefined or null to object
    //        at Function.entries (<anonymous>)
    ```
    
    So this changes the `undefined` checks to the `null`-coercing way, so
    that `null` and `undefined` are handled the same way.
    RomainMuller committed Jun 7, 2019
    Configuration menu
    Copy the full SHA
    18875d5 View commit details
    Browse the repository at this point in the history