Completely redone the typings from the docs.

Using 0.9 (generics and override by string literal).