-
Notifications
You must be signed in to change notification settings - Fork 86
Conversation
1. Update @DefinitelyTyped dependencies 2. Simplify+invert runTests
src/index.ts
Outdated
const isLatest = hi === TypeScriptVersion.latest; | ||
let versionPath = isLatest ? dirPath : joinPaths(dirPath, `ts${hi}`); | ||
let versionIndexText = isLatest ? indexText : await readFile(joinPaths(versionPath, "index.d.ts"), "utf-8"); | ||
console.log('testing from', low, 'to', hi, 'in', versionPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how noisy this will be in normal use of dtslint, but it surely makes the standalone output more readable.
Update: 10 of 14 packages with typesVersions are working with this PR. But one of the non-working ones is node 🙃 |
Checking each individual package is working. I discovered that Minimum TypeScript Version wasn't propagating to subdirectories, so I had to fix that. I'm going to send out PRs to DT tomorrow; @andrewbranch @elibarzilay can you take a look at this? |
package.json
Outdated
"@definitelytyped/utils": "latest", | ||
"@definitelytyped/header-parser": "0.0.49-next.0", | ||
"@definitelytyped/typescript-versions": "0.0.47-next.0", | ||
"@definitelytyped/utils": "0.0.47-next.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update these after shipping 0.0.47 and before merging this PR.
if (onlyTestTsNext || tsLocal) { | ||
const tsVersion = tsLocal ? "local" : TypeScriptVersion.latest; | ||
if (typesVersions.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only-next/only-local case is now much simpler because it doesn't have to search for the latest version inside a ts* directory
function getTsVersion(i: number): TsVersion { | ||
return i === typesVersions.length | ||
? TypeScriptVersion.latest | ||
: assertDefined(TypeScriptVersion.previous(typesVersions[i])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The all-versions code is completely rewritten -- it now generates low/hi ranges and iterates over them.
Also, we only care about the // Minimum Typescript Version
comment from the root index.d.ts, so just need to read that once upfront.
expectOnly: boolean, | ||
tsLocal: string | undefined, | ||
inTypesVersionDirectory?: boolean, | ||
isLatest: boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testTypesVersion is now called in many fewer places, so I
- Shifted undefined checking out, to only places it applies.
- Shifted min-version checking out, to only places it applies.
- Made the last parameter required.
): Promise<void> { | ||
const minVersionFromComment = getTypeScriptVersionFromComment(indexText); | ||
if (minVersionFromComment !== undefined && inTypesVersionDirectory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
headers are already not allowed in subdirectories, so this check isn't needed.
Next steps: