Search code examples
mime-typestypescript

What's the MIME-Type of TypeScript?


I want my IIS to correctly display .ts files, is there any MIME-Type for TypeScript? text/javascript or similar may also work, but are there specifications for that?

I already looked up the language specification but I didn't find any clue.


Solution

  • It would be good to know why you want to serve TypeScript files.

    As far as I understand, TypeScript is used to compile to Javascript, which is then executed in a browser. Currently, there is no native support for TypeScript (correct me if I'm wrong).

    If you still want to serve .ts files via IIS, you can still add a custom mime-type in IIS Admin associated with .ts. The standard defines the prefixes x., vnd. and prs., and the vnd. prefix is also listed in the standardized mime types text/ and application/.

    So, depending on your usage, you might choose text/x.typescript or text/prs.typescript.