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" |
|
Going to hold off on this until TS 7.1 has |
dc0fa47 to
b17027d
Compare
| interface LegacyCorsaApiInstance { | ||
| updateSnapshot(params: { openProjects: readonly string[] }): Snapshot; | ||
| } |
There was a problem hiding this comment.
Do we really need to support previous nightlies?
There was a problem hiding this comment.
This is for 7.0 support, not specifically old nightlies. I feel wary not supporting 7.0 at all given 7.1 has type related changes in it.
There was a problem hiding this comment.
Hm, but theoretically being 6.0 type-compatible is being 7.0 type-compatible, right? I feel like it takes a lot of workarounds to make this work with the 7.0 unstable API, but I guess it's not a ton of code.
There was a problem hiding this comment.
Sadly, there are quite a few real differences that 7.0 already showed: DefinitelyTyped/DefinitelyTyped#75408
There's error positioning, which could be worked around, but there's also problems with es5 removal, strict binding, etc, which 6.0 still avoids.
I could imagine skipping 7.0 but then we'd have a hard time understanding how to typesVersions it.
|
I updated the PR so that 7.1 is not run unless we're doing a local build, that way API changes we're making can be handled on the fly and not require people to update locally. This at least gets us 7.0 on DT and typesVersions. |
|
Going to merge but not release this yet, and make sure |
It turns out that we have enough API in 7.0 and 7.1 to be able to do
$ExpectTypeand diagnostics. So, do that!