You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(router-core): strip internal types from public build (#4907)
This PR proposes we use the `@internal` JSDoc tag, and `--stripInternal`
typescript compiler option to remove internal keys from the public
`.d.ts` files.
Docs for `stripInternal`:
https://www.typescriptlang.org/tsconfig/#stripInternal
This helps ensuring internal values aren't considered as part of the
*public API surface* by users, allowing us more flexibility in
refactoring.
> [!WARNING]
> This PR proposes we add `stripInternal` to the entire repo, not just
`router-core`. However there are already some values marked as internal
that weren't added by this PR:
> - `InferStructuralSharing` in `react-router`
> - `handleHashScroll` in `router-core > scrollRestoration`
> - many `InferFoo` types in `router-core > typePrimitives`
>
> as a result of this, we might have to switch some of those `@internal`
tags to something else (like `@private` maybe?) because they are, in
fact, necessary for the build to be correct.
Example:
```ts
export type Foo = {
a: number,
/** @internal */
b: number,
}
/** @internal */
export function hello() {
return 'world'
}
export const answer = 42
```
gets compiled as `.d.ts` to
```ts
export type Foo = {
a: number
}
export const answer = 42
```
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
0 commit comments