Add TypeScript 7 support to dtslint - #1321
Conversation
There was a problem hiding this comment.
Pull request overview
Adds TypeScript 7.0/7.1 support to dtslint through TypeScript’s out-of-process API.
Changes:
- Registers TypeScript 7 packages and version metadata.
- Adds TypeScript 7 diagnostics,
$ExpectType, ESLint, and local-build handling. - Upgrades bundled TypeScript and TypeScript ESLint dependencies.
Reviewed changes
Copilot reviewed 29 out of 34 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
pnpm-lock.yaml |
Locks upgraded tooling and TypeScript 7 packages. |
packages/typescript-versions/test/index.test.ts |
Tests new version ranges and tags. |
packages/typescript-versions/src/index.ts |
Registers TypeScript 7.0 and 7.1. |
packages/typescript-packages/test/index.test.ts |
Tests TypeScript 7 API subpaths. |
packages/typescript-packages/src/index.ts |
Supports resolving package subpaths. |
packages/typescript-packages/package.json |
Adds TypeScript 7 aliases. |
packages/publisher/package.json |
Upgrades TypeScript to 6.0. |
packages/mergebot/package.json |
Upgrades TypeScript to 6.0. |
packages/eslint-plugin/test/__file_snapshots__/types/expect-tsconfigs/index.d.ts.lint |
Updates TypeScript 6 diagnostics snapshot. |
packages/eslint-plugin/test/__file_snapshots__/types/expect-tsconfigs/expect-dom-tests.ts.lint |
Updates TypeScript 6 lint snapshot. |
packages/eslint-plugin/package.json |
Upgrades TypeScript ESLint and TypeScript. |
packages/dtslint/test/typescript7-eslint/tsconfig.json |
Configures TypeScript 7 ESLint fixture. |
packages/dtslint/test/typescript7-eslint/test.cts |
Adds ordinary ESLint failures fixture. |
packages/dtslint/test/typescript7-eslint/index.d.ts |
Adds fixture declaration entrypoint. |
packages/dtslint/test/typescript7-eslint/.eslintrc.json |
Configures fixture ESLint rules. |
packages/dtslint/test/tsconfig.json |
Excludes standalone fixtures. |
packages/dtslint/test/index.test.ts |
Tests TypeScript 7 lint paths. |
packages/dtslint/test/fixtures/typescript7/pass/tsconfig.json |
Configures passing fixture. |
packages/dtslint/test/fixtures/typescript7/pass/test.ts |
Exercises successful assertions and ranges. |
packages/dtslint/test/fixtures/typescript7/pass/index.d.ts |
Defines passing fixture API. |
packages/dtslint/test/fixtures/typescript7/fail/tsconfig.json |
Configures failing fixture. |
packages/dtslint/test/fixtures/typescript7/fail/test.ts |
Exercises diagnostics and assertion failures. |
packages/dtslint/test/fixtures/typescript7/fail/index.d.ts |
Defines failing fixture API. |
packages/dtslint/test/fixtures/typescript7/external/index.d.ts |
Tests external diagnostic suppression. |
packages/dtslint/src/lintTypeScript7.ts |
Implements TypeScript 7 IPC linting. |
packages/dtslint/src/lint.ts |
Routes versions between legacy and IPC linting. |
packages/dtslint/src/index.ts |
Passes tsconfigs and validates CLI options. |
packages/dtslint/package.json |
Updates runtime compiler dependencies. |
packages/dts-gen/package.json |
Upgrades TypeScript to 6.0. |
packages/dts-critic/package.json |
Upgrades TypeScript to 6.0. |
packages/definitions-parser/package.json |
Upgrades development TypeScript. |
package.json |
Upgrades repository TypeScript tooling. |
.changeset/tidy-tigers-compile.md |
Records TypeScript 6 upgrades. |
.changeset/strong-dragons-check.md |
Records TypeScript 7 support. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 35 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (2)
packages/dtslint/test/index.test.ts:242
- This walks one directory too far. Since
apiPathends intypescript/api/sync/api.js, four..segments resolve to the containingnode_modules, and the subsequentpath.dirname(packageRoot)builds an@typescript/...path outside that directory. The local-server test therefore passes a nonexistent executable tolint. Stop at the TypeScript package root instead.
const packageRoot = path.resolve(apiPath, "../../../../");
packages/dtslint/src/lintTypeScript7.ts:125
- For local TypeScript 7 runs this passes the literal version
"local"intosemver.satisfiesbelow. That value cannot satisfy any version range, so every TS2578 diagnostic is treated as outside its range and suppressed—even an unused// @ts-expect-error >=7.0, which should fail a local TS7 run. Use the resolved client version for range evaluation while keepinglocalonly as the report label.
addFailures(getDiagnosticFailures(project, dirPath, version, isLatest), run);
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 47 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (3)
packages/dtslint/src/lint.ts:240
- Directory-form
--localTspaths containing the released TypeScript 7 executable are rejected here because the native package exposestsc(and this PR’s own local-build test resolveslib/tsc), but this probe only recognizestsserver/tsgo. Includetscandtsc.exeso the documented directory-style local installation works for TypeScript 7.
if (["tsserver", "tsserver.exe", "tsgo", "tsgo.exe"].some((name) => fs.existsSync(joinPaths(tsLocal, name)))) {
packages/dtslint/src/lintTypeScript7.ts:179
- Even after local-build detection accepts a directory containing TypeScript 7’s standard
tscexecutable, this lookup still cannot select it. Addtsc/tsc.exe; otherwise callers must pass the executable itself rather than the supported directory form.
for (const name of ["tsserver", "tsserver.exe", "tsgo", "tsgo.exe"]) {
packages/utils/src/expect-error-range.ts:5
- The multiline-comment matcher captures the closing
*/as part of the range. For example,/* @ts-expect-error <7.0 */yields<7.0 */,validRangerejects it, and TS2578 is reported even when the current version is outside the range. Strip the closing delimiter in the matcher and add a block-comment regression case.
|
One tweak I need to make is to not call this "typescript 7" |
It turns out that we have enough API in 7.0 and 7.1 to be able to do
$ExpectTypeand diagnostics. So, do that!