How do I convert the JavaScript module.exports to typescript
The JavaScript code of the module.exports is:
module.exports = {
discord: {
clientID: "",
clientSecret: "",
clientToken: "",
},
tokens: {
twitchClientID: "",
openWeatherMap: "",
},
};
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: "",
},
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.