brianc / node-pg-types

Type parsing for node-postgres
271 stars 56 forks source link

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

Closed andrisi closed 2 years 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 2 years 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 2 years ago

thanks! (perhaps this could go to the README)