Why typescript keep giving me No inputs were found in config file error?

3.3k views Asked by At

Why does typescript keep giving me the No inputs were found in config file error?

When I use tsconfig.json in VS Code, but when I try to build it, it gives me the error.

Terminal:

error TS18003: No inputs were found in config file '/Users/user/Desktop/projects/ts/.vscode/tsconfig.json'. 
Specified 'include' paths were '["/Users/user/Desktop/projects/ts/mathweb/app.ts"]' and 'exclude' paths were '["/Users/user/Desktop/projects/ts/mathweb/app.ts"]'.


Found 1 error.

The terminal process "zsh '-c', 'tsc -p /Users/user/Desktop/projects/ts/.vscode/tsconfig.json'" failed to launch (exit code: 2).

Terminal will be reused by tasks, press any key to close it.

And I search on SO, and some answer told me to create a empty file, so I did: enter image description here

But it doesn't work. Other answer told me to use rootDir at tsconfig.json, and I did, and also doesn't work.

It make me confused. I'm not familiar with typescript and I just want ts compile to specified directory, and that is what happened right now.

I'm using vscode ide, I'm not sure if that is IDE's problem,or could also be my fault

tsconfig.json:

{
"compilerOptions": {

    "outDir": "/Users/user/Desktop/projects/ts/mathweb/app.ts",
    "rootDir": "./mathweb"

},

"include": [
    "/Users/user/Desktop/projects/ts/mathweb/app.ts"
]
,

"exclude": [
    "/Users/user/Desktop/projects/ts/mathweb/app.ts"
]

}

2

There are 2 answers

0
Moniruzzaman Sujon On

For me, I just close the "VS Code Editor" and Re-open it, And It's worked & the error has gone!!!

3
Heet Vakharia On

include expects relative path so and you added app.ts in exclude

{
"compilerOptions": {

    "outDir": ".",
    "rootDir": "."

},

"include": [
    "./app.ts"
]

}


Edit: as you don't have tsconfig on root dir try this

{
    "compilerOptions": {
    
        "outDir": "../dist",
        "rootDir": "."

    },

    "include": [
        "./../mathweb/"
    ]
}