Starcounter-Jack / JSON-Patch

Lean and mean Javascript implementation of the JSON-Patch standard (RFC 6902). Update JSON documents using delta patches.
MIT License
1.78k stars 215 forks source link

Node12+ import documentation incorrect #311

Open rcollette opened 1 year ago

rcollette commented 1 year ago

When importing in Node12+ with ECMAScript module support enabled

import * as jsonpatch from "fast-json-patch";

You won't get a compile-time error from Typescript, but you will get a runtime error when calling something like jsonpatch.applyPatch stating that the method does not exist.

Because it is defined as a default export, it should be imported like:

import jsonPatch from "fast-json-patch"

Note that I changed the casing as well so that the IDE doesn't complain about spelling.