Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 15 17:06
    chaffeqa opened #1508
  • Aug 08 16:07
    lierdakil closed #1507
  • Aug 08 16:07
    lierdakil labeled #1507
  • Aug 08 11:43
    rahamin1 opened #1507
  • Aug 07 12:07
    lierdakil labeled #1505
  • Aug 07 12:07
    lierdakil closed #1505
  • Aug 06 21:51
    TheEmrio closed #1506
  • Aug 05 14:22
    TheEmrio opened #1506
  • Jul 15 15:40
    Xapphire13 closed #1496
  • Jul 10 13:23
    akonwi opened #1505
  • Jul 10 04:44
    nelson6e65 edited #1504
  • Jul 10 04:40
    nelson6e65 opened #1504
  • Jul 08 06:40
    sshquack closed #846
  • Jun 17 16:02
    akonwi opened #1503
  • Jun 02 18:18
    tanfonto opened #1502
  • May 28 17:11
    jazzdragon opened #1501
  • Apr 29 01:12
    dyping closed #1500
  • Apr 28 06:56
    dyping edited #1500
  • Apr 28 06:54
    dyping edited #1500
  • Apr 26 11:38
    dyping opened #1500
kpgarrod
@kpgarrod
@basarat: wow! I'm not sure I love the syntax, but I bow to your knowledge of the language
kpgarrod
@kpgarrod
say I have a file(1) with a number of imports (e.g. all the controllers in my app) and I want to import all of those controllers into two other files(2,3). How do I export all the imports from file 1 and re-import them to files 2 & 3?
Basarat Ali Syed
@basarat
@kpgarrod export * from "file"
kpgarrod
@kpgarrod
@basarat: sorry I'm being dumb here. So I have an export for each controller in 'controllers.ts' (instead of an import, right?). Then I import * as controllers from './controllers'; in my app.ts file and I try to use one of the controllers: var controller1 = controllers.Controller1. I get an error Controller1 does not exist on typeof controllers.js , although I get autocompletion for Controller1 on controllers.
Basarat Ali Syed
@basarat

I get an error Controller1 does not exist on typeof controllers.js

TypeScript error?

although I get autocompletion for Controller1 on controllers.

If its a completion provided by typescript you should see (badge) next to it. Otherwise its from the fuzzy finder and not reliable

kpgarrod
@kpgarrod
@basarat, I see. thanks for the tip
is there something wrong with what I am trying to do?
@basarat: sorry, yes typescript error
Basarat Ali Syed
@basarat

is there something wrong with what I am trying to do?

Nothing beyond the fact that I haven't done it personally so my advice might not be useful :D

kpgarrod
@kpgarrod
haha, mmm
Basarat Ali Syed
@basarat
import * as controllers from './controllers' and then controllers.Controller1 should work
If you have export class Controller1 in controllers
kpgarrod
@kpgarrod
mmm, do I need to import controller1 into controllers as well?
Basarat Ali Syed
@basarat
nope. Should be available on controllers
kpgarrod
@kpgarrod
so controllers only exports Controller1, but I can't seem to add a filepath to export class
export class Controller1 from './controller1'; gives me errors
kpgarrod
@kpgarrod
ah! export {default as Controller1} from './controller1';
Basarat Ali Syed
@basarat
my export statement was meant to go inside controller1. But whatever works :rose:
kpgarrod
@kpgarrod
I see I was using export default in Controller1. If I just use export Controller1 then I can re-export
Microsoft/TypeScript#2726
@basarat: Thanks for the help anyway
Nelo Mitranim
@Mitranim
default exports are more of a carryover from cjs
In ES6, you nearly always want to use named exports
Basarat Ali Syed
@basarat

In ES6, you nearly always want to use named exports

I also find them much easier to refactor ;)

kpgarrod
@kpgarrod
thanks for the advice
kpgarrod
@kpgarrod
how do you change the indentation (number of spaces) for formatting?
kpgarrod
@kpgarrod
perfect! thanks
how do you run a command: Typescript: Dependency View?
Basarat Ali Syed
@basarat
@kpgarrod ctrl + shift + p and type in dependency view
kpgarrod
@kpgarrod
wow! that is very cool :)
Mike Graham
@cmichaelgraham

@basarat :point_up: atom-typescript notes you are awesome :+1:

@AshleyGrant and I will make sure we incorporate these tips into the more polished subsequent versions of the :point_up: video chat

Basarat Ali Syed
@basarat
Thanks for your kindness. I need to work to make it easier to display the package's world view of files (which tsconfig, which file names etc etc.)
Mike Graham
@cmichaelgraham

hopefully it helps to get to see us bumping around as we experiment. it could probably be handled as a training issue. perhaps just a short section on getting started tips and tricks.

i really think once we incorporate your comments, there should be no issues with atom-typescript.

Mike Graham
@cmichaelgraham
on the topic of default exports, i hacked this together and it seems to be working:
// Type definitions for Showdown 0.3.1
// Project: https://github.com/coreyti/showdown
// Definitions by: cbowdon <https://github.com/cbowdon>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

declare module Showdown {

    /** Defined for information only - used in union type */
    interface Replace {
        /**
         * This is just the replacer function argument to String.prototype.replace, signature from lib.d.ts
         */
        replace(substring: string, ...args: any[]): string;
    }

// ... removed for brevity ...

    function forEach<T>(obj: T[], callback: (value: T, index: number, array: T[]) => any): void;
}

declare module "showdown" {
    var s: { Showdown };
    export default s.Showdown;
}
Mike Graham
@cmichaelgraham
i also edited the knockout.d.ts at the bottom to make it happy:

declare module "knockout" {
    var ko: KnockoutStatic;
    export default ko;
}
moved the KnockoutStatic inside the module declare
and replaced the = with default
Basarat Ali Syed
@basarat
@cmichaelgraham I suspect you are compiling with target system which is why you needed to make that change. If so then this inconsistency has been reported: Microsoft/TypeScript#3125
Willson Haw
@MrHayato
Hey all, just installed atom-typescript and I don't think it's working... It says all dependencies installed but none of my .ts files are color highlighted and things like autocomplete aren't working on them. Even editing and saving tsconfig.json does nothing. I've tried restarting atom and even uninstalling and reinstalling atom-typescript from command... am I missing something?
Willson Haw
@MrHayato
Figured it out. atom-typescript wasn't installing the autocomplete-plus dependency properly, had to manually apm install it and now it works..
Basarat Ali Syed
@basarat
@mrhayato : don't mind my asking which OS and which version of atom and how long did you wait. First time this has been reported :)
Basarat Ali Syed
@basarat
@mtraynham npm install tsd -g ... no need for the @next anymore.
Nelo Mitranim
@Mitranim
it's not marked as release though
on gh
Basarat Ali Syed
@basarat
sorry got it
Nelo Mitranim
@Mitranim
yeah that one
Basarat Ali Syed
@basarat
Nelo Mitranim
@Mitranim
nice