I’m trying to run a script created in a regular folder with two .ts files. One with the script and one with helper functions to run it. I’m also importing more things such as axios or form-data.
The thing is that when I try to run the script with ts-node: node script.ts, the following error appears:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts"
My package.json:
{
"dependencies": {
"@types/node": "^17.0.23",
"axios": "^0.26.1",
"form-data": "^4.0.0",
"showdown": "^2.0.3",
"ts-node": "^10.7.0",
"typescript": "^4.6.3"
},
"type": "module"
}
And my tsconfig.json:
{
"compilerOptions": {
"esModuleInterop": true
},
"include": ["/**/*.ts"],
"exclude": ["node_modules"]
}
Does anyone know what I’m doing wrong? thanks!