6

I'm an angular 5 (and turfjs) noob trying to use the turfjs along().

I've got a pretty simple working angular 5 project (built with angular-cli).

To add turf I ran:

npm install @turf/along --save

and I see @turf/along in my node modules directory. I tried just adding to my js file:

declare var along: any;

but that didn't work. I also tried adding

"../node_modules/@turf/along/index.js"

to my angular-cli.json file, but no luck.

What is the correct way to import this method so I can use it?

General Grievance
  • 4,555
  • 31
  • 31
  • 45
eze
  • 2,332
  • 3
  • 19
  • 30

1 Answers1

8

Ok, (eventually) I discovered that I can just use

import along from '@turf/along';

No declarations or need to mess with other files (e.g. angular-cli.json) and I use it just as if it was defined locally.

If there is a more "TypeScript" way to do this, please drop a comment.

eze
  • 2,332
  • 3
  • 19
  • 30
  • 3
    `import * as turf from '@turf/turf'; ... const lineGeoJson = turf.lineString(myLatLongArray); const smoothedLine = turf.bezier(lineGeoJson);` – Gui Keller May 22 '19 at 07:04