-
Notifications
You must be signed in to change notification settings - Fork 12.8k
RFC: @internal by default #49077
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
Comments
Is this something for https://api-extractor.com ? |
api extractor will benefit from it, but with only tsc there is also benefit (with |
Something like this might be useful for TS itself when converted into modules; without namespaces, you can't apply |
imo, |
The problematic scenario is:
|
⭐ Suggestion
Today you can use
@internal
JSDoc tag andstripeInternals
flag to erase private but exported APIs. It will be good to have a reversed option, that all exports are@internal
unless they explicitly opt-out.Option 1:
@public
JSDoc tagIf an export is commented with
@public
JSDoc tag, the declaration is emitted. Otherwise, treat it as@internal
.Example:
With
stripeInternal: all
, it emits the following declaration file:Option 2: Entry files
Allowing to specify a set of entry files (or infer it from
exports
field ofpackage.json
).If a type is not viable from one of the entry files, the type of it will not be emitted.
Example:
With
typeEntries: ["./index.ts"]
, only type referenced byA
andB
is emitted, all other declarations are treat as private.🔍 Search Terms
internal by default declaration project reference
✅ Viability Checklist
My suggestion meets these guidelines:
Add a new compiler option:
stripeInternal: "all"
, and use@public
JSDoc to allow the emit of declarations.📃 Motivating Example
It will improve the protection of internal APIs.
The text was updated successfully, but these errors were encountered: