Fix #788: Add typings and compiler support for TypedArrays

Not what we said, but I can move it if you want.