jhipster / prettier-java

Prettier Java Plugin
http://www.jhipster.tech/prettier-java/
Apache License 2.0
1.06k stars 103 forks source link

Importing java-parser from typescript projects results in error #663

Closed mshima closed 2 months ago

mshima commented 2 months ago

Importing java-parser from a typescript project fails to build

import { type CstElement, type CstNode, parse } from 'java-parser';
error TS7016: Could not find a declaration file for module 'java-parser'. '/Volumes/T7/git/java-lint/node_modules/java-parser/src/index.js' implicitly has an 'any' type.
  There are types at '/Volumes/T7/git/java-lint/node_modules/java-parser/api.d.ts', but this result could not be resolved when respecting package.json "exports". The 'java-parser' library may need to update its package.json or typings.
mshima commented 2 months ago

Workaround before next release is to use patch-package: https://github.com/mshima/java-lint/commit/fe4d212ac8bd9081c75f322462908218a7b74a92