-
Notifications
You must be signed in to change notification settings - Fork 0
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
Change TS types to use type declarations from PN JS SDK #155
Conversation
src/jsMain/resources/index.d.ts
Outdated
userMetadata?: { | ||
[key: string]: any; | ||
}; | ||
}; | ||
type MessageDTOParams = PubNub.FetchMessagesResponse["channels"]["channel"][0] | EnhancedMessageEvent; | ||
type MessageDTOParams = History.FetchMessagesResponse["channels"]["channel"][0] | EnhancedMessageEvent; |
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.
type MessageDTOParams = History.FetchMessagesResponse["channels"]["channel"][0] | EnhancedMessageEvent; | |
type MessageDTOParams = History.FetchMessagesForChannelsResponse['channels'][string][number] | History.FetchMessagesWithActionsResponse['channels'][string][number] | EnhancedMessageEvent; |
I don't know where it used, just assuming what it expected to reflect.
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.
just checking that I should change [0] to [number] ? (I don't know TS types that well so wanted to make sure it's not a mistake)
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.
Because there is actually no array, we are speaking about type declaration. With this annotation, we are telling TS that we need the type of the single entry for the array of messages for channel name stored as a string.
Sadly, we have to use explicit types which have been unified under FetchMessagesResponse
because TS will end up with specifying any
because it can't figure out :/
…mmunity driven @types/pubnub
ff8159e
to
8f0aed8
Compare
pin(): Promise<void>; | ||
/** @deprecated */ | ||
DEPRECATED_report(reason: string): Promise<PubNub.SignalResponse>; |
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.
Does it mean that we are changing type in Deprecated method? If so it means that client should modify the code after upgrade? If so wouldn't be better to just remove this deprecated code?
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.
only the type name changes, the content is the same
we could remove this method in the future I guess, we can do a sweep before 1.0.0 and remove any deprecated patterns
@pubnub-release-bot release js as 0.11.0 |
🚀 Release successfully completed 🚀 |
refactor: The JS Chat SDK now uses TS types from recent versions of PubNub JS SDK instead of the ones in the
@types/pubnub
community resource. Changes to customer code might be required to accommodate this change.