Add TypeScript definitions for v6 packages #430
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR should provide comprehensive TypeScript definitions for the various packages included in v6.x (as requested in #428). It places an emphasis on minimizing the number of type definitions required to reduce package installation type as much as possible for customers (both those who use TypeScript and those who do not).
I have included a rudimentary type test suite which draws examples from the
USE_CASES.md
file to ensure that all known use cases work correctly with the library.I also spent a lot of time confirming that the type definitions match the official API in terms of type constraints and required values. As such, there should be no issues with missing types or incorrect values.
Please have a look and confirm that you're satisfied with the structure and layout of the types, the current layout should help ensure that they are more easily maintainable by those unfamiliar with TypeScript or the project itself.
Please also take note that these types are only tested and confirmed to work with the latest version of TypeScript (
v2.4.2
at the time of writing) and are not expected to function with out of date versions. As the TypeScript community tends to remain up to date for the most part, I don't foresee this being an issue, but let me know if it is.