I've been stuck on this for a while now. I'm trying to use the npm package 'markerwithlabel', which is untyped. Here is the d.ts file I created
declare module 'markerwithlabel' {
export interface MarkerWithLabelOptions extends google.maps.MarkerOptions {
labelContent?: string | Node;
labelAnchor?: google.maps.Point;
labelClass?: string;
labelStyle?: Object;
labelInBackground?: boolean;
labelVisible?: boolean;
raiseOnDrag?: boolean;
optimized?: boolean;
crossImage?: string;
handCursor?: string;
}
export default class MarkerWithLabel extends google.maps.Marker {
readonly prototype: any;
constructor(opt_options?: MarkerWithLabelOptions);
}
}
My implementing code
import MarkerWithLabel from 'markerwithlabel';
...
let marker = new MarkerWithLabel({ position: branchPosition, title: title, label: label, map: this._map });
Which is giving me the error
Uncaught TypeError: Cannot read property 'prototype' of undefined
at inherits (index.js:45)
at new module.exports (index.js:88)
at eval (eval at GoogleMapsRouteRenderer.renderMarkersFromResult (google-maps-route-renderer.js:NaN), <anonymous>:1:1)
at GoogleMapsRouteRenderer.renderMarkersFromResult (google-maps-route-renderer.js:139)
at GoogleMapsRouteRenderer.render (google-maps-route-renderer.js:570)
at MapSchedulerCustomElement.eval (map-scheduler.js:237)
at step (map-scheduler.js:41)
at Object.eval [as next] (map-scheduler.js:22)
at fulfilled (map-scheduler.js:13)
at tryCatcher (bluebird.js:4954)
at Promise._settlePromiseFromHandler (bluebird.js:3095)
at Promise._settlePromise (bluebird.js:3152)
at Promise._settlePromise0 (bluebird.js:3197)
at Promise._settlePromises (bluebird.js:3277)
at _drainQueueStep (bluebird.js:190)
at _drainQueue (bluebird.js:183)
Stepping into the constructor before getting the error I get to this line where OverlayView is undefined
inherits(MarkerLabel_, gMapsApi.OverlayView);
And lastly stepping into the inherits function where parentCtor.prototype is undefined
function inherits(childCtor, parentCtor) {
/** @constructor */
function tempCtor() {};
tempCtor.prototype = parentCtor.prototype;
Any help would be wonderful. Thanks.
Comments
Post a Comment