Search code examples
typescriptvisual-studio-codetsconfig

Why can tsconfig.json not find my files in a src folder?


I am giving my first try at TypeScript compiling and I am trying to do it within Visual Studio Code with a tsconfig file.

I have read the documentation at the TypeScript site and believe I have formatted my file the correct way but the error I keep getting in the output is:

error TS6053: File 'c:/Users/username/devbox/home/tsc-play/**/*.ts' not found. 2:46:11 PM - Compilation complete. Watching for file changes.

However, in that folder there is a 'hello.ts' file.

Here is the code for my tsconfig.json file:

{
    "compilerOptions": {
        "target": "es5",
        "outFile": "dist/bundle.js",
        "watch": true
    },
    "compileOnSave": true,
    "files": [
        "src/*.ts"
    ]

}

Solution

  • You need to change the "files" to "include" in your tsconfig file.

    The files flag looks for specific files while include can use glob syntax.