I think what you're looking for is an `internal` modifier. This allows class members to be public within a library, but private outside it.
It's been proposed since 2015: https://github.com/microsoft/TypeScript/issues/5228
Currently, you can use `@internal` in jsdoc, which with the `stripInternal` option in tsconfig will cause it to be omitted from the type declarations for a similar effect.
https://www.typescriptlang.org/tsconfig/#stripInternal
Edit: I've also seen libraries abuse `@deprecated` to inform users not to use an internal API:
https://www.typescriptlang.org/play/?#example/jsdoc-deprecat...