Repository navigation
expose types property on public HTTPQueryOptions type - #110
Conversation
|
cc @davidgomes |
|
@andyjy thank you! We'll review shortly |
|
Looks great! 🚀 This is a bit of undocumented territory, but if you may, leave a note to the top of ## UNRELEASED
expose types property on public HTTPQueryOptions type |
We will proceed with a patch once this is merged |
|
@pffigueiredo awesome! changelog duly updated. |
|
Shipped in v0.10.2 🚀 |
|
Apologies folks - this PR correctly made the existing type public, but I now realise the existing type looks to be incorrect - I think the type of all |
Uh, so this is not how you would use it? import PgTypes from 'pg-types';
import { neon } from '@neondatabase/serverless';
// Define custom parsers for specific PostgreSQL types
// Parse PostgreSQL `DATE` fields as JavaScript `Date` objects
PgTypes.setTypeParser(PgTypes.builtins.DATE, (val) => new Date(val));
// Parse PostgreSQL `NUMERIC` fields as JavaScript `float` values
PgTypes.setTypeParser(PgTypes.builtins.NUMERIC, parseFloat);
// Configure the Neon client with the custom `types` parser
const sql = neon(process.env.DATABASE_URL, {
types: PgTypes, // Pass in the custom PgTypes object here
}); |
|
@pffigueiredo in short, no. That code works at runtime, but:
|
Support for passing custom type overrides was recently added in #92
Having confirmed it works, the types property needs to be added to the public types declaration files in order to be able to use it directly on the neon() function.
(This is required to fix types support for the PrismaNeonHTTP adapter)
Fixes #109