-
Notifications
You must be signed in to change notification settings - Fork 56
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
[SDK-3857] Add typings for the tree-shakable version of the library #1498
Merged
lawrence-forooghian
merged 5 commits into
integration/v2
from
1442-add-typings-for-tree-shakable-version
Nov 21, 2023
Merged
[SDK-3857] Add typings for the tree-shakable version of the library #1498
lawrence-forooghian
merged 5 commits into
integration/v2
from
1442-add-typings-for-tree-shakable-version
Nov 21, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
997a9b0
to
61645ad
Compare
61645ad
to
3463ae3
Compare
3463ae3
to
2ccb5eb
Compare
2ccb5eb
to
869be09
Compare
cf1d07a
to
b75eb5b
Compare
These declarations are unreachable via the typings. The user needs to access these methods via the MessageStatic and PresenceMessageStatic interfaces.
These declarations are unreachable via the typings.
This allows users to import the module-based version by writing ``` import { BaseRealtime } from 'ably/modules' ``` instead of having to import 'ably/build/modules'. I followed the guidance in [1] and [2]. [1] https://nodejs.org/api/packages.html#exports [2] https://webpack.js.org/guides/package-exports/
I wasn’t sure of the best way to approach the typings of the modules (`Rest` etc). They should be opaque to the user (they shouldn’t be interacting with them directly and we want be free to change their interface in the future). There is an open issue to add support for opaque types to TypeScript [1], and people have suggested various sorts of ways of approximating them, which revolve around the use of `unique symbol` declarations. However, I don’t fully understand these solutions and so thought it best not to include them in our public API. So, for now, let’s just use `unknown`, the same way as we do for `CipherParams.key`. Resolves #1442. [1] microsoft/TypeScript#202
869be09
to
b839715
Compare
owenpearson
approved these changes
Nov 20, 2023
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.
Looks great!
Base automatically changed from
1489-remove-remaining-REST-code-from-BaseRealtime
to
integration/v2
November 21, 2023 00:17
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Note: This PR is based on top of #1496; please review that one first.
This changes the way that the package does its exports, so that the user can import
ably/modules
, and then adds typings for the library that you get when you do this import. See commit messages for more details.Resolves #1442.