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
8
votes
1 answer

Set --verbose option in VSCode Typescript build task

When compiling from the command line I can specify tsc -b --verbose However I can't figure out how to configure the default build task in vs code to do the same. I can't find any related entry in tsconfig.json or in tasks.json
grim_i_am
  • 3,664
  • 5
  • 19
  • 19
8
votes
1 answer

Force object to have at least one key ( Object.keys(o).length > 0 )

Say I have this object export interface Name { [key: string]: boolean } const v = {}; how do I prevent this from compiling? What I want to do is force v to have at least one property: const v = {foo: true};
user7898461
8
votes
2 answers

Is @types/core-js still necessary for TS typings in a Node.js project?

I have several backend-only Node.js projects which use a simple TypeScript config. Before March 2018, I had this in package.json: "devDependencies": { "@types/core-js": "^0.9.46", "@types/node": "^9.6.2" } since ~March 2018, I have been…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
8
votes
2 answers

AngularJS TypeScript unit testing

I am struggle with create proper unit tests for the angularjs (v1.4.9) application which contains both javascript files (with jasmine tests) and typescript files (with no tests at all, now I am trying to use Mocha, but it can be any framework).…
Michał Jarzyna
  • 1,836
  • 18
  • 26
8
votes
2 answers

Typescript can't find a module that has been mapped with SystemJS

Typescript doesn't find the module in this import import ga from 'googleAnalytics'; SystemJS knows where to find the module, because it has been mapped up front like so: map: { '@angular': 'node_modules/@angular', 'rxjs':…
Maxime Dupré
  • 5,319
  • 7
  • 38
  • 72
8
votes
1 answer

Webpack with a client/server node setup?

I'm trying to set up a webpack-based flow for an Angular2 app with a node backend server. After many hours banging my head against it, I've managed to get the client to build happily, but I can not figure out how to now integrate my server build. My…
XeroxDucati
  • 5,130
  • 2
  • 37
  • 66
8
votes
3 answers

TypeScript 1.3 for Visual Studio 2013 missing SDK directory (tsc.exe)

Typescript v1.3 was announced today, so I installed the power tools update for VS2013. After installation I can see that Visual Studio now knows about "protected" keyword and tuple types, which is great! But then I changed the TypeScriptToolsVersion…
mrcrowl
  • 1,265
  • 12
  • 14
8
votes
2 answers

TypeScript, node.js development with Visual Studio 2012 express

How can I write, build and run a node.js app in Visual Studio? I install the TypeScript extension on VS and the node.js package. When I create new project of type TypeScript it is only able to write script for browsers only. Update I want…
stonedmind
  • 83
  • 1
  • 4
7
votes
2 answers

How can I resolve the TypeScript Compiler error "Namespace 'NodeJS' has no exported member 'Global'"?

QUESTION: How can I resolve the Typescript Compiler (tsc) error "Namespace 'NodeJS' has no exported member 'Global'"? While running tsc, I'm all of a sudden seeing the following error in a "legacy"(not new)…
derekbaker783
  • 8,109
  • 4
  • 36
  • 50
7
votes
2 answers

What's the difference between `tsc --build --clean` vs. `rm -rf *.js`?

I have a quick question on the tsc command being used with the arguments --build --clean, which I understand is used for cleaning /wiping off the .js files generated earlier by the Transpiler (tsc). What is the speciality or significance of this…
itsraghz
  • 857
  • 1
  • 11
  • 25
7
votes
1 answer

Compile single .ts file to stdout

I am looking to compile a single .ts file to stdout, something like this: tsc foo.ts > foo.js is this possible somehow? I want to control where the output goes without using a tsconfig.json file.
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
7
votes
3 answers

Unsafe implicit conversion of generics in TypeScript

The TypeScript compiler tsc compiles the following code without complaints, even with the --strict flag. However, the code contains a basic bug, which is prevented in languages like Java or C#. interface IBox { value: T; } const numberBox:…
ominug
  • 1,422
  • 2
  • 12
  • 28
7
votes
3 answers

Error compiling Typescript with graphql files

So I'm new in this area, the thing is that I'm trying to compile a Typescript project with graphql files on it (with .graphqlextension). It' based on the serverless framework, so to compile it I launch npm startwhich launches a cd src/app && tscin…
7
votes
3 answers

How can I import an existing React component defined in JSX in a Typescript module (.tsx)

I have an existing React component that's coded in JSX and I can't convert to Typescript at this time. I'd like to make use of it in a new React application that is being written in Typescript. I cannot figure out if it's possible to import and…
Jobu
  • 590
  • 7
  • 18
7
votes
1 answer

Why does typescript not complain about certain undefined variables

I have the following example: class Uncle { constructor(public name : string) { } talk() { return "Hello my name is " + name; } } let p : Uncle = new Uncle("Jo"); console.log(p.talk()); For certain variable names, typescript (right now…
flq
  • 22,247
  • 8
  • 55
  • 77