jsii 5.9.44 → 5.9.48-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,6 +145,13 @@ export declare class Assembler implements Emitter {
145
145
  * (no messing around with binding 'self' and 'this' and doing multiple calls to _withBaseClass.)
146
146
  */
147
147
  private _withBaseClass;
148
+ /**
149
+ * Whether a symbol is marked with the `@jsii ignore` directive on *all* of its
150
+ * declarations. We require every declaration to be ignored so that emission
151
+ * (`_visitNode`) and reference resolution (`_isPrivateOrInternal`) agree: a
152
+ * partially-ignored merged declaration stays a visible part of the public API.
153
+ */
154
+ private _isIgnored;
148
155
  /**
149
156
  * @returns true if this member is internal and should be omitted from the type manifest
150
157
  */
package/lib/assembler.js CHANGED
@@ -698,6 +698,19 @@ class Assembler {
698
698
  if ((ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export) === 0) {
699
699
  return [];
700
700
  }
701
+ // Early exit if the declaration is marked with `@jsii ignore`. We resolve the
702
+ // symbol and require *every* declaration to be ignored (see `_isIgnored`) so
703
+ // this stays consistent with how references are resolved; otherwise a
704
+ // partially-ignored merged declaration would be dropped here but treated as
705
+ // public elsewhere. Without this, deriving from a `Partial<T>` would also
706
+ // raise spurious compiler errors on an ignored declaration.
707
+ const nodeSymbol = this._typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(node) ?? node);
708
+ const isIgnored = nodeSymbol != null
709
+ ? this._isIgnored(nodeSymbol)
710
+ : directives_1.Directives.of(node, (diag) => this._diagnostics.push(diag)).ignore != null;
711
+ if (isIgnored) {
712
+ return [];
713
+ }
701
714
  let jsiiType;
702
715
  if (ts.isClassDeclaration(node) && _isExported(node)) {
703
716
  // export class Name { ... }
@@ -1153,6 +1166,16 @@ class Assembler {
1153
1166
  });
1154
1167
  }
1155
1168
  }
1169
+ /**
1170
+ * Whether a symbol is marked with the `@jsii ignore` directive on *all* of its
1171
+ * declarations. We require every declaration to be ignored so that emission
1172
+ * (`_visitNode`) and reference resolution (`_isPrivateOrInternal`) agree: a
1173
+ * partially-ignored merged declaration stays a visible part of the public API.
1174
+ */
1175
+ _isIgnored(symbol) {
1176
+ return ((symbol.declarations?.length ?? 0) > 0 &&
1177
+ symbol.declarations.every((decl) => directives_1.Directives.of(decl, (diag) => this._diagnostics.push(diag)).ignore != null));
1178
+ }
1156
1179
  /**
1157
1180
  * @returns true if this member is internal and should be omitted from the type manifest
1158
1181
  */
@@ -1165,7 +1188,7 @@ class Assembler {
1165
1188
  return true;
1166
1189
  }
1167
1190
  // If all the declarations are marked with `@jsii ignore`, then this is effetcively private as far as jsii is concerned.
1168
- if (symbol.declarations?.every((decl) => directives_1.Directives.of(decl, (diag) => this._diagnostics.push(diag)).ignore != null)) {
1191
+ if (this._isIgnored(symbol)) {
1169
1192
  return true;
1170
1193
  }
1171
1194
  if (!hasInternalJsDocTag && !hasUnderscorePrefix) {