mirror of https://github.com/status-im/metro.git
RN buck: fix Flow error
Reviewed By: davidaurelio Differential Revision: D5871509 fbshipit-source-id: 91bd020b95d33a854b5649daea1a0b8d7782706d
This commit is contained in:
parent
9f4ca4a541
commit
7d92dd2b5d
|
@ -21,4 +21,4 @@ import type {WorkerFnWithIO} from './worker/wrap-worker-fn';
|
||||||
exports.optimizeModule =
|
exports.optimizeModule =
|
||||||
(wrapWorkerFn(optimizeModule): WorkerFnWithIO<OptimizationOptions>);
|
(wrapWorkerFn(optimizeModule): WorkerFnWithIO<OptimizationOptions>);
|
||||||
exports.transformModule =
|
exports.transformModule =
|
||||||
(wrapWorkerFn(transformModule): WorkerFnWithIO<TransformOptions>);
|
(wrapWorkerFn(transformModule): WorkerFnWithIO<TransformOptions<{+retainLines?: boolean}>>);
|
||||||
|
|
|
@ -33,11 +33,11 @@ import type {
|
||||||
} from '../types.flow';
|
} from '../types.flow';
|
||||||
import type {Ast} from 'babel-core';
|
import type {Ast} from 'babel-core';
|
||||||
|
|
||||||
export type TransformOptions = {|
|
export type TransformOptions<ExtraOptions> = {|
|
||||||
filename: string,
|
filename: string,
|
||||||
hasteImpl?: HasteImpl,
|
hasteImpl?: HasteImpl,
|
||||||
polyfill?: boolean,
|
polyfill?: boolean,
|
||||||
transformer: Transformer<*>,
|
transformer: Transformer<ExtraOptions>,
|
||||||
variants?: TransformVariants,
|
variants?: TransformVariants,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ const ASSET_EXTENSIONS = new Set(defaults.assetExts);
|
||||||
|
|
||||||
function transformModule(
|
function transformModule(
|
||||||
content: Buffer,
|
content: Buffer,
|
||||||
options: TransformOptions,
|
options: TransformOptions<{+retainLines?: boolean}>,
|
||||||
): TransformedSourceFile {
|
): TransformedSourceFile {
|
||||||
if (ASSET_EXTENSIONS.has(path.extname(options.filename).substr(1))) {
|
if (ASSET_EXTENSIONS.has(path.extname(options.filename).substr(1))) {
|
||||||
return transformAsset(content, options);
|
return transformAsset(content, options);
|
||||||
|
@ -143,9 +143,9 @@ function transformJSON(json, options): TransformedSourceFile {
|
||||||
return {type: 'code', details: result};
|
return {type: 'code', details: result};
|
||||||
}
|
}
|
||||||
|
|
||||||
function transformAsset(
|
function transformAsset<ExtraOptions: {}>(
|
||||||
content: Buffer,
|
content: Buffer,
|
||||||
options: TransformOptions,
|
options: TransformOptions<ExtraOptions>,
|
||||||
): TransformedSourceFile {
|
): TransformedSourceFile {
|
||||||
return {
|
return {
|
||||||
details: {
|
details: {
|
||||||
|
|
Loading…
Reference in New Issue