node-pg-cursor icon indicating copy to clipboard operation
node-pg-cursor copied to clipboard

typescript support?

Open jugutier opened this issue 7 years ago • 2 comments

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

jugutier avatar May 14 '18 01:05 jugutier

if typescript is a superset of JS, and that works in JS, shouldn't this be a bug for typescript? 🤷‍♂️

unlucio avatar Oct 29 '18 17:10 unlucio

@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).

mikl avatar Dec 04 '18 23:12 mikl