vasturiano/three-globe

.htmlElementsData() and .htmlElement() causes an uncaught type error - missing definition?

divljikunic opened this issue · 2 comments

Using .htmlElementsData() and .htmlElement() causes a "Uncaught TypeError: ...is not a function"

Going to the definition in "three-globe.d.ts", nothing resembling those functions exists there. As per the docs, there are hexes, polygons, custom layers etc. but no html elements.

Steps to reproduce the behavior:

  1. initialize an instance of ThreeGlobe() and try using the .htmlElementsData() or .htmlElement()

@divljikunic thanks for reaching out.

The type definitions should be there:

three-globe/src/index.d.ts

Lines 264 to 276 in bc84922

// HTML Elements layer
htmlElementsData(): object[];
htmlElementsData(data: object[]): ChainableInstance;
htmlLat(): ObjAccessor<number>;
htmlLat(latitudeAccessor: ObjAccessor<number>): ChainableInstance;
htmlLng(): ObjAccessor<number>;
htmlLng(longitudeAccessor: ObjAccessor<number>): ChainableInstance;
htmlAltitude(): ObjAccessor<number>;
htmlAltitude(altitudeAccessor: ObjAccessor<number>): ChainableInstance;
htmlElement(): HTMLElement | string | ((d: object) => HTMLElement);
htmlElement(htmlElementAccessor: HTMLElement | string | ((d: object) => HTMLElement)): ChainableInstance;
htmlTransitionDuration(): number;
htmlTransitionDuration(durationMs: number): ChainableInstance;

Are you using a recent version of the package?

I did an 'npm update' and the error is indeed gone! Thank you.
I had installed the package just recently, so it didn't occur to me this could even be an issue.