Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 19:29
    Andrew5569 edited #43125
  • 19:26
    Andrew5569 edited #43125
  • 19:16
    Andrew5569 opened #43125
  • 18:00
    typescript-bot closed #43050
  • 15:40
    TomasHubelbauer closed #43082
  • 15:39
    TomasHubelbauer closed #43124
  • 14:54
    Kingwl synchronize #43092
  • 14:54
    Kingwl edited #43092
  • 14:47
    TomasHubelbauer opened #43124
  • 12:50
    xl1 edited #42984
  • 12:47
    xl1 closed #42984
  • 12:14
    Kingwl edited #43092
  • 11:03
    Kingwl edited #43092
  • 11:02
    Kingwl synchronize #43092
  • 10:07
    Kingwl edited #43092
  • 10:07
    Kingwl edited #43092
  • 09:59
    Kingwl synchronize #43114
  • 07:12
    typescript-bot synchronize #42842
  • 06:24
    github-actions[bot] synchronize #28460
  • 06:24
    github-actions[bot] synchronize #15575
well that is how you use typings
Mental Arena
then I don't have to do that
doesn't make sense to only use typings for the compiler, they enable you support for autocompletion and so on
Hi I am trying to integrate ng2-handsontable (https://github.com/valor-software/ng2-handsontable) with my angular2 project setup done with 5 min quick start link (https://angular.io/docs/ts/latest/quickstart.html). But somehow it is not loading index.ts file of ng2handsontable component. I found that my angular2 setup has @angular folder structure while ng2-handsontable is installed with angular2 folder. I got rid of build errors but now at run time index.ts is not loaded. Can anyone can guide, what may gone wrong here?
Andrei Nemes
@caperavensoftware you should be able to include the typings index file in your gulp-typescript pipe, that should save you having to manually include refs
don't know how gulp does it but it would have to use tsc to concatenate the output for it to work
Jari Pennanen
what is wrong with this:
let a = async (s) => {
    var result = await Promise.resolve("Data recieved");
    return "blaa";
VSCode approves this, playground says error
if I've understood this correctly, above should infer return type as PromiseLike<string>
because of "blaa"
Andre Soares
Guys, what means these "three dots" (...) in this excerpt? I don't know this idiom...
const routes: RouterConfig = [
This message was deleted
Jari Pennanen
let a = [1,2,3];
let b = [6,6,6];
let c = [...a, ...b];
@Ciantic playground has TS 1.8 that does not support async/awaits I guess
Jari Pennanen
var a = [1, 2, 3];
var b = [6, 6, 6];
var c = a.concat(b);
@andregsilv with playground: http://www.typescriptlang.org/play/
@con-ssc oh right, I'm using this akward -> TS -> ES6 -> Babel thing
Andre Soares
@Ciantic Very interesting, my friend! Thanks
Jari Pennanen
was there nightly playground somewhere? I think @basarat did something like it
Andre Soares
@simplysh Thanks, I couldn't even name it, :laughing:
Andrei Nemes
@andregsilv no worries - have a read, it's pretty cool!
Jari Pennanen
must try alm tools, it oughta use ntypescript
oh yeah, it can show me the types
Tim Sandberg
@DanielRosenwasser Thanks for the tip! Turned out I commented out the root reference in an attempt to uncover the source of ponderous build times. Once I put the reference back, I noticed the "dist" folder was not getting auto-populated with *.d.ts files
I'm using tsconfig's outFile to create a bundle. Is there a way to specify a single entry point .ts source in tsconfig.json, and then use a wildcard for typings?

Eg. I can do:

"filesGlob": ["*.ts", "typings/**/*.ts"]

or I can do:

"files": ["main.ts", "typings/a/a.d.ts", "typings/b/b.d.ts", ...]

But if I do:

"filesGlob": ["main.ts", "typings/**/*.ts"]

It will bundle all .ts files it finds, not just the ones required by main.ts. If I use "files" it will only bundle the required ones, but I have to list every typings file by name.

Jari Pennanen
do you guys know gulp?
Jari Pennanen
class Bar {

class Foo {

function decorator(c: (new()=> Bar)) {
    return c;


decorator(Foo); // Not an error?
oh man, I must add properties to trigger error here
Emil Hammarström
@Ciantic does c: (new()=> Bar) really achieve anything more than c: () => Bar?
Jari Pennanen
@initiumSrc yea, I was a bit struck by the structural typing here
Basarat Ali Syed

Thanks for the mention @Ciantic :rose:

The playground I once worked on that is easy to upgrade to ts latest although I don't have the heart to do that anymore basarat/TypeScriptEditor@b90d00b

This i the project I am working on for this year http://alm.tools/ Will most likely create a hosted version of alm for demo so people can try it before npm installing at some point :heart:

Bnaya Peretz

I'm trying to create a class decorator

function injectShouldComponentUpdate<T>(clazz: T) {
    return class extends clazz {


And i'm getting the following error:
T is not a constructor function type

what am i missing?
Risto Novik
Hello, is it possible to move to TypeScript incrementally without rewriting the whole project once? If it is could you send some article links?
Andrei Nemes

you can think of any javascript file as a typescript file without typings. it's designed for maximum interoperability. if you want, you can include js files in your ts compilation too

Including .js files with --allowJs

Often there are external source files in your project that may not be authored in TypeScript. Alternatively, you might be in the middle of converting a JS code base into TS, but still want to bundle all your JS code into a single file with the output of your new TS code.
.js files are now allowed as input to tsc. The TypeScript compiler checks the input .js files for syntax errors, and emits valid output based on the --target and --module flags. The output can be combined with other .ts files as well. Source maps are still generated for .js files just like with .ts files.

Robert Nsinga
@riston TypeScript essentially compiles pure javascript, i.e. what gets executed is your *.js files. Check this article out for more: Incrementally migrating to TypeScript.
Andrei Nemes
if you're new to ts, this is a good talk about it https://channel9.msdn.com/Events/Build/2016/B881
James Forbes

Hi all, I've got a tricky generics problem I'm hoping someone can help me solve:

I want to have a map function that supports any object that implements the Functor interface.
But I want to declare that map will always return the same type that it received.

e.g. if I pass in an array, I want tsc to know its an array. Or if I pass in a Maybe, I want tsc to know its a Maybe.
I'm losing precision when I receive the result. The type signature can only guarantee that V is a Functor, instead I want to guarantee that V is the same type that was received.

interface Functor<T> {
    map<T>(a: any): Functor<T>;

interface Ramda { 

    map<T, U, V extends Functor<U>>(fn: (x: T) => U): (obj: V) => V;


interface Maybe<T> {
    map<T2> ( f: (value: T) => T2 ) : Maybe<T2>

var m : Maybe<string>;

declare var R : Ramda

// tsc says b is Functor<Number>
// but I want it to be a Maybe<Number>

var b = R.map( (a:number) => a)(m)

Is this possible?

George Nemes
@JAForbes looks a bit confusing at first glance
but let's step back a little bit
your Maybe return type is captured here map<T, U, V extends Functor<U>>(fn: (x: T) => U): (obj: V) => V;
however, there is nowhere to infer the type of V from, as it is not passed to the original function anywhere
so you'd have to provide V
maybe like this