-
Notifications
You must be signed in to change notification settings - Fork 8
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
types don't match module format #25
Comments
does it work if you use this? import { Tsquery } from 'pg-tsquery';
const parser = new Tsquery(/* options can be passed to override the defaults */); |
TS2614: Module 'pg-tsquery' has no exported member Tsquery . Did you mean to use import Tsquery from "pg-tsquery" instead? Tried loading the version from github and got this from node: The issue is if you use the node16 module format to use native es modules in node it won't work because the typescript definition is trying to say this is an es module but it's actually cjs. |
Created a pull request that should match the actual exported code. Take a look. |
Thanks, I'm not so familiar with TS, so if this fixes the type issues, I'll merge it, thanks again |
Will you do a new npm release with this fix? The current 8.4.1 release doesn't have this yet. |
done sorry |
Ran into a weird issue with this module after switching typescript to the 'node16' module format.
It boils down to the code is exporting a function as a cjs module, but the index.d.ts definitions are written as if it's esm.
error TS2349: This expression is not callable.
Type 'typeof import(".../node_modules/pg-tsquery/index")' has no call signatures.
I think the fix would be something like this in index.d.ts instead of the export default:
For now a work around is this goofy thing:
The typescript guys built this little tool that seems to agree with my analysis:
https://arethetypeswrong.github.io/?p=pg-tsquery%408.4.1
The text was updated successfully, but these errors were encountered: