Shape objects

Cyril Auburtin cyril.auburtin at
Sat Jun 16 07:56:16 UTC 2018

I wish JS had Shape objects, which would not only ease performance
optimization for the benefit of JS engines (, but also helps for validation, like an

shape Point { x: Number, y: Number, name: String };

const p = Point({x: 1, y: 2, name: 'foo'})

const p = Point({x: 1, y: 2, naem: 'foo'}) // throws

That object would have its properties immutable

I think proposal-first-class-protocols (
could more or less directly do that feature
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list