JavaScript SDK 8.0.0 migration guide

The 8.0.0 release of the JavaScript SDK removes the need for the @types/pubnub package. The SDK now ships its own types.

We kept the API surface close to 7.x.x. To upgrade to the JavaScript SDK v8.0.0, make a few focused updates in your code.

This guide summarizes the differences and the steps to migrate to JavaScript SDK v8.0.0.

Differences between 7.x.x and 8.0.0

See the major differences:

Feature/Method/Field/PackageJavaScript SDK 7.x.xJavaScript SDK 8.x.x
@types/pubnub package dependency
Yes
No, remove the dependency
API group names in imports
N/A
Yes

@types/pubnub dependency

The @types/pubnub dependency is no longer required in v8.0.0. Remove it from your project. The SDK package now provides types without external dependencies.

Affected types

This change only affects code that uses the types directly (for example, in function arguments or variables).

Endpoint-related types moved to their endpoint namespaces. Types are grouped by the API they belong to. You can see API groups in the documentation sidebar. Your IDE should also hint type locations.

JavaScript SDK 7.x.x


import PubNub, { GetMembershipsParameters } from 'pubnub'

// other code

const params: GetMembershipsParameters = {};

JavaScript SDK 8.x.x

import PubNub, { AppContext } from 'pubnub'

// other code

const params: AppContext.GetMembershipsParameters = {};

Available API endpoint groups:

  • Subscription
  • AppContext
  • ChannelGroup
  • Publish
  • Signal
  • Presence
  • History
  • MessageAction
  • FileSharing
  • PAM
  • Time
  • Push

To migrate from v7.x.x to v8.0.0:

  1. Remove the @pubnub/types dependency.
  2. Update import statements for PubNub types to use the endpoint groups the types belong to.

Migration steps

To migrate from JavaScript SDK 7.x.x to 8.0.0, upgrade the SDK in your project, review the differences above, and update your code.

Last updated on