Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:35
    trusktr edited #31527
  • 01:59
    sandersn review_requested #35661
  • 01:59
    sandersn review_requested #35661
  • 01:59
    sandersn edited #35661
  • 01:58
    sandersn synchronize #35661
  • 01:58

    sandersn on remove-object-rewrite

    flip boolean right way round (compare)

  • 01:58
    sandersn synchronize #35661
  • 01:58

    sandersn on remove-object-rewrite

    reinstate object->any rewrite w… (compare)

  • 01:35
    typescript-bot opened #35665
  • 01:24
    typescript-bot opened #35664
  • 01:05
    typescript-bot opened #35663
  • 01:05
    weswigham synchronize #15575
  • 01:05
    weswigham synchronize #28460
  • 01:04
    weswigham synchronize #31641
  • 01:04

    weswigham on master

    Update user baselines (#35662) (compare)

  • 01:04
    weswigham closed #35662
  • 01:04
    rbuckton synchronize #35176
  • 01:00
    bmamouri edited #35660
  • 00:59
    typescript-bot opened #35662
  • 00:44
    sandersn opened #35661
con-ssc
@con-ssc
well that is how you use typings
Mental Arena
@caperavensoftware
then I don't have to do that
con-ssc
@con-ssc
doesn't make sense to only use typings for the compiler, they enable you support for autocompletion and so on
luking4
@luking4
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
@simplysh
@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
@Ciantic
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
@mniak
Guys, what means these "three dots" (...) in this excerpt? I don't know this idiom...
const routes: RouterConfig = [
  ...HeroesRoutes,
  ...CrisisCenterRoutes
];
This message was deleted
Jari Pennanen
@Ciantic
let a = [1,2,3];
let b = [6,6,6];
let c = [...a, ...b];
con-ssc
@con-ssc
@Ciantic playground has TS 1.8 that does not support async/awaits I guess
Jari Pennanen
@Ciantic
===
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
@mniak
@Ciantic Very interesting, my friend! Thanks
Jari Pennanen
@Ciantic
was there nightly playground somewhere? I think @basarat did something like it
Andre Soares
@mniak
@simplysh Thanks, I couldn't even name it, :laughing:
Andrei Nemes
@simplysh
@andregsilv no worries - have a read, it's pretty cool!
Jari Pennanen
@Ciantic
must try alm tools, it oughta use ntypescript
oh yeah, it can show me the types
Tim Sandberg
@largeDachshund
@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
spacejack
@spacejack
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
@Ciantic
Uhh
disnsbsisnshksk
@amanuelhi_twitter
do you guys know gulp?
Jari Pennanen
@Ciantic
class Bar {
}

class Foo {
}

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

decorator(Bar);

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

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
@Bnaya

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
@riston
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
@simplysh

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
https://www.typescriptlang.org/docs/release-notes/typescript-1.8.html

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
@bobuntu
@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
@simplysh
if you're new to ts, this is a good talk about it https://channel9.msdn.com/Events/Build/2016/B881
James Forbes
@JAForbes

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
@wanderer06
@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