react-amap icon indicating copy to clipboard operation
react-amap copied to clipboard

typescript support?

Open gamecss opened this issue 3 years ago • 1 comments

  • [x] 我已经搜索过 issue,没有类似的问题,或者类似的问题仍然没有解决方案。
  • [x] 我已经搜索过文档,并且仍然没有找到解决方案。
  • [x] 我写了个问题重现的例子,链接或者代码将会贴在下面。

Reproduce Example Link or Code Fragment

window.AMap.sth(sth)
//  Property 'AMap' does not exist on type 'Window & typeof globalThis'.

What is Expected?

Create a package called '@types/amap' to fix problem like this.

What is actually happening?

typescript compiler seem very angry and block me do this :(

gamecss avatar May 28 '22 15:05 gamecss

Like this:

// @ts-ignore
declare global {
  interface Window {
    AMap: typeof AMap;
  }
}

gamecss avatar May 28 '22 23:05 gamecss