RN buck: fix Flow error

Reviewed By: davidaurelio

Differential Revision: D5871509

fbshipit-source-id: 91bd020b95d33a854b5649daea1a0b8d7782706d
This commit is contained in:
Jean Lauliac 2017-09-20 09:18:30 -07:00 committed by Facebook Github Bot
parent 9f4ca4a541
commit 7d92dd2b5d
2 changed files with 6 additions and 6 deletions

View File

@ -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}>>);

View File

@ -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: {