Overview
Type System
Major improvements to TypeScript typings throughout the library
Immutability
Library now follows immutable principles for better predictability
Independence
Components no longer depend on the main VK instance
Simplification
Removed redundant components in favor of simple functions
Breaking Changes
Import Changes
VK Class Changes
Removed getters and setters
Removed getters and setters
The following getters and setters have been removed:
vk.token(getter/setter) - removedvk.captchaHandler(setter) - usevk.callbackService.onCaptcha()method insteadvk.twoFactorHandler(setter) - usevk.callbackService.onTwoFactor()method instead
Removed methods
Removed methods
vk.setOptions()- removed- Configuration must be set during instantiation
Removed modules
Removed modules
Several built-in modules have been extracted into separate packages:
| Old | New Package |
|---|---|
vk.auth | @vk-io/authorization |
vk.streaming | @vk-io/streaming |
API Changes
Configuration options renamed
Configuration options renamed
Removed automatic behaviors
Removed automatic behaviors
- Automatic account verification removed - use
@vk-io/authorizationpackage withAccountVerificationclass - Automatic
random_idin messages.send() removed - usegetRandomId()function:
API schema changes
API schema changes
vk.api.API_VERSIONgetter removedAPIErrorCodeenum now auto-generated from VK API schema- Schema objects now exported in their own namespaces:
Params,Objects, andResponses
Snippets & Utilities
resolveResource()
resolveResource()
vk.snippets.resolveResource() has been removed. Use the standalone resolveResource() function:Collect methods
Collect methods
The Executes - Use the Collect Iterator - Use
vk.collect module has been split into smaller classes and functions:Chain - Use the Chain class:executes() function:createCollectIterator() function:Context Changes
MessageContext changes
MessageContext changes
Return values:Removed methods:
context.send()now returns aMessageContextinstancecontext.replyMessagenow returnsMessageContextinstead ofMessageReplycontext.forwardsnow returns an array ofMessageContextinstead ofMessageForward
sendPhotos(), sendDocuments(), sendAudioMessage() now accept objects:context.getInviteLink()context.markAsImportant()context.renameChat()context.newChatPhoto()context.deleteChatPhoto()context.inviteUser()context.kickUser()context.pinMessage()context.unpinMessage()context.editMessageText()context.sendSticker()- usecontext.send({ sticker_id: 123 })instead
Context renamings
Context renamings
Several context classes and properties have been renamed for consistency:
| Old Name | New Name |
|---|---|
CommentActionContext | CommentContext |
UserOnlineContext | FriendActivityContext |
ReadMessagesContext | MessagesReadContext |
MessageAllowContext | MessageSubscriptionContext |
RemovedMessagesContext | DialogMessagesContext |
Null to undefined
Null to undefined
All contexts now use
undefined instead of null for better destructuring support:Updates Changes
Removed hear() method
Removed hear() method
The
updates.hear() method and updates.setHearFallbackHandler() have been removed.Use the @vk-io/hear package instead:Event names updated
Event names updated
Now using official VK event names:
Webhook changes
Webhook changes
The second argument for
updates.startWebhook() has been removed. Use the next property instead:Configuration changes
Configuration changes
- Polling version updated to 10
- Option renamed:
pollingAttempts→pollingRetryLimit
Upload Changes
Source format changes
Source format changes
The Multiple files:
source parameter format has changed. It now accepts two interfaces:Single file:When using streams without size information, you must specify
contentLength, especially for upload.video().Method changes
Method changes
upload.storiesPhoto()andupload.storiesVideo()now returnStoryAttachmentupload.graffiti()removed - useupload.documentGraffiti()orupload.messageGraffiti()instead
Keyboard Changes
Attachment Changes
Constructor changes
Constructor changes
Attachment constructors now require options objects:
DocumentAttachment
DocumentAttachment
document.typeNamegetter removed
Export Changes
Many lowercase exports have been replaced with PascalCase enums:attachmentTypes→AttachmentTypedefaultExtensions→DefaultExtensiondefaultContentTypes→DefaultContentTypecaptchaTypes→CaptchaTypemessageSources→MessageSourceresourceTypes→ResourceTypeupdatesSources→UpdateSourceapiErrors→APIErrorCodeuploadErrors→UploadErrorCodeupdatesErrors→UpdatesErrorCodesnippetsErrors→ResourceErrorCodesharedErrors→SharedErrorCode
Migration Checklist
Need Help?
If you encounter issues during migration:GitHub Issues
Report bugs or ask questions
Community Modules
Explore ecosystem packages