[TypeScript]TypeError: Cannot read property 'getDistance' of undefined geolib 라이브러리를 TypeScript에서 사용하기 위해서는 TypeScript로 감싸준 패키지가 함께 설치되어야 함. 1. geolib 라이브러리를 @type 패키지까지 함께 설치한다 npm install geolib npm install @types/geolib 2. 사용이 필요한 곳에서 geolib을 import 한다. import * as geolib from "geolib" Today I Learn/TypeScript 2021.09.06
[React] geolib. getDistance 두 좌표의 거리 계산하기 Install npm install geolib yarn add geolib Usage import { getDistance } from 'geolib'; Functions getDistance(start, end, accuracy = 1) 두 지리 사이의 좌표를 계산한다. getDistance는 최대 3개의 인수를 사용하는데, 처음 2개는 유효해야 한다. // 예제 getDistance( { latitude: 51.5103, longitude: 7.49347 }, { latitude: "51° 31' N", longitude: "7° 28' E" } ); Today I Learn/React 2021.09.01