diff --git a/package.json b/package.json index 06042ef..fcea412 100644 --- a/package.json +++ b/package.json @@ -23,11 +23,13 @@ "author": "Nisharg Shah", "main": "dist/ImageMapper.js", "types": "dist/ImageMapper.d.ts", + "type": "commonjs", "scripts": { "build": "tsc", "lint": "eslint . --ext .tsx", "lint-fix": "eslint . --ext .tsx --fix", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run build", + "prepare": "npm run build" }, "husky": { "hooks": { diff --git a/src/ImageMapper.tsx b/src/ImageMapper.tsx index 846d7fb..cc5ce81 100644 --- a/src/ImageMapper.tsx +++ b/src/ImageMapper.tsx @@ -198,7 +198,7 @@ const ImageMapper: React.FC = (props: ImageMapperProps) => { } }; - const scaleCoords = (coords: []): number[] => { + const scaleCoords = (coords: number[]): number[] => { const scale = widthProp && imageWidthProp && imageWidthProp > 0 ? (widthProp as number) / imageWidthProp diff --git a/src/types.ts b/src/types.ts index 625a635..d8ce264 100644 --- a/src/types.ts +++ b/src/types.ts @@ -25,15 +25,15 @@ export interface Container extends HTMLDivElement { export interface MapAreas { id?: string; - shape: string; - coords: []; - active: boolean; - disabled: boolean; - href: string; - fillColor: string; - strokeColor: string; - lineWidth: number; - preFillColor: string; + shape: 'rect' | 'circle' | 'poly'; + coords: number[]; + active?: boolean; + disabled?: boolean; + href?: string; + fillColor?: string; + strokeColor?: string; + lineWidth?: number; + preFillColor?: string; } export interface Map { diff --git a/tsconfig.json b/tsconfig.json index dc461d9..8b58aef 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "es5", - "module": "esnext", + "module": "commonjs", "lib": [ "dom", "dom.iterable",