-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: internal accessibility #390
Conversation
Other question that occurred to me now... is |
That's a good question. Let me check |
So the answer is that you have to explicitly define @internal on all inherited members, or otherwise the typescript compiler will make the method visible. Does it make sense to enforce this with jsii? I guess it does, no? |
… hidden interfaces
@@ -1051,17 +1128,34 @@ function _isExported(node: ts.Declaration): boolean { | |||
} | |||
|
|||
/** | |||
* Members with names starting with ``_`` and members that are private are hidden. | |||
* Members with names starting with `_` (and marked as @internal) and members |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc does no longer reflect what the implementation does.
When a type inherits (extends/implements) from a hidden (private/internal) interface, and that interface extends a non-hidden interface, we need to copy the non-hidden interface to the consuming type so that it can be polymorphically used. Follow up on #390 Co-authored-by: RomainMuller <rmuller@amazon.com>
When a type inherits (extends/implements) from a hidden (private/internal) interface, and that interface extends a non-hidden interface, we need to copy the non-hidden interface to the consuming type so that it can be polymorphically used. Follow up on #390 Co-authored-by: RomainMuller <rmuller@amazon.com>
Respect the
@internal
jsdoc tag on types and members. Any type of member marked internal will not be exposed in the API of the module and in .d.ts. files (through--strip-internal
).Members (properties/methods) that are marked as
@internal
must also have an underscore prefix (i.e._myMethod
) and vice versa in order to ensure that implementers or subclasses won't modify accessibility.If a class implements (or an interface extends) an internal or private interface, that interface is erased from the implementer's API. So it is possible to use internal interfaces as bases, while still maintaining API integrity (related to #287).
Fixes #388
BREAKING CHANGE: member names that begin with underscore now must be marked as "@internal" in their jsdocs, which will cause them to disappear from type declaration files and jsii APIs.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.