Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/dull-balloons-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@definitelytyped/header-parser": patch
"@definitelytyped/dtslint": patch
---

Warn on unsupported versions but validate, skip tests
11 changes: 9 additions & 2 deletions packages/dtslint/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,15 @@ async function runTests(
// associated ts3.2, ts3.5, ts3.6 directories, for
// <=3.2, <=3.5, <=3.6 respectively; the root level is for 3.7 and above.
// so this code needs to generate ranges [lowest-3.2, 3.3-3.5, 3.6-3.6, 3.7-latest]
const lows = [TypeScriptVersion.lowest, ...typesVersions.map(next)];
const his = [...typesVersions, TypeScriptVersion.latest];
const supportedTypesVersions = typesVersions.filter(TypeScriptVersion.isSupported);
if (supportedTypesVersions.length !== typesVersions.length) {
const unsupportedTypesVersions = typesVersions.filter((v) => !TypeScriptVersion.isSupported(v));
warnings.push(
`Package ${packageName} has unsupported TypeScript versions that will not be tested: ${unsupportedTypesVersions.join(", ")}`,
);
}
const lows = [TypeScriptVersion.lowest, ...supportedTypesVersions.map(next)];
const his = [...supportedTypesVersions, TypeScriptVersion.latest];
assert.strictEqual(lows.length, his.length);
for (let i = 0; i < lows.length; i++) {
const low = maxVersion(minVersion, lows[i]);
Expand Down
8 changes: 4 additions & 4 deletions packages/header-parser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export function validatePackageJson(
}
}

export function getTypesVersions(dirPath: string): readonly TypeScriptVersion[] {
export function getTypesVersions(dirPath: string): readonly AllTypeScriptVersion[] {
return mapDefined(fs.readdirSync(dirPath), (name) => {
if (name === "tsconfig.json") {
return undefined;
Expand All @@ -340,9 +340,9 @@ export function getTypesVersions(dirPath: string): readonly TypeScriptVersion[]
if (!TypeScriptVersion.isTypeScriptVersion(version)) {
throw new Error(`There is an entry named ${name}, but ${version} is not a valid TypeScript version.`);
}
if (!TypeScriptVersion.isSupported(version)) {
throw new Error(`At ${dirPath}/${name}: TypeScript version ${version} is not supported on Definitely Typed.`);
}
// if (!TypeScriptVersion.isSupported(version)) {
// throw new Error(`At ${dirPath}/${name}: TypeScript version ${version} is not supported on Definitely Typed.`);
// }
return version;
});
}
Expand Down
Loading