Add JSApiImpl to simplify writing hand typing.
Fix typing for global functions