Skip to content

Add TypeScript 7 support to dtslint - #1321

Open
Jake Bailey (jakebailey) wants to merge 24 commits into
microsoft:mainfrom
jakebailey:ts7
Open

Add TypeScript 7 support to dtslint#1321
Jake Bailey (jakebailey) wants to merge 24 commits into
microsoft:mainfrom
jakebailey:ts7

Conversation

@jakebailey

@jakebailey Jake Bailey (jakebailey) commented Aug 17, 2026

Copy link
Copy Markdown
Member

It turns out that we have enough API in 7.0 and 7.1 to be able to do $ExpectType and diagnostics. So, do that!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/dtslint/src/lintTypeScript7.ts Outdated
Comment thread packages/dtslint/src/lintTypeScript7.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 apiPath ends in typescript/api/sync/api.js, four .. segments resolve to the containing node_modules, and the subsequent path.dirname(packageRoot) builds an @typescript/... path outside that directory. The local-server test therefore passes a nonexistent executable to lint. 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" into semver.satisfies below. 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 keeping local only as the report label.
        addFailures(getDiagnosticFailures(project, dirPath, version, isLatest), run);

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --localTs paths containing the released TypeScript 7 executable are rejected here because the native package exposes tsc (and this PR’s own local-build test resolves lib/tsc), but this probe only recognizes tsserver/tsgo. Include tsc and tsc.exe so 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 tsc executable, this lookup still cannot select it. Add tsc/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 */, validRange rejects 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.

Comment thread packages/utils/src/expect-error-range.ts Fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 43 out of 49 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

@jakebailey

Copy link
Copy Markdown
Member Author

One tweak I need to make is to not call this "typescript 7"

Comment thread packages/dtslint/src/lintCorsa.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants