💻
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
💻
How are you using Babel?
babel-loader (webpack)
Input code
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