Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node12+ import documentation incorrect #311

Open
rcollette opened this issue Feb 21, 2023 · 0 comments
Open

Node12+ import documentation incorrect #311

rcollette opened this issue Feb 21, 2023 · 0 comments

Comments

@rcollette
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant