Suggestion
🔍 Search Terms
rest spread element destructure destructuring discriminated union narrow refine
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
A natural extension of #46266 would be to support the following
type Action =
| { kind: 'A', payload: number }
| { kind: 'B', payload: string };
function example({ kind, ...rest }: Action) {
if (kind === 'A') {
rest.payload.toFixed();
}
if (kind === 'B') {
rest.payload.toUpperCase();
}
}
📃 Motivating Example
💻 Use Cases
Suggestion
🔍 Search Terms
rest spread element destructure destructuring discriminated union narrow refine
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
A natural extension of #46266 would be to support the following
📃 Motivating Example
💻 Use Cases