Questions tagged [tsc]

tsc is a compiler for converting TypeScript into plain JavaScript.

tsc is a compiler for converting TypeScript into plain JavaScript targeting either the ECMAScript 3 or ECMAScript 5 specifications.

927 questions
7
votes
1 answer

TypeScript compiler: generated sources, root dirs, excludes and symlinks

I have this setup of a TypeScript 2.0.3 project: src/main/webapp/tsconfig.json src/main/webapp/app -- contains .ts files src/main/webapp/app/tsModels -- a symlink to ../../../../target/tsModels target/tsModels/ -- contains .ts files The goal is…
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
7
votes
2 answers

How to include lib.es2015.core.d.ts in tsconfig.json?

I'm writing Angular 2 Universal app, so I don't want any DOM types. But I want to compile all files in dir, so setting "file" in tsconfig.json is not acceptable.
OwnageIsMagic
  • 1,949
  • 1
  • 16
  • 31
7
votes
2 answers

Typescript sourcemaps using command-line Babel

I'm trying to get Babel to produce sourcemaps when run from the command line. The Babel docs around sourcemaps seem to be targeted more toward the gulp workflow and I'm not sure how that translates to the command line. I'm compiling my typescript…
zyzof
  • 3,415
  • 1
  • 25
  • 21
6
votes
1 answer

How do I transpile aliased paths in TypeScript to JavaScript?

I have a TypeScript project that I am trying to transpile into executable JavaScript which makes use of path aliases. This is required for the NPM package I am working on. For example here with importing a method from my lib directory without…
markodeezy
  • 71
  • 2
6
votes
1 answer

How do I fix TSC errors when using vite?

I am using Vite with a Typescript React project. I have jest tests in my project as well. When I run vite build it seems to be compiling and bundling my test files. I have some stubbed out tests that I plan to get to with some compiling errors right…
Carson Wood
  • 1,174
  • 3
  • 14
  • 23
6
votes
2 answers

TypeScript tsc type check with references in monorepos

I'm using Yarn Workspaces, and I want a cli-command to check the types of my source ts files located at packages/*. Originally I build my project by using webpack (with esbuild, which does not check types) and check types with tsc --noEmit…
swwind
  • 123
  • 6
6
votes
1 answer

In TypeScript's generated declaration files, exclude internally exported types

I'm writing an interview question. I'm mocking a backend server by creating an "Http Client" package. Some of my types I want exposed in .d.ts files so that the interviewee has context, but most I do not, as they would expose the inner workings of…
dx_over_dt
  • 13,240
  • 17
  • 54
  • 102
6
votes
0 answers

Typescript TypeORM ColumnTypeUndefinedError

I tried TypeORM, and I got "ColumnTypeUndefinedError: Column type for User#email is not defined and cannot be guessed. Make sure you have turned on an "emitDecoratorMetadata": true option in tsconfig.json. Also make sure you have imported…
Sunwoo Jeong
  • 87
  • 2
  • 7
6
votes
1 answer

What is the typescript compiler's default lib value?

The documentation says --lib is derived from --target by default: Note: If --lib is not specified a default list of libraries are injected. The default libraries injected are: For --target ES5: DOM,ES5,ScriptHost For --target ES6:…
Capi Etheriel
  • 3,542
  • 28
  • 49
6
votes
2 answers

How to use lint-staged in a lerna monorepo to run the same command in all packages?

I have the following root package.json: { "name": "project", "private": true, "workspaces": [ "packages/*" ], "scripts": { "build": "lerna run build", "dev": "lerna run start --stream --parallel", "format": "yarn prettier…
user13103906
6
votes
1 answer

typescript project references and JavaScript files

I have a mixed ts and js project that works fine with the allowJS: true setting in tsconfig. I now want to use Project references which need composite: true which means the allowJS can't be used. Does this mean I can only use Project references in…
leonormes
  • 979
  • 10
  • 29
6
votes
1 answer

TypeScript allow for optional arguments - overloading methods

I have this method signature on a class: lock(key: string, opts: any, cb?: LMClientLockCallBack): void; if a user uses it like so: lock('foo', null, (err,val) => { }); they will get the right typings. However, if they omit the options argument…
user7898461
6
votes
1 answer

Provide Task type for async queue using generics

I have this right now: export type EVCb = (err:any, val?:any) => void; export type Task = (cb: EVCb) => void; export const q = async.queue((task: Task, cb) => task(cb), 2); Isn't there a way to give async.queue type information about the task using…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
6
votes
1 answer

Angular: ngc or tsc?

I have been using tsc, but see that angular.io emphasizes ngc. I am wondering if there are advantages to either or if I should choose one over the other. Thanks in advance.
David Streid
  • 685
  • 3
  • 12
  • 24
6
votes
4 answers

tsc --watch not updating files when outDir present in tsconfig.json

I am trying to write a nodejs command line app with Typescript and I have the following tsconfig file: { "compilerOptions": { "module": "commonjs", "outDir": "dist" }, "include": ["src/*.ts"] } When I use tsc everything works as expected…
Arnelism
  • 1,484
  • 1
  • 15
  • 22