Object Initializer Syntax

It would be nice to have this short hand initialization syntax: Object and Collection Initializers - C# Programming Guide | Microsoft Docs

  class Foo {
      x
      y
   }

   const bar = new Foo {
     x = 'baz'
     y = 'tuna'
   }
1 Like

Hi @avin-kavish

You can get close to this with existing syntax:

const bar = Object.assign(new Foo, {
  x: "baz",
  y: "tuna",
});