Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No output from compiler

Tags:

typescript

I am trying to invoke the Typescript compiler (on Windows via node) with the following command-line:

tsc.cmd -p tsconfig.json --outDir D:\ts-cscript-debugger\out

The current working folder -- and the location of the tsconfig.json -- is D:\DefinitelyTyped\types\activex-wia.

However, the compiler doesn't output anything; the folder passed to outDir remains empty.

Why? How can I get the compiler to output the compiled files?


When I pass the --listFiles parameter, I get a list of all the files to be compiled:

C:/Users/-----/AppData/Roaming/npm/node_modules/typescript/lib/lib.scripthost.d.ts
C:/Users/-----/AppData/Roaming/npm/node_modules/typescript/lib/lib.es5.d.ts
D:/DefinitelyTyped/types/activex-wia/index.d.ts
D:/DefinitelyTyped/types/activex-wia/activex-wia-tests.ts

The tsconfig.json looks like this:

{
    "compilerOptions": {
        "module": "commonjs",
        "lib": [
            "es5",
            "scripthost"
        ],
        "noImplicitAny": true,
        "noImplicitThis": true,
        "strictNullChecks": true,
        "strictFunctionTypes": true,
        "baseUrl": "../",
        "typeRoots": [
            "../"
        ],
        "types": [],
        "noEmit": true,
        "forceConsistentCasingInFileNames": true,
        "esModuleInterop": true
    },
    "files": [
        "index.d.ts",
        "activex-wia-tests.ts"
    ]
}
like image 650
Zev Spitz Avatar asked Aug 22 '26 20:08

Zev Spitz


2 Answers

Your tsconfig.json contains "noEmit": true, which specifically instructs the compiler not to emit the Javascript code.

like image 71
Titian Cernicova-Dragomir Avatar answered Aug 26 '26 23:08

Titian Cernicova-Dragomir


I experienced similar behavior but the noEmit answer didn't help me (because I hadn't set that flag).

In my case, the issue was that I had manually deleted my dist/ directory but neglected to also delete the .tsbuildinfo file, putting it out of sync. TypeScript checked the .tsbuildinfo and determined that it had nothing to do as it believed all of the source files were up to date.

Deleting .tsbuildinfo solved the issue for me.

like image 35
ILikeFood Avatar answered Aug 26 '26 22:08

ILikeFood