Hacker News new | ask | show | jobs
by mwint 1541 days ago
I write a lot of Ruby for work, but I’m not sure what “shapes” are - do you have any good reference where I could start reading?
1 comments

They're basically Hash literal types in Ruby. It's what TypeScript calls object types:

https://www.typescriptlang.org/docs/handbook/2/objects.html

(Ruby and JavaScript mean slightly different things by the word "object" so we chose a different word.)

Flow also has a distinction between exact and inexact object types:

https://flow.org/en/docs/types/objects/

where the difference is whether other, unspecified fields are allowed to hide in the object, or whether values of type `{foo: number}` must have only the `foo` field, and no other fields.