You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generating an api report for a class with a JS private member omits that member.
Including such a member impacts type checking (prevents assignment on objects that are not instances of the class to values constrained to that classes type).
Due to this, the presence of such a member is included in the d.ts file and is part of the public API for a class, however is omitted in the generated API report.
This results in changes to the API like done in microsoft/FluidFramework#21351 (adding a private field for the sole purpose of impacting type checking) having no impact on the API reports:
Repro steps
Declare a class like:
exportclassFoo{readonly #x!: unknown;}
The field gets compiled into just #private; in the d.ts file.
Generate an API report for it.
Expected result: API report includes #private; like the d.ts file.
Actual result: API report is unimpacted by the private field.
Details
The TypeScript compile renames the field captures the fact that there are private fields with a single #private; marker, at least in 5.4.5.
Making APi extractor replicate this pattern, and include that marker if there is any JS private field might be a robust way to do this.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
Summary
Generating an api report for a class with a JS private member omits that member.
Including such a member impacts type checking (prevents assignment on objects that are not instances of the class to values constrained to that classes type).
Due to this, the presence of such a member is included in the d.ts file and is part of the public API for a class, however is omitted in the generated API report.
This results in changes to the API like done in microsoft/FluidFramework#21351 (adding a private field for the sole purpose of impacting type checking) having no impact on the API reports:
Repro steps
Declare a class like:
The field gets compiled into just
#private;
in the d.ts file.Generate an API report for it.
Expected result: API report includes
#private;
like the d.ts file.Actual result: API report is unimpacted by the private field.
Details
The TypeScript compile renames the field captures the fact that there are private fields with a single
#private;
marker, at least in 5.4.5.Making APi extractor replicate this pattern, and include that marker if there is any JS private field might be a robust way to do this.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/api-extractor
version?node -v
)?The text was updated successfully, but these errors were encountered: