Skip to content
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

[preact/compat] missing type PropsWithoutRef #4124

Closed
augustjk opened this issue Sep 1, 2023 · 0 comments · Fixed by #4132
Closed

[preact/compat] missing type PropsWithoutRef #4124

augustjk opened this issue Sep 1, 2023 · 0 comments · Fixed by #4132

Comments

@augustjk
Copy link

augustjk commented Sep 1, 2023

Describe the feature you'd love to see
preact/compat/src/index.d.ts is missing PropsWithoutRef.
React's type:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/05094b6df4fb6f4404333725f13d63dd8aabeb34/types/react/index.d.ts#L826

Additional context (optional)
This is needed for components that are made with React.forwardRef as the return type of that function specifically makes use of PropsWithoutRef and just using Omit<P, 'ref'> does not satisfy React types. Without it in preact/compat, the prop simply becomes any for React components typed with this.

In the repro below, SlButton and SlIcon do not get proper type checking and will accept any prop.
https://stackblitz.com/edit/vitejs-vite-yhasfk?file=tsconfig.json,src%2Fapp.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants