【问题标题】:how to use Flow to check the `import` module?如何使用 Flow 检查 `import` 模块?
【发布时间】:2017-06-22 03:55:00
【问题描述】:

我正在用react学习Flow,当我导入一些模块时,流找不到模块。

import axios from "axios"; //requied module not found

export const fetchPopularRepos = (lang: string) => {
      var encodedURI = window.encodeURI(  // flow not covered
        "https://api.github.com/search/repositories?q=stars:>1 + language:" +
          lang +
          "&sort=stars&order=desc&type=Repositories"
      );
      return axios.get(encodedURI).then(response => response.data.items);
    };

//flow not covered
 export function getProfile(username: string) {
      return axios
        .get(`https://api.github.com/users/${username}${params}`)
        .then(user => user.data);
    }
  • 如何设置为不检查模块
  • 如何覆盖window.encodeURIaxios

【问题讨论】:

    标签: reactjs flowtype


    【解决方案1】:

    check this site out 。写下你需要的包名并在忽略时添加第一个正则表达式。这是一个黑客;)

    所以在您的情况下,您需要在 flowconfig 上忽略它

    [ignore]
    <PROJECT_ROOT>/node_modules/[^a].*
    

    【讨论】:

      猜你喜欢
      • 2019-11-05
      • 2016-02-19
      • 2015-05-14
      • 2018-04-27
      • 2015-06-24
      • 2022-01-17
      • 1970-01-01
      • 2017-11-14
      相关资源
      最近更新 更多