brianc / node-pg-types

Type parsing for node-postgres
267 stars 54 forks source link

How to import pg-types using ES6 syntax? #139

Closed andrisi closed 1 year ago

andrisi commented 2 years ago

Could you provide an example with the "import" statement and not "require" so that type translators get registered?

costinEEST commented 1 year ago

@andrisi the package it is already published to npm, so install it with npm i pg-types

To consume it, do import { builtins, getTypeParser } from 'pg-types'

Proof of concept, https://replit.com/@ccampean/ImportFromNodePgTypes#readme.md

andrisi commented 1 year ago

thanks! (perhaps this could go to the README)