-
Notifications
You must be signed in to change notification settings - Fork 2
🏷 add new types using TS 4.1 features #5
base: master
Are you sure you want to change the base?
Conversation
package.json
Outdated
| { | ||
| "name": "types-roll20", | ||
| "version": "1.1.2", | ||
| "version": "2.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not using the package.json version, but the base number from version.json file + an auto-incremented patch number based on the number of git commit since the last version bump. See Nerdbank.GitVersioning for more info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please increment the version.json one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this technically has breaking changes so a major change increment would make more sense would it not? Some times I might import previously won't exist anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a breaking change, indeed, but the version is in version.json not package.json please bump it to 3.0 there (or both).
| "dependencies": {} | ||
| "devDependencies": { | ||
| "@types/underscore": "^1.10.24", | ||
| "typescript": "^4.1.0-beta" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should most likely wait for a release version before merging the PR, don't you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth waiting, alternatively, if you can work out how to do it, provide like a beta version that people can opt into for version 4.1 types before 4.1 is out
|
Thanks for your PR, you seem to have rewritten the whole thing, what a job! I'm taking a look at the build, I don't know why it is failing, but once it works, you should see your pre-release version on npm. |
|
Most of the types are different, I generated the objects again by scraping the docs so it wasn't too bad. I reused several of the types that were included in the original (primarily the dice roll ones). For the most part the types are generated using Generics and features that are 4.1+ exclusives and so will pretty much not work at all if you don't use typescript 4.1. I'll need to make a few changes before it's ready to merge, possibly a peerDependency on TS 4.1 and moving the underscore types to a dependency namely |
|
I'd suggest that we merge the PR only after TS 4.1 is released. |
|
@laquasicinque I looked at the build, and despite the poor error message reported by
|
|
Sorry it took a while, I think I've made all changes. As for the other stuff I'm not sure, I don't mind either way, I originally wrote these types for myself to use and still can but I saw you had made a library for it so thought it would be merging with that. I haven't actually tried doing a full script with them yet so it might be nice to wait a moment whilst I test it out |
|
I should probably mention, I'm not sure if this is necessarily the right way to declare global type packages. |
Might be wise indeed. Just update the PR whenever you think it is ready to be merged; after you tested it and TS 4.1 is released. Until then, if someone wants to try it out, one can always download your version of the file. Furthermore, November is only a few weeks away. |
|
This seems to have died off. Is there any intention to merge this or keep it up to date with roll20 changes? |
|
I've completely forgotten about this and have since moved to Foundry so will unlikely be updating this personally |
|
@MrReasonable, like @laquasicinque, I moved to Foundry VTT (many years ago). I'll archive the repository to make this clear to everyone. And sorry for the delay, I just saw the notification. |
TS 4.1 (still in beta till November) adds string literal types which allow for some crazy Type definitions. If you want to try it out i recommend pulling the branch and
npm installing as syntax highlighting is a bit busted for this as it's not technically out yet. You can also check using this playground.Features Include (Hopefully):
change:graphicas well aschange:graphic:heightetc. passing the Graphic roll20 objecttypecreateObjandfindObjstries to infer the type of the output based on the value oftypeI'm not sure how accurate all the base object definitions are but it seemed accurate when I ran some existing Roll20 code through it.