Repository navigation
fix(64058): fix reparse jsdoc @extends type arguments for call expressions - #64072
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes JSDoc @extends type arguments for call-expression heritage clauses.
Changes:
- Copies JSDoc type arguments onto the parsed heritage node.
- Adds parser and compiler regression coverage.
- Removes the previous property-access matching helper.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tsc/internal/parser/reparser.go |
Reparses @extends type arguments. |
tsc/internal/ast/utilities.go |
Removes the old name-matching helper. |
tsc/internal/parser/parser_test.go |
Tests reparsed AST linkage. |
tsc/testdata/tests/cases/conformance/jsdoc/extendsTag7.ts |
Adds the compiler regression case. |
tsc/testdata/baselines/reference/conformance/extendsTag7.types |
Records inferred types. |
tsc/testdata/baselines/reference/conformance/extendsTag7.symbols |
Records resolved symbols. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
f199fb7 to
459b499
Compare
0c1088c to
a315a46
Compare
dd99803 to
929b1bc
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The effective-base symbol gate rejects valid call-expression @extends cases and produces incorrect types and diagnostics.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 30/30 changed files
- Comments generated: 1
- Review effort level: Balanced
|
Sorry, after thinking about it I'm flip flopping... Your Aug 29 version (a315a46) was right. Copying the type arguments onto the call means the same thing as the TS Could you go back to it with two tweaks?
Here's a test covering those; only // @target: esnext
// @allowJs: true
// @checkJs: true
// @strict: true
// @noEmit: true
// @filename: a.js
/** @template T */
class A {
/** @param {T} value */
constructor(value) {
this.value = value;
}
}
/**
* @template T
* @extends {A<T>}
*/
class Sub extends A {
/** @returns {typeof Sub} */
static extend() {
return this;
}
}
/** @template T */
class Other {
/** @param {T} other */
constructor(other) {
this.other = other;
}
}
/**
* @template {new (...args: any[]) => any} C
* @param {C} Base
*/
function mixin(Base) {
return class extends Base {
extra = 1;
};
}
const ns = { A };
/** @type {boolean} */
let cond = true;
/** @extends {A<string>} */
class ViaMixin extends mixin(A) {}
/** @type {string} */
const viaMixin = new ViaMixin("ok").value;
/** @type {number} */
const viaMixinExtra = new ViaMixin("ok").extra;
/** @extends {Other<string>} */
class MismatchedMixin extends mixin(A) {}
/** @extends {A<string>} */
class ViaSubclass extends Sub.extend() {}
/** @type {string} */
const viaSubclass = new ViaSubclass("ok").value;
/** @extends {A<string>} */
class ViaElementAccess extends ns["A"] {}
/** @type {string} */
const viaElementAccess = new ViaElementAccess("ok").value;
/** @extends {A<string>} */
class ViaConditional extends (cond ? A : A) {}
/** @type {string} */
const viaConditional = new ViaConditional("ok").value;Thanks for bearing with me! |
6a96fea to
1e9f776
Compare
1e9f776 to
e7c47ae
Compare
|
Looks great, thanks! One thing: |
This nightly includes microsoft/TypeScript#64072 (the #64058 fix). It applies the JSDoc @extends type arguments to the call's return type, so over Component.extend(Evented), which returns a constructor that is not generic, the error changes to TS2508 and the signature is still lost. Update the upstream-differences snapshot and docs to match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #64058