Actually executing Hack code doesn't necessarily typecheck everything. You need to actually run a separate tool to enforce the type system, as described in the docs article linked here. When you do that, you'll get an error that looks something like this, depending on the exact version of HHVM you have:

File "shapes.php", line 10, characters 19-23:
Invalid argument (Typing[4110])
File "shapes.php", line 3, characters 41-43:
This is an int
File "shapes.php", line 10, characters 42-76:
It is incompatible with a string

Modern versions of HHVM will also yell at you if you aren't running the typechecker; I suspect you're running an older version, before we realized this was a point of confusion -- sorry!

What actually happens when you run type-incorrect code is undefined behavior. The answer by Ed Cottrell is correct for the current version of HHVM -- we do the same thing PHP does to coerce types -- but keep in mind it's undefined behavior and may change in future versions without notice.

Answer from Josh Watzman on Stack Overflow
🌐
Hhvm
docs.hhvm.com › shape
Shape | Hack & HHVM Documentation
This is called an 'open shape'. function takes_named(shape('name' => string, ...) $_): void {} // OK.
🌐
Medium
medium.com › @mikeabelar › web-development-with-hhvm-and-hack-10-shapes-d8a56b067c2b
Web Development With HHVM and Hack 10: Shapes | by Mike Abelar | Medium
April 3, 2020 - We can run the code with hhvm shapes.hack . This outputs: ... Observe the differences between this code and the nearly identical code we used with tuples. The first notable difference is the keyword shape rather than tuple .
Discussions

'Hack' or library or tool that lets you create shapes that you can copy on the rM2
This is what I use - a batch script for drawj2d.Once you get it set up, drag & drop your image onto the script file & it will automatically upload to your rM2. https://www.reddit.com/r/RemarkableTablet/comments/15trvjp/adding_png_to_a_pdf/ More on reddit.com
🌐 r/RemarkableTablet
8
6
February 5, 2024
hacklang - How to access optional shape field in hack? - Stack Overflow
To give an example, let's assume I have a type foo of the following shape, type foo = shape( ?'bar' => float, ... ); Now if I try to access value of field bar in the following way, More on stackoverflow.com
🌐 stackoverflow.com
Feature UI hack help
What's a cleaner way to do this? The feature is here. More on forum.onshape.com
🌐 forum.onshape.com
September 14, 2020
How to instantiate a shape type object in hacklang - Stack Overflow
This seems like it should be in the documentation, but it isn't. I have a shape type. type ThisIsMyShapeType = shape( 'some_prop' => bool, ); How do I instantiate an object of this type ? More on stackoverflow.com
🌐 stackoverflow.com
🌐
Learn X in Y Minutes
learnxinyminutes.com › hack
Learn Hack in Y Minutes
*/ /* ========================... ================================== */ function demo_hack_types(): void { // Hack has five primitive types: bool, int, float, string, and null....
🌐
Reddit
reddit.com › r/remarkabletablet › 'hack' or library or tool that lets you create shapes that you can copy on the rm2
r/RemarkableTablet on Reddit: 'Hack' or library or tool that lets you create shapes that you can copy on the rM2
February 5, 2024 -

I distinctly recall seeing something like that but couldn't find it again when I searched: I want to make things like check boxes, check marks and other little symbols that I can copy and paste in my documents. If you manually make a PNG or PDF, those things are not copyable, but there was a tool that would let you make documents with shapes that you could copy, just as if you'd written/drawn them yourself. Anyone got a name or link for me ?

🌐
Hhvm
docs.hhvm.com › hack › reference › class › HH.Shapes
HH\Shapes - HHVM and Hack Documentation
Hack · HHVM · See Something Wrong? File an Issue · DocumentationHackReferenceClassHH\Shapes · namespace HH; abstract final class Shapes {...} ::at(shape() $shape, arraykey $index) Returns the value of the field $index of $shape, throws if the field is missing ·
🌐
GitHub
github.com › facebook › hhvm › issues › 7130
Hack: Allow extending shapes · Issue #7130 · facebook/hhvm
<?hh // strict type AOptions = shape( 'a' => int, 'b' => ?string, ); type BOptions = shape( 'a' => int, 'b' => ?string, 'c' => (function():void), ); class A { public function __construct(protected AOptions $options) {} } class B extends A { protected (function():void) $c; public function __construct(BOptions $options) { $this->c = $options['c']; parent::__construct($options); } }
Author   facebook
Find elsewhere
🌐
Slack
slack.engineering › hacklang-at-slack-a-better-php
Hacklang at Slack: A Better PHP | Engineering at Slack
April 14, 2020 - Hack improves upon this by separating these into different types and using generics to describe the types of their keys and values. A list-like array containing strings is a vec<string>, and a map-like array with string keys and integer values is a dict<string, int>. dict<string, mixed> is a valid, but not particularly useful type annotation, which says the dict contains string keys and values of any type. Enter shapes.
🌐
Blogger
hhvmhack.blogspot.com › 2014 › 03 › shapes.html
HHVM and HACK Programming language: Shapes
In fact, most PHP files are already valid Hack files. We made a conscious choice not to support a handful of deprecated functions and features that were incompatible with static typing (e.g. “variable variables” and the extract() function). We have also added many new features that we believe will help make developers more productive. ... <?hh function why_shapes(array $arr_as_struct): array { if ($arr_as_struct['id'] === '573065673A34Z') { $arr_as_struct['count']++; } else { $arr_as_struct['url'] = "http://google.com"; $arr_as_struct['count']--; } return $arr_as_struct; } function main_why_shapes() { $my_struct = array('id' => null, 'url' => null, 'count' => 0); $my_struct['id'] = '573065673A34Y'; $my_struct['url'] = 'http://facebook.com'; var_dump($my_struct); $my_struct = why_shapes($my_struct); var_dump($my_struct); } main_why_shapes();
🌐
Atom
atom.com › premium domains for sale
Shape Name Generator (500+ Ideas & Suggestions) - Atom
Generate 500+ Shape name ideas for a business, brand, app, game, or project. Immediate results and matching domain name suggestions.
🌐
GitHub
github.com › facebook › hhvm › issues › 8504
Shape inheritance or extension · Issue #8504 · facebook/hhvm
May 17, 2019 - Hi, Please provide a way to extend or inherit shapes in order to avoid rewrite same fields all the time. maybe something like this. type a = shape( 'code'=>string, 'name'=>string, ); type b = extend_shape(a,shape( 'age'=>int )); //the ex...
Author   facebook
🌐
Nameschip
nameschip.com › home › names chip › 450+ unique shape names that are creative, fun & timeless in 2026 ✨
450+ Unique Shape Names That Are Creative, Fun & Timeless in 2026 ✨ - Names Chip
May 14, 2026 - A good name should feel natural, memorable, and unique. Some of the best creative shape names include Prism Drift, Neon Hex, Dream Dimensions, and Crystal Angles.
🌐
Hhvm
docs.hhvm.com › hack › reference › class › HH.Shapes › idx
HH\Shapes::idx
Hack · HHVM · See Something Wrong? File an Issue · DocumentationHackReferenceClassHH\Shapesidx · Use Shapes::idx to retrieve a field value in a shape, when the key may or may not exist · public static function idx( shape(...) $shape, arraykey $index, mixed $default = NULL, ); If $index does not exist in the shape, the default value will be returned ($default), if one has been set.
🌐
Deernames
deernames.com › home › 500+ names of shapes: basic, geometric, 2d, 3d, funny & aesthetic shape names
500+ Names of Shapes: Basic, Geometric, 2D, 3D, Funny & Aesthetic Shape Names
May 12, 2026 - names of shapes · Circle · Square · Triangle · Rectangle · Oval · Pentagon · Hexagon · Octagon · Sphere · Cube · Cone · Cylinder · Pyramid · Prism · Diamond · Crescent
🌐
TikTok
tiktok.com › discover › funny-shape-names
Funny Shape Names | TikTok
May 18, 2026 - Learning shapes name is a fun|shapes name for kids|kids learning|nursery|nursery rhymes #creatorsearchinsights #fyp #shapesname #kidslearning #nursery Aprendiendo los Nombres de las Formas para Niños. Explora los nombres de las formas en un divertido vídeo educativo para niños.
🌐
Onshape
forum.onshape.com › using onshape › featurescript
Feature UI hack help — Onshape
September 14, 2020 - For the UI of the Part Name feature, I want the ability to switch segments between a string or formula, but I don't want to make the feature super long with boolean boxes. I've kind of hacked it by using the OPPOSITE_DIRECTION booleans, which gives me a much cleaner and brief layout, but it feels kinda hackey because it is.
🌐
Namezhouse
namezhouse.com › home › 120+ all shapes names with pictures (2d & 3d explained)
120+ All Shapes Names With Pictures (2D & 3D Explained)
April 6, 2026 - Onyx A gemstone (cut in shapes), from Greek. It feels strong, polished, and protective. Best for a resilient, stylish, and loyal person. Ridge A long narrow hilltop, from English. It feels strong, natural, and steady. Great for an outdoorsy, reliable, and adventurous spirit. Shard A broken piece, from English. It feels edgy, unique, and resilient. Perfect for a complex, beautiful person who has overcome challenges. 15+ Powerful Team Names That Instantly Command Respect
🌐
RealClearScience
realclearscience.com › 2014 › 01 › 22 › 12_weird_shapes_that_actually_have_names_257155.html
12 Weird Shapes that Actually Have Names | RealClearScience
April 21, 2023 - Now try drawing a balbis. That might sound much harder—until you realize that you’ve actually been doing it since Kindergarten (keep reading). There are a number of shapes most of us come into contact with every day while blissfully unaware of what to actually call them.