TypeScript Version:
"dependencies": {
"@types/react": "^16.8.22",
"@types/react-dom": "^16.8.4",
"typescript": "^3.5.3"
}
Search Terms:
Typescript does not compile
Code
My tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": false,
"noEmit": true,
"sourceMap": true,
"baseUrl": "./",
"jsx": "preserve"
},
"include": [
// All these options do not do the job
"./*.ts",
"./*",
"*",
"./"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
My file to compile, sample.ts
// sample.ts
const f = (a: string, b: number) => a + b;
My package.json
// package.json
{
"name": "ts2",
"version": "1.0.0",
"description": "Typescript playground",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"tsc": "./node_modules/.bin/tsc"
},
"author": "",
"license": "ISC",
"dependencies": {
"@types/react": "^16.8.22",
"@types/react-dom": "^16.8.4",
"typescript": "^3.5.3"
}
}
I execute tsc to compile:
$ npm run tsc
Expected behavior:
Typescript compiles my file and creates sample.js
Actual behavior:
Nothing happens. .js version is not created.
$ npm run tsc
> [email protected] tsc /Users/sergey/sbox/ts2
> tsc
Playground Link:
Repo to reproduce
https://github.com/wzup/ts-bug
Related Issues:
You shouldn't use "noEmit": true in your tsconfig.json if you compile with tsc
From compiler options description --noEmit - Do not emit outputs.
_UPD._ This type of questions is better suited for StackOverflow first
@IllusionMH
Yes, this fixes the issue.
Thanks
It looks like this is a question rather than a bug report. This issue tracker is for tracking bugs and active work on TypeScript itself, rather than a general forum for programmers using TypeScript to get help or ask questions.
You can ask questions on sites like Stack Overflow. We are not able to provide one-on-one support on the issue tracker. Please read the issue template carefully - it has important information on what kinds of reports can be acted on here, as well as links to useful TypeScript resources. Thanks!
Most helpful comment
You shouldn't use
"noEmit": truein yourtsconfig.jsonif you compile withtscFrom compiler options description
--noEmit- Do not emit outputs._UPD._ This type of questions is better suited for StackOverflow first