Skip to content

Commit 12586ed

Browse files
Merge pull request #668 from microsoft/TylerLeonhardt/only-enforce-major-minor
fix: only enforce major and minor version of types check
2 parents f710e83 + 63c89ae commit 12586ed

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/test/validation.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ describe('validateVSCodeTypesCompatibility', () => {
115115
validateVSCodeTypesCompatibility('1.30.0', '1.30.0');
116116
validateVSCodeTypesCompatibility('1.30.0', '1.20.0');
117117
validateVSCodeTypesCompatibility('1.46.0', '1.45.1');
118+
validateVSCodeTypesCompatibility('1.45.0', '1.45.1');
118119

119120
assert.throws(() => validateVSCodeTypesCompatibility('1.30.0', '1.40.0'));
120121
assert.throws(() => validateVSCodeTypesCompatibility('1.30.0', '^1.40.0'));

src/validation.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ export function validateEngineCompatibility(version: string): void {
4949

5050
/**
5151
* User shouldn't use a newer version of @types/vscode than the one specified in engines.vscode
52+
*
53+
* NOTE: This is enforced at the major and minor level. Since we don't have control over the patch
54+
* version (it's auto-incremented by DefinitelyTyped), we don't look at the patch version at all.
5255
*/
5356
export function validateVSCodeTypesCompatibility(engineVersion: string, typeVersion: string): void {
5457
if (engineVersion === '*') {
@@ -78,14 +81,14 @@ export function validateVSCodeTypesCompatibility(engineVersion: string, typeVers
7881
// For all `x`, use smallest version for comparison
7982
plainEngineVersion = plainEngineVersion.replace(/x/g, '0');
8083

81-
const [typeMajor, typeMinor, typePatch] = plainTypeVersion.split('.').map(x => {
84+
const [typeMajor, typeMinor] = plainTypeVersion.split('.').map(x => {
8285
try {
8386
return parseInt(x);
8487
} catch (err) {
8588
return 0;
8689
}
8790
});
88-
const [engineMajor, engineMinor, enginePatch] = plainEngineVersion.split('.').map(x => {
91+
const [engineMajor, engineMinor] = plainEngineVersion.split('.').map(x => {
8992
try {
9093
return parseInt(x);
9194
} catch (err) {
@@ -103,7 +106,4 @@ export function validateVSCodeTypesCompatibility(engineVersion: string, typeVers
103106
if (typeMajor === engineMajor && typeMinor > engineMinor) {
104107
throw error;
105108
}
106-
if (typeMajor === engineMajor && typeMinor === engineMinor && typePatch > enginePatch) {
107-
throw error;
108-
}
109109
}

0 commit comments

Comments
 (0)