feat: Export TypeScript types#287
Conversation
|
@hedgepigdaniel Sorry for the delay here. I pushed a commit improving the type defs a bit. Let me know what you think. |
|
Also updated the tooling, added Prettier, and added basic linting and testing around the types. |
|
btw let me know if you want me to cut a release with just this, or if you want us to also resolve #293 before cutting |
|
Thanks! For my use case I probably wouldn't use the release until both issues were resolved, but it wouldn't hurt to cut one. Re your changes, I noticed these things when updating:
So basically yes, this works well. |
|
for the for updateScroll and friends – the idea is that in my current use cases, the context only describes the current location (indeed, in the examples here, it's just the location). i suppose if your context already includes information on the previous location, then you can just always pass in |
This is so that users of this package can have information about the types exported.
The code in this package is not typechecked (the types are separate from the source code), but this could be done as a non breaking change later.
Notable choices:
Locationtype{ hash?: string; action?: 'PUSH' | string }. This is the same as extending any object except that if there is ahashoractionkey they must be strings, and the 'PUSH' is jsut a hint to the user as to which string will have an effect.