-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser
Description
💻
- Would you like to work on a fix?
How are you using Babel?
babel-loader (webpack)
Input code
type TParams<T extends boolean> = {
all?: T;
};
function foo({ all }: TParams<true>): string[];
function foo({ all }?: TParams<false>): string;
function foo({ all = false } = {}) {
const results = ['a', 'b'];
return all ? results : results[0];
}Configuration file name
No response
Configuration
I use the online repl: https://babeljs.io/repl# with typescript enabled.
Current and expected behavior
This code is valid typescript according to TSC (4.9.4) and friends, but babel throws:
A binding pattern parameter cannot be optional in an implementation signature. (6:13)
Environment
I'm running it in the babel online repl: https://babeljs.io/repl (currently version: 7.20.14)
Possible solution
No response
Additional context
This compiles correctly with tsc
Metadata
Metadata
Assignees
Labels
area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser