fix(react): 修复LayerContext类型问题

This commit is contained in:
聆一 2020-02-27 08:02:21 +08:00
parent 80626439e1
commit 2b9be52cfd
1 changed files with 2 additions and 1 deletions

View File

@ -1,7 +1,8 @@
import { ILayer } from '@antv/l7';
import { createContext, useContext } from 'react';
export const LayerContext = createContext({});
// tslint:disable-next-line: no-object-literal-type-assertion
export const LayerContext = createContext<ILayer | undefined>({} as ILayer);
export function useLayerValue(): ILayer {
return (useContext(LayerContext) as unknown) as ILayer;
}