This commit is contained in:
João Moreno 2020-06-10 11:24:19 +02:00
parent 2929c77b3a
commit 1d582dccc9
No known key found for this signature in database
GPG key ID: 896B853774D1A575
2 changed files with 4 additions and 3 deletions

View file

@ -109,6 +109,7 @@ describe('validateVSCodeTypesCompatibility', () => {
validateVSCodeTypesCompatibility('1.30.0', '1.30.0');
validateVSCodeTypesCompatibility('1.30.0', '1.20.0');
validateVSCodeTypesCompatibility('1.46.0', '1.45.1');
assert.throws(() => validateVSCodeTypesCompatibility('1.30.0', '1.40.0'));
assert.throws(() => validateVSCodeTypesCompatibility('1.30.0', '^1.40.0'));

View file

@ -91,13 +91,13 @@ export function validateVSCodeTypesCompatibility(engineVersion: string, typeVers
const error = new Error(`@types/vscode ${typeVersion} greater than engines.vscode ${engineVersion}. Consider upgrade engines.vscode or use an older @types/vscode version`);
if (typeof typeMajor === 'number' && typeof engineMajor === 'number' && typeMajor > engineMajor) {
if (typeMajor > engineMajor) {
throw error;
}
if (typeof typeMinor === 'number' && typeof engineMinor === 'number' && typeMinor > engineMinor) {
if (typeMajor === engineMajor && typeMinor > engineMinor) {
throw error;
}
if (typeof typePatch === 'number' && typeof enginePatch === 'number' && typePatch > enginePatch) {
if (typeMajor === engineMajor && typeMinor === engineMinor && typePatch > enginePatch) {
throw error;
}
}