fix(deps): pin @types/vscode to patch version - #41
Open
luo2430 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
参考
https://github.com/material-extensions/vscode-material-icon-theme/blob/main/package.json (~)
https://github.com/vuejs/language-tools/blob/master/extensions/vscode/package.json (写死版本)
为什么把
^改成~?^1.99.01.100.0、1.101.0、… 甚至1.200.0~1.99.01.99.1、1.99.2等 patch 更新核心原因:VS Code 的 API 类型在 minor 版本里可能包含破坏性变更
@types/vscode跟随 VS Code 本身的版本发布。VS Code 的 minor 版本更新(比如1.100.0)经常会:这些类型层面的改动对你的扩展代码来说可能就是编译错误,即使 VS Code 运行时本身向下兼容。
举个例子
假设你开发的扩展声明支持 VS Code
^1.99.0:1.99.x✅ 没问题npm install时可能拉下来1.105.01.105.0里某个 API 的类型变了,你的代码可能编译不过1.99.x上行为不一致~1.99.0的好处1.99.x范围内,类型定义稳定@types/vscode是显式决策,而不是每次npm install的意外engines.vscode对齐:通常package.json里会有"vscode": "^1.99.0"声明运行时兼容范围,而@types/vscode用~确保开发时类型精确匹配