How to create an application-specific config file for TypeScript?

As Typescript is transpiled into JavaScript there is no difference in your usecase. The browser does not get the TS code but the JS.


You can do it the following way.

First define structure of your config file, in lets say config.ts:

export interface Config
{
    uriPath: string;   
    port: number;   
    settings: string[];
}

Then create config.json that actually holds the data:

{
    "uriPath": "mgNation",
    "port": 1506,
    "settings": [
        "=[tor.start]",
        "=[copp.start]"
    ]
}

And consume it in your app.ts:

let config: Config = require('./path/to/config.json');