Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ title: Changelog
### Bug Fixes

- Anchor links in the mobile hamburger menu now correctly scroll to their target, #3049.
- `Reflection.isDeprecated` now considers accessors deprecated when their `get`/`set` signatures carry a `@deprecated` tag. Previously only `signatures` (used by methods/functions) was checked, so a `@deprecated` getter/setter was not reported as deprecated.

## v0.28.20 (2026-07-05)

Expand Down
11 changes: 11 additions & 0 deletions src/lib/models/Reflection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,17 @@ export abstract class Reflection {
) {
signaturesDeprecated = true;
}

const accessorSignatures = [
decl.getSignature,
decl.setSignature,
].filter((sig): sig is SignatureReflection => sig != null);
if (
accessorSignatures.length &&
accessorSignatures.every((sig) => sig.comment?.getTag("@deprecated"))
) {
signaturesDeprecated = true;
}
},
});

Expand Down
15 changes: 15 additions & 0 deletions src/test/behavior.c2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,21 @@ describe("Behavior Tests", () => {
);
});

it("Marks accessors as deprecated based on their get/set signatures", () => {
const project = convert("deprecatedAccessor");
const test = query(project, "Test");

ok(query(project, "Test.getterOnly").isDeprecated());
ok(!query(project, "Test.setterOnly").isDeprecated());
ok(query(project, "Test.both").isDeprecated());
ok(
!query(project, "Test.mixed").isDeprecated(),
"An accessor is only deprecated if every one of its defined signatures is deprecated",
);
ok(!query(project, "Test.notDeprecated").isDeprecated());
ok(!test.isDeprecated());
});

it("Handles @hideconstructor", () => {
const project = convert("hideconstructor");

Expand Down
26 changes: 26 additions & 0 deletions src/test/converter2/behavior/deprecatedAccessor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export class Test {
/** @deprecated */
get getterOnly() {
return 1;
}

set setterOnly(v: number) {}

/** @deprecated */
get both() {
return 1;
}
/** @deprecated */
set both(v: number) {}

get mixed() {
return 1;
}
/** @deprecated */
set mixed(v: number) {}

get notDeprecated() {
return 1;
}
set notDeprecated(v: number) {}
}
Loading