Closed Tallyb closed 2 weeks ago
@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.
There really were major changes, but all of them happened with the 8.0.0 release.
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?
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):
PubnubConfig
→ PubNubConfiguration
SetStateParameters
→ SetPresenceStateParameters
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.
Hello, any updates? this is quite blocking for us .... Thanks
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.