This comes with a big caveat that if the type assertion is wrong at runtime that the AOT'ed app will crash. Also I get the sense that the author assumes type "string" always means non-null and non-undefined but this is only true if the strictNullChecks compiler option is enabled.
Nonetheless, cool to see folks experimenting in the JS engine arena, especially around AOT!
There's a lot of poorly-explored room in compiler design to take generalized invariants/preconditions/postconditions into consideration (explicit ones are useful for opaque functions defined in a different TU), not just things considered "types" (the problem with types is that they have different lifetime/allocation concerns than assertions).
Are people this eager to be PIP'd?
On running the example 'Array Reading' with an optimization level of 3 I get the following error
CompileError: WebAssembly.instantiate(): Compiling function #2 failed: local.set[0] expected type f64, found global.get of type i32 @+207
Is this expected?