These are chat archives for mithriljs/mithril.js

20th
Jul 2019
spacejack
@spacejack
Jul 20 00:23 UTC
@gilbert just updated in case you're interested: https://github.com/spacejack/mithril-stream-extra
spacejack
@spacejack
Jul 20 00:45 UTC
Well this might work ... if a bit hacky
spacejack
@spacejack
Jul 20 01:08 UTC
Something else I hadn't noticed and the docs might need updating.
Stream#map takes a 2nd param, ignoreInitial
Which would be handy, and would make my own dropInitial unnecessary.
spacejack
@spacejack
Jul 20 01:15 UTC
However... it doesn't look fantasy land compliant?
spacejack
@spacejack
Jul 20 01:34 UTC
I guess maybe it is used internally but not intended/documented for public use
Patrik Johnson
@orbitbot
Jul 20 08:48 UTC
based on git blame the dropInitial functionality was added when @porsager refactored the implementation. While it's convenient, I'm not sure what should weigh more, keeping the existing functionality or being compliant - there's been some ideas thrown around about having separate helpers included in the stream package anyways IIRC
Zunix
@decimocracy
Jul 20 10:46 UTC
Can anyone help me in setting Typescript in build process?
Kind offtopic though.
Patrik Johnson
@orbitbot
Jul 20 10:52 UTC
sorry, don't personally have any experience. I'd assume that either you'd be able to use some kind of tutorial somewhere, or if you already have rollup/parcel/webpack/broccoli or whatnot set up there's probably a "<tool> + typescript" tutorial available
googling for "typescript setup" seems to start in a promising direction
Zunix
@decimocracy
Jul 20 10:55 UTC
Yeah, I was looking at this
But, I do not understand what exactly is happening here.
I do not want to spend another couple of hours understand a configuration.
Patrik Johnson
@orbitbot
Jul 20 11:05 UTC
so you're using webpack?
for what it's worth, actually getting a decent understanding of how to configure build tools and pipelines is something that can easily take days or weeks, depending on what you're doing with what tools
so an initial copy/paste is probably a good idea if you don't want to get bogged down
there's probably a webpack chat or stackoverflow to ask for specific configuration issues if you run into them
usually the tutorials might have repositories with a working build process, or you could try to find "typescript boilerplate" projects on github
Oscar
@osban
Jul 20 11:08 UTC
Patrik Johnson
@orbitbot
Jul 20 11:09 UTC
oh yeah, forgot all about that thing
:muscle: @osban
Oscar
@osban
Jul 20 11:10 UTC
:grinning:
Zunix
@decimocracy
Jul 20 11:33 UTC
thanks
Zunix
@decimocracy
Jul 20 14:54 UTC
can routing parameters be made typed?
spacejack
@spacejack
Jul 20 20:24 UTC
@decimocracy somewhat. Have you got an example route?
Ian Wilson
@ianjosephwilson
Jul 20 20:26 UTC
hi guys, I made this silly game to try to show a friend some Mithril basics (as my tiny brain understands them), check it out if you want, might have bugs -- Rat Catcher
spacejack
@spacejack
Jul 20 20:29 UTC
nice haha
It's a good tutorial
EricOP
@ericop
Jul 20 20:31 UTC
@ianjosephwilson nice dude!
spacejack
@spacejack
Jul 20 20:31 UTC
I like how it's got the IIFE and ES5 for people who might just know how to write scripts not use compilers.
You just forgot "use strict" :slight_smile:
Ian Wilson
@ianjosephwilson
Jul 20 20:33 UTC
haha yeah, I wasn't sure what I could get away with in flems.io but I wanted to keep it really simple
spacejack
@spacejack
Jul 20 20:33 UTC
You can use modern syntax and modules in flems
Ian Wilson
@ianjosephwilson
Jul 20 20:33 UTC
None of my friends have ever heard of mithril and I love it so far. So much more fun than what I have used before.
@spacejack I did not know that. Does it transpile it or my browser just has to support it ?
spacejack
@spacejack
Jul 20 20:35 UTC
It uses babel. And supports JSX too!
Ian Wilson
@ianjosephwilson
Jul 20 20:35 UTC
I really like hyperscript. It seems to flow way better than JSX.
spacejack
@spacejack
Jul 20 20:36 UTC
:thumbsup:
@decimocracy here's one example of a typed route:
m.route(document.body, '/', {
    '/item/:group/:id': {
        render: v => m(MyComponent, {
            id: v.attrs.id, group: v.attrs.group
        })
    } as m.RouteResolver<{group: string, id: string}>,
    // other routes...
})
spacejack
@spacejack
Jul 20 20:42 UTC
That would also then be checked against the Attrs type for MyComponent
Patrik Johnson
@orbitbot
Jul 20 20:55 UTC
@ianjosephwilson nice, wanna make a PR to https://github.com/orbitbot/awesome-mithril ? :slight_smile: