流:无法为此模块构建类型化的接口 [英] Flow: Cannot build a typed interface for this module

查看:50
本文介绍了流:无法为此模块构建类型化的接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行流程时遇到这些错误,但根本不确定为什么:

I'm getting these errors when I run flow but not sure at all why:

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ packages/gestalt/src/Typeahead.js:272:9

Cannot build a typed interface for this module. You should annotate the exports of this module with types. Cannot
determine the type of this call expression. Please provide an annotation, e.g., by adding a type cast around this
expression. [signature-verification-failure]

     269│ Typeahead.propTypes = {
     270│   id: PropTypes.string,
     271│   onChange: PropTypes.func,
     272│   data: PropTypes.arrayOf(
     273│     PropTypes.exact({
     274│       label: PropTypes.string.isRequired,
     275│       value: PropTypes.string.isRequired,
     276│     })
     277│   ),
     278│   placeholder: PropTypes.string,
     279│   size: PropTypes.oneOf(['md', 'lg']),
     280│   searchField: PropTypes.string,


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ packages/gestalt/src/Typeahead.js:279:9

Cannot build a typed interface for this module. You should annotate the exports of this module with types. Cannot
determine the type of this call expression. Please provide an annotation, e.g., by adding a type cast around this
expression. [signature-verification-failure]

     276│     })
     277│   ),
     278│   placeholder: PropTypes.string,
     279│   size: PropTypes.oneOf(['md', 'lg']),
     280│   searchField: PropTypes.string,
     281│   onBlur: PropTypes.func,
     282│   onFocus: PropTypes.func,


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ packages/gestalt/src/Typeahead.js:284:16

Cannot build a typed interface for this module. You should annotate the exports of this module with types. Cannot
determine the type of this call expression. Please provide an annotation, e.g., by adding a type cast around this
expression. [signature-verification-failure]

     281│   onBlur: PropTypes.func,
     282│   onFocus: PropTypes.func,
     283│   onSelect: PropTypes.func,
     284│   defaultItem: PropTypes.exact({
     285│     label: PropTypes.string.isRequired,
     286│     value: PropTypes.string.isRequired,
     287│   }),
     288│   noResultText: PropTypes.string,
     289│ };
     290│


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ packages/gestalt/src/TypeaheadInputField.js:193:16

Cannot build a typed interface for this module. You should annotate the exports of this module with types. Cannot
determine the type of this call expression. Please provide an annotation, e.g., by adding a type cast around this
expression. [signature-verification-failure]

     190│ };
     191│ forwardRefInputField.displayName = 'InputField';
     192│
     193│ export default React.forwardRef<Props, HTMLInputElement>(forwardRefInputField);
     194│


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ packages/gestalt/src/TypeaheadOption.js:79:11

Cannot build a typed interface for this module. You should annotate the exports of this module with types. Cannot
determine the type of this call expression. Please provide an annotation, e.g., by adding a type cast around this
expression. [signature-verification-failure]

     76│ Option.displayName = 'Option';
     77│
     78│ Option.propTypes = {
     79│   option: PropTypes.exact({
     80│     label: PropTypes.string.isRequired,
     81│     value: PropTypes.string.isRequired,
     82│   }),
     83│   selected: PropTypes.exact({
     84│     label: PropTypes.string.isRequired,
     85│     value: PropTypes.string.isRequired,


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ packages/gestalt/src/TypeaheadOption.js:83:13

Cannot build a typed interface for this module. You should annotate the exports of this module with types. Cannot
determine the type of this call expression. Please provide an annotation, e.g., by adding a type cast around this
expression. [signature-verification-failure]

     80│     label: PropTypes.string.isRequired,
     81│     value: PropTypes.string.isRequired,
     82│   }),
     83│   selected: PropTypes.exact({
     84│     label: PropTypes.string.isRequired,
     85│     value: PropTypes.string.isRequired,
     86│   }),
     87│   searchField: PropTypes.string,
     88│   handleSelect: PropTypes.func,
     89│ };



Found 6 errors

推荐答案

这是因为您启用了类型优先的体系结构,这意味着必须在模块边界处显式键入才能导出它.

This is because you have the types first architecture enabled which means that at module boundaries must be explicitly typed before you can export it.

您可以在此处了解更多信息什么是类型优先"?流架构?

You can learn more about it here What is the "types first" Flow architecture?

这篇关于流:无法为此模块构建类型化的接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆