Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const removeFlowPreset = (...args: any[]) => {
// Pass along arguments to babel-preset-react-app and generate its preset.
const preset = presetReactApp(...args);
// Remove the Flow preset.
preset.presets = preset.presets.filter(
p => !babelPluginTransformFlowDetectionHack(p)
);
// Add the TypeScript preset if we have a compatible Babel beta version, see
// the docs for "doesBabelSupportOverridesFeature".
const overridesSupported = doesBabelSupportOverridesFeature(args[0].version);
if (overridesSupported) {
preset.presets.push(presetTypeScript);
} else {
preset.presets.push({
plugins: [transformTypeScript]
});
}