2 thoughts on “[CS2] Enhancement: Support object spread syntax in multiline objects without braces or commas

  1. @GeoffreyBooth, @connec, @helixbass
    I’ve started to play with this and made some progress.

    foo =
      bar...
      c: 3

    compiles to

    foo = Object.assign({}, bar, {
        c: 3
      });

    f a:x, rest... into f({a:x}, ...rest)

    f {a:x, rest...} into

    f(Object.assign({
        a: x
      }, rest))

    And if I’m correct, there is also this case

    foo = 
      bar
      c: 3

    which should compile to

    foo = {
       bar,
       c: 3
    }
  2. Current status:

    # foo = 
    #   bar 
    #   c: 3
    foo = {
      bar,
      c: 3
    }
    
    # foo = 
    #   bar c: 3
    foo = bar({c:3))
    
    # foo = 
    #   bar 
    #     c: 3
    foo = bar({c:3))