-
Notifications
You must be signed in to change notification settings - Fork 17
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
Generate both TS & HM type signatures #17
Comments
I wanted to learn how to write a parser in Haskell so I've written this over the last two weeks. I'm still working on it, but it already covers probably 95% of type signatures, and the CLI returns an appropriate exit code so it should be possible to use it conditionally, not outputting an alternative style type signature where the TypeScript declaration syntax is currently unsupported. tshm, example usage:
I'm going to see if I can integrate it into fp-ts-std shortly. Edit: It's now implemented in the develop branch. At the moment I'm just - in a very hacky way - parsing the markdown produced by docs-ts and appending the tshm signatures wherever it recognises any. Edit 2: Now used across fp-ts-std documentation. |
I totally agree that the HS style type signatures are nicer to read. But I think that this is highly subjective. Think of "mapped types" One of the biggest annoyance for me was that parameter's have to be named in signatures. However, they have a semantic meaning, as they can be referenced inside the type signature. E.G. this is a valid type: Regarding your example, in PureScript I think it's ok in this case to combine In my view, this raises many many questions. But as I said, I can totally understand the intend. Once I thought that |
via fp-ts#1218
Where TS is:
HM would be:
I think it'd be great if this generated type signatures in both styles with a client-side toggle to globally switch between them, defaulting to TS.
The text was updated successfully, but these errors were encountered: