Skip to content

Error: An accessor cannot be declared in an ambient context #85

Open
@minicatsCB

Description

@minicatsCB

Hi, I just started using this library with Vue and TypeScript.

Versions:
Node: v12.7.0
Vue: 2.6.11
TypeScript: 3.5.3

Following the instructions in the README.md, I installed (from package.json):
"geodesy": "^2.2.1"
"@types/geodesy": "^2.2.2"
"esm": "^3.2.25"

In one of my Vue components I did:

import LatLon from 'geodesy/latlon-spherical.js';

...

const p1 = new LatLon(50.06632, -5.71475);
const p2 = new LatLon(58.64402, -3.07009);

const d = p1.distanceTo(p2);
console.assert(d.toFixed(3) == '968874.704');

Which works OK. But when I took a look at the console there were many errors like this:

ERROR in /path//node_modules/@types/geodesy/latlon-spherical.d.ts(18,9):
18:9 An accessor cannot be declared in an ambient context.
    16 |     get lng(): number;
    17 |     set lng(lon: number);
  > 18 |     get longitude(): number;
       |         ^
    19 |     set longitude(lon: number);
    20 |     static get metresToKm(): number;
    21 |     static get metresToMiles(): number;

What can be happening? Could I be missing any step?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions