mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08: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:
committed by
Paul Gschwendtner
parent
c15ec36bd1
commit
ab91f0371b
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user