-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add types declaration file #21
base: master
Are you sure you want to change the base?
Conversation
Yes please! I need this for it to work in Typescript. Are there any holdups to prevent this pull request? |
Yes, sorry for the delay -- the types are probably good enough for the public API, but the details are wrong. For more accurate types, I would like segments and combined be separate opaque types. |
The https://spin.atomicobject.com/2018/01/15/typescript-flexible-nominal-typing/ Something like:
|
I'm honestly struggling to get this project working with Typescript at all. Are there any other options I can use in the meantime? |
Unfortunately what @voidqk has suggested is outside of my knowledge at the moment. What I've submitted works according to my own tests but may not work (or only work partially) elsewhere. So I can't be of much more help than this. 🤷♂️ |
Thanks geopic. So it does work for you?
This is my source code. I just can't seem to call the union function no matter what I try:
|
Ok, on second thought, I'll look at it again. I think I know what's up. My IDE sometimes complains about these things then sometimes doesn't (when it should). I'll give it another look and will submit a squashed commit on Monday unless I cannot make it work, in which case I'll let you guys know. Thanks for the heads up @dirkesquire. |
d5c72f0
to
24ebe41
Compare
Ok, I've rebased onto the previous commit so it should still be one commit being added. There were some issues with the file I wrote back in March which I've fixed and now it works 100% with the TypeScript compiler. The types themselves are my best guess but at least the types file is structured properly now. I believe you shouldn't have any more issues @dirkesquire but let me know if you do. 👍 |
Thanks, this works for me! |
Guys, let's merge this PR. I need it in production 🙂. |
Merge it y'all! |
Paging @velipso |
The types aren't correct... I haven't looked at this code in a while, but I realize that you don't need these types to be accurate for regular usage, but I'm not going to merge it if the types are wrong. I also don't understand the urgency of merging the types... you can drop your own types into TypeScript using Also, feel free to fork and land the types if you really want to. I don't look at this repo often. |
Resolves #20. Let me know if there are any issues.