mirror of https://github.com/status-im/metro.git
Improve Flow typing for @babel/template
Summary: The current typing is incorrectly marking the second parameter as required. The options object is optional. Also added the special defaults for clarity. Reviewed By: davidaurelio Differential Revision: D7168409 fbshipit-source-id: e01b651f92b33175b750d188f9e6db99bdc4ab64
This commit is contained in:
parent
0e9e2505dd
commit
243fe983b7
|
@ -220,15 +220,20 @@ type BabelCoreOptions = {|
|
|||
) => void,
|
||||
|};
|
||||
|
||||
// https://github.com/babel/babel/tree/master/packages/babel-template
|
||||
type TemplateOptions = Babylon7Options & {|
|
||||
// note: template defaults for these options;
|
||||
// allowReturnOutsideFunction = true
|
||||
// allowSuperOutsideMethod = true
|
||||
// sourceType = module
|
||||
placeholderWhitelist?: Set<string>,
|
||||
placeholderPattern?: RegExp | false,
|
||||
preserveComments?: boolean,
|
||||
|};
|
||||
|
||||
type Templatable = ({|[tokenName: string]: string|}) => BabelNode;
|
||||
type Templatable = ({[tokenName: string]: string}) => BabelNode;
|
||||
|
||||
type TemplateFunc = (tpl: string, options: TemplateOptions) => Templatable;
|
||||
type TemplateFunc = (tpl: string, options?: TemplateOptions) => Templatable;
|
||||
|
||||
// note: ast is not optional, babel will throw if it would be empty:
|
||||
// https://github.com/babel/babel/blob/98969b8a7335e831c069164f5c56132111847224/packages/babel-core/src/transform-ast.js#L52
|
||||
|
|
Loading…
Reference in New Issue