Backports the following commits to 6.x: - [typescript] add typescript support for the server and browser (#19104)