Add missing APIs needed by typescript-eslint - #64264
Andrew Branch (andrewbranch) merged 4 commits into
Conversation
6ac9049 to
e0520d9
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The parity surface omits a required checker API and exposes an unsafe contextual-type parameter.
Pull request overview
Adds native TypeScript API parity required by typescript-eslint and aligns JSX enum values with Strada.
Changes:
- Adds checker, signature, index, and interface-this APIs.
- Adds sync/async API parity tests and protocol support.
- Corrects
JsxEmit.ReactandReactNativevalues.
File summaries
| File | Description |
|---|---|
tsc/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js |
Updates JSX build-info baseline. |
tsc/testdata/baselines/reference/config/tsconfigParsing/parses tsconfig with compilerOptions, files, include, and exclude with jsonSourceFile api.js |
Updates parsed JSX value. |
tsc/testdata/baselines/reference/config/tsconfigParsing/parses tsconfig with compilerOptions, files, include, and exclude with json api.js |
Updates parsed JSX value. |
tsc/internal/ls/jsdoc.go |
Generalizes declaration JSDoc extraction. |
tsc/internal/core/compileroptions.go |
Corrects JSX enum values. |
tsc/internal/checker/types.go |
Adds IndexKind and interface-this access. |
tsc/internal/checker/exports.go |
Exposes awaited and index-type operations. |
tsc/internal/api/session.go |
Implements new protocol handlers. |
tsc/internal/api/proto.go |
Defines methods, parameters, and response metadata. |
tsc/internal/api/enum_values_generated.go |
Exports new enum values. |
packages/typescript/test/sync/api.test.ts |
Tests synchronous API parity. |
packages/typescript/test/sync/api-generators.test.ts |
Tests generator parity. |
packages/typescript/test/async/api.test.ts |
Tests asynchronous API parity. |
packages/typescript/src/enums/jsxEmit.ts |
Updates generated JSX enum. |
packages/typescript/src/enums/jsxEmit.enum.ts |
Updates JSX enum declaration. |
packages/typescript/src/enums/indexKind.ts |
Adds generated IndexKind. |
packages/typescript/src/enums/indexKind.enum.ts |
Adds IndexKind declaration. |
packages/typescript/src/api/sync/types.ts |
Adds synchronous interface-this API type. |
packages/typescript/src/api/sync/api.ts |
Adds synchronous API implementations. |
packages/typescript/src/api/proto.generated.ts |
Updates generated protocol types. |
packages/typescript/src/api/async/types.ts |
Adds asynchronous interface-this API type. |
packages/typescript/src/api/async/api.ts |
Adds asynchronous API implementations. |
Herebyfile.mjs |
Registers IndexKind generation. |
Review details
Files not reviewed (1)
- tsc/internal/api/enum_values_generated.go: Generated file
Suppressed comments (2)
packages/typescript/src/api/async/api.ts:1809
- The public parameter is broader than the operation supports.
Expressionallows identifiers, literals, and other non-call nodes, but the backend passes this node toresolveSignature, whose default case panics for anything outsideCallLikeExpression(tsc/internal/checker/checker.go:8620-8635). The classic API contract is alsoCallLikeExpression(tsc/testdata/fixtures/compiler/types.ts:5230). Please narrow this parameter in the async source and regenerate the sync API so a type-correct client call cannot crash the server.
positions: positionOrPositions,
packages/typescript/src/api/async/api.ts:2104
- The stated parity scope still omits
TypeChecker.getTypeOfPropertyOfType, which the linked typescript-eslint PR lists among the required recreated APIs. The Go checker already exposes the primitive attsc/internal/checker/exports.go:263-265, but there is no protocol or async/sync client method, so consumers still cannot use it through this API. Please expose it alongside these checker methods and cover it in the parity tests.
async getReturnTypeOfSignature(signature: Signature): Promise<Type> {
- Files reviewed: 22/23 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
Signature documentation and tag APIs do not preserve classic inherited JSDoc behavior.
Get a fresh assessment by requesting another Copilot review.
Review details
Files not reviewed (1)
- tsc/internal/api/enum_values_generated.go: Generated file
Suppressed comments (1)
tsc/internal/api/session.go:4084
- This path does not fully match classic
Signature.getDocumentationComment()inheritance: a derived method with an empty JSDoc or@inheritDochas a local JSDoc node, sogetJSDocOrTagstops there and this returns an empty comment instead of the base method's documentation. Please explicitly fall back to/merge base declaration documentation when the local result is empty or contains@inheritDoc, and cover that case in the parity tests.
return ls.GetDocumentationComment(setup.checker, []*ast.Node{signature.Declaration()}), nil
- Files reviewed: 22/23 changed files
- Comments generated: 1
- Review effort level: Balanced
There was a problem hiding this comment.
🟢 Approval recommended
The protocol, client implementations, generated enums, baselines, and parity tests are consistent and complete.
Review details
Files not reviewed (1)
- tsc/internal/api/enum_values_generated.go: Generated file
- Files reviewed: 22/23 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Adds the APIs mentioned by typescript-eslint/typescript-eslint#12803, except
program.sourceFileToPackageName, which was internal and doesn't exist in the Go code, andSignatureJSDoc methods, which should just go through the declaration for now as the PR currently does. Also corrects theJsxEmit.React/JsxEmit.ReactNativenumeric value change from Strada.