Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Importing types from pubnub #405

Closed
Tallyb opened this issue Oct 2, 2024 · 6 comments · Fixed by #417
Closed

Importing types from pubnub #405

Tallyb opened this issue Oct 2, 2024 · 6 comments · Fixed by #417
Assignees
Labels
priority: medium This PR should be reviewed after all high priority PRs. status: in progress This issue is being worked on. type: chore This PR contains changes that are not covered by other types (stylistic, dependency updates, etc).

Comments

@Tallyb
Copy link

Tallyb commented Oct 2, 2024

starting 8.2.8 a major change was made (should not hide behind a patch version) that types are now used from internal library instead of using definitely typed.

Can you please document on the proper way to import from the library? Also - are all the types that existed in DT still supported?
It seems like some types are not exported.

@parfeon
Copy link
Contributor

parfeon commented Oct 3, 2024

@Tallyb thank you for reaching out to us.

Interfaces built for quite a long time and served with the package itself, but for some reason package.json wasn't updated properly.
When we worked on our 8.x major version, we tried to keep it as backward-compatible as possible (including existing API and types), but some types had to be removed (mostly categories). We didn't put much time in updating DefinitelyTyped after the 8 version release because already had issues with the time it takes to finally accept and merge changes. Now, with package.json pointing to the proper types, they always will be in sync with actual code.

Do you experience issues with types which you used before, and they become unavailable / changed with this major version? We will double-check from our side whether it was intentional or something managed to slip from our attention.

8.2.8 mostly has been targeting fixes to the subscription shared worker.

Best regards.

@parfeon
Copy link
Contributor

parfeon commented Oct 3, 2024

There really were major changes, but all of them happened with the 8.0.0 release.

@Tallyb
Copy link
Author

Tallyb commented Oct 3, 2024

well, in 8.0.0 types entry in package.json was not set, hence you could continue and use DT. The change made in 8.2.8 basically overrides the DT types. Hence the change became effective only on the current release.
This is the previous code:

import PubNub, { MessageEvent, PresenceEvent, PubnubConfig, SetStateParameters, StatusEvent } from 'pubnub';

types are used in rxjs subscription and other. Can you suggest what is the correct way to do this post 8.x and which types are no longer supported, if any?

@parfeon
Copy link
Contributor

parfeon commented Oct 3, 2024

Looks like we will need to add post-processing for generated types files to merge them into one to mimic type as it was with @types/pubnub.
From the listed types, at least two have been renamed (originally that types package was created by the community, and they decided on some names):

  • PubnubConfigPubNubConfiguration
  • SetStateParametersSetPresenceStateParameters

On next week, we will try (depends on from backlog) to provide a release with types which has all public types under PubNub namespace to make it possible to import them that way (need to write post-processing script to rearrange generated types).
Currently, IDE understands interface without those types to be imported. Another situation if you will need to pre-configure some objects and pass them around - this could be tricky for the IDE to track down where object has been declared to see whether it types matches to the type of the argument.

@ghaiat
Copy link

ghaiat commented Oct 16, 2024

Hello, any updates? this is quite blocking for us .... Thanks

@parfeon parfeon self-assigned this Oct 29, 2024
@parfeon parfeon added status: in progress This issue is being worked on. priority: medium This PR should be reviewed after all high priority PRs. type: chore This PR contains changes that are not covered by other types (stylistic, dependency updates, etc). labels Oct 29, 2024
parfeon added a commit that referenced this issue Oct 30, 2024
Fix definition of type which represent message actions received from history and list of users which added action of specific type and value to the message.

Closes #407

refactor(types): remove indexed signature for publish

Remove redundant indexed signature from publish message parameters type definition.

Closes #413

refactor(types): add serializable objects to `Payload` type

Extend `Payload` type definition with objects which can be serialized by `JSON.stringify` using `toJSON()` methods.

Closes #412

refactor(types): aggregate generated types definitions

Aggregate multiple types definitions into single type definition type with proper type names and namespaces.

Closes #405 #409 #410

refactor(types): add missing Subscribe Event Engine types

Add Subscribe Event Engine and Event Listener types to the bundled types definition file.

Closes #377
@parfeon
Copy link
Contributor

parfeon commented Oct 31, 2024

@Tallyb this issue is addressed in v8.2.10

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
priority: medium This PR should be reviewed after all high priority PRs. status: in progress This issue is being worked on. type: chore This PR contains changes that are not covered by other types (stylistic, dependency updates, etc).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants