JSON-Patch icon indicating copy to clipboard operation
JSON-Patch copied to clipboard

Node12+ import documentation incorrect

Open rcollette opened this issue 2 years ago • 0 comments

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.

rcollette avatar Feb 21 '23 19:02 rcollette