I'm setting up a new node project with typescript and babel.
I'm using @babel/preset-env and @babel/preset-typescript and this is my babel.config.js file:
module.exports = {
presets: [
[
"@babel/preset-env",
{
targets: {
node: "current",
},
},
],
"@babel/preset-typescript",
],
plugins: [
],
};
In my code I use the null-coalescing operator (x = a ?? b).
Unfortunately I get an error Jest encountered an unexpected token because the null-coalescing syntax is not recognized.
Shouldn't that be included by default by @babel/preset-env version 7? I'm targeting node 10.
Using babel/plugin-proposal-nullish-coalescing-operator fixes the error but I thought that should not be necessary.