How to write "module.exports" from javascript to typescript?

use export default

const val = {
    discord: {
        clientID: "",
        clientSecret: "",
        clientToken: "",
    },
    tokens: {
        twitchClientID: "",
        openWeatherMap: "",
    },
};
export default val

Try to use the export default keyword:

export default {
    discord: {
        clientID: "",
        clientSecret: "",
        clientToken: "",
    },
    tokens: {
        twitchClientID: "",
        openWeatherMap: "",
    },
}

You can also export single elements (equivalent of module.exports.foo = { ... }):

export const foo = {
    discord: {
        clientID: "",
        clientSecret: "",
        clientToken: "",
    },
    tokens: {
        twitchClientID: "",
        openWeatherMap: "",
    },
}