node-pg-cursor
node-pg-cursor copied to clipboard
typescript support?
Is there a way to get cursor support on typescript?
currently getting this error:
new _pgCursor.Cursor(sqlQuery, ''); ^
TypeError: _pgCursor.Cursor is not a constructor
if typescript is a superset of JS, and that works in JS, shouldn't this be a bug for typescript? 🤷♂️
@jugutier I don't know what _pgCursor is in your app, but I'm using this code in a TypeScript app of mine, and it works just fine:
import Cursor from 'pg-cursor'
const cursor = client.query(new Cursor(text, values))
(This is with "esModuleInterop": true in my tsconfig.json. Without that you'd need to use import * as Cursor from 'pg-cursor' to import it).