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 =
|
||||
(wrapWorkerFn(optimizeModule): WorkerFnWithIO<OptimizationOptions>);
|
||||
exports.transformModule =
|
||||
(wrapWorkerFn(transformModule): WorkerFnWithIO<TransformOptions>);
|
||||
(wrapWorkerFn(transformModule): WorkerFnWithIO<TransformOptions<{+retainLines?: boolean}>>);
|
||||
|
|
|
@ -33,11 +33,11 @@ import type {
|
|||
} from '../types.flow';
|
||||
import type {Ast} from 'babel-core';
|
||||
|
||||
export type TransformOptions = {|
|
||||
export type TransformOptions<ExtraOptions> = {|
|
||||
filename: string,
|
||||
hasteImpl?: HasteImpl,
|
||||
polyfill?: boolean,
|
||||
transformer: Transformer<*>,
|
||||
transformer: Transformer<ExtraOptions>,
|
||||
variants?: TransformVariants,
|
||||
|};
|
||||
|
||||
|
@ -56,7 +56,7 @@ const ASSET_EXTENSIONS = new Set(defaults.assetExts);
|
|||
|
||||
function transformModule(
|
||||
content: Buffer,
|
||||
options: TransformOptions,
|
||||
options: TransformOptions<{+retainLines?: boolean}>,
|
||||
): TransformedSourceFile {
|
||||
if (ASSET_EXTENSIONS.has(path.extname(options.filename).substr(1))) {
|
||||
return transformAsset(content, options);
|
||||
|
@ -143,9 +143,9 @@ function transformJSON(json, options): TransformedSourceFile {
|
|||
return {type: 'code', details: result};
|
||||
}
|
||||
|
||||
function transformAsset(
|
||||
function transformAsset<ExtraOptions: {}>(
|
||||
content: Buffer,
|
||||
options: TransformOptions,
|
||||
options: TransformOptions<ExtraOptions>,
|
||||
): TransformedSourceFile {
|
||||
return {
|
||||
details: {
|
||||
|
|
Loading…
Reference in New Issue