Skip to content

Commit

Permalink
fix: Handle #private getters + methods
Browse files Browse the repository at this point in the history
Improves support for TS 4.3. No test yet since TD doesn't support beta versions officially.

Resolves #1564
  • Loading branch information
Gerrit0 committed Apr 3, 2021
1 parent 87c1ced commit d1a9bca
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/lib/converter/symbols.ts
Expand Up @@ -585,13 +585,6 @@ function convertProperty(
parameterType = declaration.type;
}
setModifiers(symbol, declaration, reflection);
const parentSymbol = context.project.getSymbolFromReflection(
context.scope
);
assert(parentSymbol, "Tried to convert a property without a parent.");
if (ts.isPrivateIdentifier(declaration.name)) {
reflection.setFlag(ReflectionFlag.Private);
}
}
reflection.defaultValue = declaration && convertDefaultValue(declaration);

Expand Down Expand Up @@ -913,8 +906,16 @@ function setModifiers(
reflection: Reflection
) {
const modifiers = ts.getCombinedModifierFlags(declaration);
// Note: We only set this flag if the modifier is present because we allow
// fake "private" or "protected" members via @private and @protected

if (
ts.isMethodDeclaration(declaration) ||
ts.isPropertyDeclaration(declaration) ||
ts.isAccessor(declaration)
) {
if (ts.isPrivateIdentifier(declaration.name)) {
reflection.setFlag(ReflectionFlag.Private);
}
}
if (hasAllFlags(modifiers, ts.ModifierFlags.Private)) {
reflection.setFlag(ReflectionFlag.Private);
}
Expand Down

0 comments on commit d1a9bca

Please sign in to comment.