The main definition of content negotiation is that it's an HTTP mechanism that enables different versions of specific representations of a resource at the same URI. Using this approach, the requester is able to specify which version fits their requirements. Of course, with TypeScript, it couldn't be different and you can easily enable that possibility.
One common way to specify the response body format is passing the payload at the header of the HTTP request, like so:
Accept: application/javascript
The following screenshot shows an example from Postman with the accept header as application/javascript: