We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently javascript cannot consume typescript generic functions, resulting in warnings ts(2339) in ReactDom's useParams ().
Prototype in .d.ts file:
export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
Consumption in javascript:
const { mode = 'default' } = useParams (); ^ Property 'mode' does not exist on type '{}'. ts(2339)
javascript consume generics
My suggestion meets these guidelines:
It is currently possible to do something like this in javascript:
/** * @typedef {{mode: string, mode2: string}} TestParams */ const { mode = 'default' } = /** @type { () => TestParams } */ (useParams) ();
Is there a way to do something like this instead?
const { mode = 'default' } = /** @useTemplate <TestParams> */ (useParams) ();
See above
Also found #27387
The text was updated successfully, but these errors were encountered:
Same as #27387
Sorry, something went wrong.
No branches or pull requests
Suggestion
Currently javascript cannot consume typescript generic functions, resulting in warnings ts(2339) in ReactDom's useParams ().
Prototype in .d.ts file:
Consumption in javascript:
🔍 Search Terms
javascript consume generics
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
It is currently possible to do something like this in javascript:
Is there a way to do something like this instead?
📃 Motivating Example
💻 Use Cases
See above
Also found #27387
The text was updated successfully, but these errors were encountered: