如何处理由于较新的 TypeScript 版本而导致的库重大更改
How to handle library breaking changes due to newer TypeScript version
作为图书馆所有者,您渴望以最少的破坏性更改为消费者提供尽可能好的功能。现在据我了解你的库,如果用 TypeScript 编写,则取决于 TS 的特定版本。假设我们在 v2.8.x 上,突然我们想升级到 TS v3.x.x 因为一个很棒的新功能。
会发生什么情况是,我的库的下一个版本(包括 TS 依赖性颠簸)必须作为重大更改发布,遵循 SemVer 对吗?
与此同时,JavaScript 消费者也可以使用该库,他们认为没有理由出现重大变化,因为对他们而言,不使用类型定义实际上没有任何改变。所以我对这里的最佳实践感到有点进退两难。
Say we're on v2.8.x suddenly we'd like to upgrade to TS v3.x.x because of a great new feature. What happens is that my libraries next release, including the TS dependency bump, would have to be released as a breaking change, following SemVer right
如果您的库 类型定义(生成的 .d.ts
文件)曾 用于 TS2.8 而不再与 TS2.8 一起工作,那么你应该将它作为主要版本发布。
请注意,这很可能不会仅仅因为您正在更改 ts 版本而发生。您必须在您的类型中积极使用一些新的 signature TS 功能才能导致此问题。
At the same time the library may be used by JavaScript consumers as well, and they would see no reason for a major bump, because for them, not using type definitions, nothing actually changed
并非每项重大更改都会影响 所有 人。 JS 用户可以阅读更改日志并忽略。
作为图书馆所有者,您渴望以最少的破坏性更改为消费者提供尽可能好的功能。现在据我了解你的库,如果用 TypeScript 编写,则取决于 TS 的特定版本。假设我们在 v2.8.x 上,突然我们想升级到 TS v3.x.x 因为一个很棒的新功能。 会发生什么情况是,我的库的下一个版本(包括 TS 依赖性颠簸)必须作为重大更改发布,遵循 SemVer 对吗?
与此同时,JavaScript 消费者也可以使用该库,他们认为没有理由出现重大变化,因为对他们而言,不使用类型定义实际上没有任何改变。所以我对这里的最佳实践感到有点进退两难。
Say we're on v2.8.x suddenly we'd like to upgrade to TS v3.x.x because of a great new feature. What happens is that my libraries next release, including the TS dependency bump, would have to be released as a breaking change, following SemVer right
如果您的库 类型定义(生成的 .d.ts
文件)曾 用于 TS2.8 而不再与 TS2.8 一起工作,那么你应该将它作为主要版本发布。
请注意,这很可能不会仅仅因为您正在更改 ts 版本而发生。您必须在您的类型中积极使用一些新的 signature TS 功能才能导致此问题。
At the same time the library may be used by JavaScript consumers as well, and they would see no reason for a major bump, because for them, not using type definitions, nothing actually changed
并非每项重大更改都会影响 所有 人。 JS 用户可以阅读更改日志并忽略。