Adding createFlowUnionType in place of createUnionTypeAnnotati… (#11448)
* 🔄 createUnionTypeAnnotation => createFlowUnionType * ➕ add createFlowUnionType if it exists (in new versions only ⚠️) * 🔄 use createFlowUnionType for createUnionTypeAnnotation
This commit is contained in:
@@ -99,6 +99,10 @@ function getTypeAnnotationBindingConstantViolations(binding, path, name) {
|
||||
return t.createTSUnionType(types);
|
||||
}
|
||||
|
||||
if (t.createFlowUnionType) {
|
||||
return t.createFlowUnionType(types);
|
||||
}
|
||||
|
||||
return t.createUnionTypeAnnotation(types);
|
||||
}
|
||||
|
||||
@@ -214,6 +218,13 @@ function getConditionalAnnotation(binding, path, name) {
|
||||
};
|
||||
}
|
||||
|
||||
if (t.createFlowUnionType) {
|
||||
return {
|
||||
typeAnnotation: t.createFlowUnionType(types),
|
||||
ifStatement,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
typeAnnotation: t.createUnionTypeAnnotation(types),
|
||||
ifStatement,
|
||||
|
||||
Reference in New Issue
Block a user