代码之家  ›  专栏  ›  技术社区  ›  FacundoGFlores

静态google地图的问题

  •  0
  • FacundoGFlores  · 技术社区  · 7 年前

    我安装了最新版本的 react-static-google-map

    node_modules/react-static-google-map/typings/index.d.ts:166:3 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.
    
    166   declare const MarkerGroupComponent: StatelessComponent<MarkerGroup>;
          ~~~~~~~
    
    node_modules/react-static-google-map/typings/index.d.ts:195:3 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.
    
    195   declare const PathGroupComponent: StatelessComponent<PathGroup>;
          ~~~~~~~
    

    在我的 tsconfig.json 我忽略了 node_modules

    "exclude": [
        "node_modules",
    ]
    

    https://github.com/Microsoft/TypeScript/wiki/FAQ#why-is-a-file-in-the-exclude-list-still-picked-up-by-the-compiler

    但没有成功。

    一个可能的解决办法是增加 --skipLibCheck

    1 回复  |  直到 7 年前
        1
  •  1
  •   Matt McCutchen    7 年前

    如果你从 react-static-google-map node_modules/react-static-google-map/package.json (这是 node_modules/react-static-google-map/typings/index.d.ts )所以它可以给你类型信息。打字文件错了:那些多余的 declare 应删除关键字。考虑将PR提交给 the repository . 同时,最好的选择可能是添加 静态谷歌地图 package.json 使用本地路径的依赖项。

    推荐文章