mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(compiler-cli): exclude private computed properties from class member extractions (#57596)
This will exclude properties like `[ɵWRITABLE_SIGNAL]` from the `WritableSignal` interface. PR Close #57596
This commit is contained in:
parent
c15ec36bd1
commit
ab91f0371b
1 changed files with 15 additions and 1 deletions
|
|
@ -110,7 +110,10 @@ class ClassExtractor {
|
|||
protected extractClassMember(memberDeclaration: MemberElement): MemberEntry | undefined {
|
||||
if (this.isMethod(memberDeclaration)) {
|
||||
return this.extractMethod(memberDeclaration);
|
||||
} else if (this.isProperty(memberDeclaration)) {
|
||||
} else if (
|
||||
this.isProperty(memberDeclaration) &&
|
||||
!this.hasPrivateComputedProperty(memberDeclaration)
|
||||
) {
|
||||
return this.extractClassProperty(memberDeclaration);
|
||||
} else if (ts.isAccessor(memberDeclaration)) {
|
||||
return this.extractGetterSetter(memberDeclaration);
|
||||
|
|
@ -375,6 +378,17 @@ class ClassExtractor {
|
|||
const modifiers = this.declaration.modifiers ?? [];
|
||||
return modifiers.some((mod) => mod.kind === ts.SyntaxKind.AbstractKeyword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check wether a member has a private computed property name like [ɵWRITABLE_SIGNAL]
|
||||
*
|
||||
* This will prevent exposing private computed properties in the docs.
|
||||
*/
|
||||
private hasPrivateComputedProperty(property: PropertyLike) {
|
||||
return (
|
||||
ts.isComputedPropertyName(property.name) && property.name.expression.getText().startsWith('ɵ')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** Extractor to pull info for API reference documentation for an Angular directive. */
|
||||
|
|
|
|||
Loading…
Reference in a new issue