-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving to TypeScript in 3.0 #115
Comments
Probably a tough decision, but definitely a correct one. Doesn't Typescript support Sum types natively? In Flow you just need to add a "type" property to your object and define literal value for each subtype. +1 for the comments on the build process. |
Hi! |
@boris-marinov I think support for tagged unions was added in 2.1 or something. But that's just on the types side, so it doesn't help much with the runtime part of the things. Depending on how the pattern matching proposal goes on TC39 we might get some interesting stuff though. But that's on the "far future" side of things, sadly. @raveclassic work on the TS support will start after the final 2.0 version is released, which will hopefully be this weekend. |
This might be helpful: https://pattern-matching-with-typescript.alabor.me/ |
While I was playing with the typings in #157 , the let stringTask = Task.of("Hello");
let numTask = Task.of(5);
waitAll([stringTask, numberTask]); let stringTask = Task.of("Hello");
let numTask = Task.of(5);
// Error here, because array is expected to have tasks return same type
//waitAll([stringTask, numberTask]);
// wrap waitAll function from folktale
let runAll2: <E, V1, V2>(tasks: [Task<E, V1>, Task<E, V2>]) => Task<E, [V1, V2]> =
t => waitAll(t);
runAll2([stringTask, numberTask]);
// The error type is still the same,
// but now we can have different values in the tuple (aka array) $.02 - just something I came across. Relevant line in current WIP typings. |
@snewell92 I forgot to consider that, thanks for reminding me :) We'll need some overloads for them indeed. |
When working on this issue, which branch should one fork off of? |
@davidlibland ah, this one's not ready for collaborators yet |
@robotlolita when this is ready for collaborators I would like to help. |
need any help here? 👀 |
Checklist
Motivation
I did say that I'd take a look at TypeScript again a long while ago and I finally did, today. With some of the recent additions to TypeScript, writing things like Folktale in it is not too bad. The compiler services and the new metadata API, though? Those are very compelling (even though they're both experimental). An initial 2.0 release is only really missing the Data.Future docs (which, if work allows, should happen sometime between this week and the next), so on to thinking about the future.
Moving to TypeScript would allow some very interesting features:
OTOH, this would also mean that:
::
hasn't gained much traction in TC39, and the last person who said they'd champion the proposal hasn't said anything for quite a while;any
types;x // ==> y
assertions.There's also some other stuff to fix:
Docs will probably move back to Sphinx for the time being. But that means having to write plugins to test code automatically, and the Sphinx extension API is painful.
This work would subsume #65, of course.
The text was updated successfully, but these errors were encountered: