flow - allow type parameter defaults in function declarations (#10084)
* flow - allow type parameter defaults in function declarations * fix flow test * add intern_comments option * fix flow parser test * remove allowdefault from flowParseTypeParameterDeclaration * rename test cases
This commit is contained in:
committed by
Nicolò Ribaudo
parent
6852bf6415
commit
fdbbb743b6
@@ -113,7 +113,10 @@ const options = {
|
||||
["flow", { all: true }],
|
||||
"flowComments",
|
||||
"jsx",
|
||||
"classProperties",
|
||||
"classPrivateProperties",
|
||||
"classPrivateMethods",
|
||||
"bigInt",
|
||||
],
|
||||
sourceType: "module",
|
||||
ranges: true,
|
||||
@@ -127,6 +130,7 @@ const flowOptionsMapping = {
|
||||
esproposal_nullish_coalescing: "nullishCoalescingOperator",
|
||||
esproposal_optional_chaining: "optionalChaining",
|
||||
types: "flowComments",
|
||||
intern_comments: false,
|
||||
};
|
||||
|
||||
const summary = {
|
||||
@@ -169,10 +173,12 @@ tests.forEach(section => {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!flowOptionsMapping[option]) {
|
||||
if (!(option in flowOptionsMapping)) {
|
||||
throw new Error("Parser options not mapped " + option);
|
||||
}
|
||||
babelParserOptions.plugins.push(flowOptionsMapping[option]);
|
||||
if (flowOptionsMapping[option]) {
|
||||
babelParserOptions.plugins.push(flowOptionsMapping[option]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user