Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 21 09:49
    basarat commented #660
  • Oct 21 09:48
    basarat closed #660
  • Oct 21 09:48

    basarat on master

    Update README.md (#660) Change… (compare)

  • Oct 02 10:19
    AnuManjooran opened #660
  • Sep 10 18:36
    dependabot[bot] labeled #659
  • Sep 10 18:36
    dependabot[bot] opened #659
  • Sep 10 18:36

    dependabot[bot] on npm_and_yarn

    Bump node-fetch from 1.6.3 to 2… (compare)

  • Sep 04 23:45
    dependabot[bot] labeled #658
  • Sep 04 23:45
    dependabot[bot] opened #658
  • Sep 04 23:45

    dependabot[bot] on npm_and_yarn

    Bump http-proxy from 1.16.2 to … (compare)

  • Aug 30 23:16
    basarat commented #657
  • Jul 25 09:01
    sigmasoldi3r opened #657
  • Apr 29 23:01
    dependabot[bot] labeled #656
  • Apr 29 23:01
    dependabot[bot] opened #656
  • Apr 29 23:01

    dependabot[bot] on npm_and_yarn

    Bump jquery from 2.2.4 to 3.5.0… (compare)

  • Apr 04 02:46

    dependabot[bot] on npm_and_yarn

    (compare)

  • Apr 04 02:46
    dependabot[bot] closed #654
  • Apr 04 02:46
    dependabot[bot] commented #654
  • Apr 04 02:46
    dependabot[bot] labeled #655
  • Apr 04 02:46
    dependabot[bot] opened #655
Jari Pennanen
@Ciantic
compared to two:
blob
also when it's double fat arrows, one can do typeof s as a result type:
export const setUserView = add("setUserView", (s) => (p: string): typeof s => ({
    view : {
        type : "user",
        model : p
    }
}));
and I don't have to type State at all
to get extra parameter checking
but I have managed to abstract the "usefulNameForDebugging" away also, but this is a bit hard to swallow without more examples:
    connector = <Props, Element extends React.Component<Props, any>, T, D>(
        component: (new (props?: Props, context?: any) => Element) & { defaultActions: D, actions: T }
    ) => (
        // This extra level ensures the type inference does not take toProps and fromProps in to account
        toProps: (s: State) => Props,
        fromProps: (p: Props) => State
    ) => {
        if (!(component as any)._instanceIndex) {
            (component as any)._instanceIndex = 0;
        }
        let name = component.name + (component as any)._instanceIndex++;

        var o = {};
        for (let k in component.defaultActions) {
            if (component.defaultActions.hasOwnProperty(k)) {
                o[k] = this.add(name + "." + k, (s) => (payload?) => {
                    return fromProps(component.defaultActions[k](toProps(s))(payload));
                });
            }
        }
        let el = connect(s => toProps(s), () => o)(component) as typeof component;
        el.actions = o as any;
        return el;
    }
and I use it simply like this:
export const SidebarConnected = connector(Sidebar)(
    s => (s.sidebar),
    s => ({ // Properties of the sidebar to the app state
        sidebar : s
    }));
and best of all it autocompletes the bound actions like this:
SidebarConnected.actions.collapseItem
Jari Pennanen
@Ciantic
then I can define the state mutators in the Sidebar

export const selectItem = (s: IActionProps) => (item: IItem): IActionProps => ({
    expandedItemIds: s.expandedItemIds,
    selectedItemId: item.id
});

export const expandItem = (s: IActionProps) => (item: IItem): IActionProps => ({
    expandedItemIds: _.union(s.expandedItemIds, [item.id]),
    selectedItemId: s.selectedItemId,
});

export const collapseItem = (s: IActionProps) => (item: IItem): IActionProps => ({
    expandedItemIds: _.without(s.expandedItemIds, item.id),
    selectedItemId: s.selectedItemId,
});

export class Sidebar extends React.Component<IProps, void> {
    static actions: IActions;

    static defaultActions = {
        selectItem,
        expandItem,
        collapseItem,
    };
and soon I can replicate Delphi from 90's with drag & drop components
Basarat Ali Syed
@basarat
:rose: nice.I did check, indeed state is any in my code base. But I guess I don't use it at all.
and when I do I have it typed explicitly .... I knew it wasn't meant to last but didn't want to spend too much time. Just hated the switch statement :)
Julian
@pYr0x
hi @basarat sorry for bother you .... :) you answer my question on stackoverflow http://stackoverflow.com/questions/36415181/type-definition-if-a-function-that-when-called-pollutes-the-global-namespace/36415200#36415200 can you explain what you mean with your notice?
Basarat Ali Syed
@basarat
This message was deleted
This message was deleted
Here is an example:
declare interface Foo {
  (): { new(): {bar:string} }
}
let foo: Foo;
let Bar = foo();
let bar = new Bar();
Julian
@pYr0x
thanks
ngpeijiun
@ngpeijiun
sudo alm
DASHBOARD: http://localhost:4444
/usr/local/lib/node_modules/alm/src/server/disk/session.js:137
var found = commonTsconfigLocations.find(function (cl) { return fsu.ex
^
TypeError: undefined is not a function
at Object.readDiskSessionsFile (/usr/local/lib/node_modules/alm/src/server/disk/session.js:137:45)
at Object.start (/usr/local/lib/node_modules/alm/src/server/disk/activeProjectConfig.js:59:23)
at Object.started (/usr/local/lib/node_modules/alm/src/server/serverStarted.js:9:25)
at Server.<anonymous> (/usr/local/lib/node_modules/alm/src/server.js:75:23)
at Server.g (events.js:199:16)
at Server.emit (events.js:104:17)
at net.js:1171:12
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
Basarat Ali Syed
@basarat
undefined is not a function. @ngpeijiun you are running an old version of NodeJS. Please use v4 (and if contributing v5) and above :rose:
find is a new ES6 function :rose:
Thomas Sattlecker
@littleStudent
Hi guys, can anyone help me with this error
Cannot find module './docs/docs’
running on node v5.7.0
Basarat Ali Syed
@basarat
@littleStudent which version are you on?
Elijah Bate
@eByte23
@basarat same issue just pull down from npm alm@0.0.47
node 4.2.2
Cannot find module './docs/docs’
Basarat Ali Syed
@basarat
Looking into it :rose:
Got it. Its because we .npmignore anything that matches docs https://github.com/alm-tools/alm/blob/fe91a9c615dd820a82ab5cd6ba81d79a949d2ef0/.npmignore#L4
Elijah Bate
@eByte23
ahh!
Basarat Ali Syed
@basarat
Fixing :rose:
Elijah Bate
@eByte23
Cheers!
Basarat Ali Syed
@basarat
@eByte23 / @littleStudent Fixed with alm@0.0.48 Thanks for your patience :rose:
Elijah Bate
@eByte23
No dramas, wasn't sure if it was an issue or not :smile:
Working lovely!
Alexis Villegas Torres
@Alexisvt
Hi @basarat i have a question! Is the IDE automatically compile the ts file to JS? I couldn't see any option to enable/disable that. I'm asking also because I'm doing a NativeScript app and the CLI of the tool already do that and I want to disable the option on ALM if I can
Alexis Villegas Torres
@Alexisvt
I found the option myself :-P it was at "compileOnSave" here at this page https://basarat.gitbooks.io/alm/content/config/tsconfig.html ;-)
Basarat Ali Syed
@basarat
Yup :rose:
Alexis Villegas Torres
@Alexisvt
Hi basarat! I have a silly question. Do ALM tools understand typings file (d.ts) ? I try to search about it in the online book but I didn't find it! 😟
Basarat Ali Syed
@basarat
Yes.
Definitely
@Alexisvt it would be useless if it didnt :) :rose:
Alexis Villegas Torres
@Alexisvt
He he he thanks God! 😄
Michael Billing
@mfbilling_twitter
@basarat I only see one thing missing in alm to compete with vscode... DEBUG (my best friend) What are your thoughts - you would probably be way faster than me building it, but I feel like doing it. :)