Typescript strict mode supported?
jvanbruegge opened this issue · 16 comments
I haven't tried it, but I don't think this works with typescript's --strict
flag, because of missing JSX namespace declarations
I dont really know typescript. I found the '--jsxFactory' to add the createElement
pragma.
Snabbdom-pragma, is transpiler independant, and transform createElement
call to Snabbdom vnode.
Yes, typescript expects a global JSX
namespace declaration.
More info here: cyclejs-community/create-cycle-app-flavors#21
Snabbdom provides a declaration for VNode, but it seems we need something like this: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/df09b2a3368b7f47959f86247a12ab95b9d261f4/types/react/index.d.ts#L2721
But instead of React.ReactElement
with VNode
import { VNode } from 'snabbdom';
yes
Live on : feature/definitely-typed
This is a pretty naive implementation but seem to fill all the needs.
Give it a try, and feel free to contribute.
@jvanbruegge Did you take an eye on it ? This is what you need ?
I think it is, but can you publish it as alpha release, then I can test properly
Couldn't you npm install it from branch ?
Swizz/Snabbdom-pragam#feature/definitely-typed
Yeah, that worked.
You don't get errors with this, sadly you have to put a /// <reference>
in your code to make it work, but only in the index file, so that's not too bad
I will dive into Typescript someday soon, I promise.
As this change is not really a breaking one, I can release it at your go.
yeah, go for it
we can improve the typings in the future