Don't leak. Export.
If you export a function, the types of its arguments leak.
Even if your language of choice doesn’t allow you to write
ReturnType<typeof f> and you can’t refer to them, their concept leaks and
you need to be somewhat aware of it when using this function.
- type Props = {
+ export interface ChatProps {
- export function Chat(props: Props) {
+ export function Chat(props: ChatProps) {
This is super important when you’re building a library: the consumer can’t trivially export your types, and on top of that there’s a risk of divergence whenever you change them and they bump a version.
But even if you’re building an app, you can save your coworkers some time and frustration if you explicitly export everything that’s getting leaked anyway.