Skip to content

Commit 60c68e0

Browse files
committed
Export more precise typings for data types. Expose the database error so that users can use instanceof checks
1 parent e847f41 commit 60c68e0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/constants.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ export const DataTypeOIDs = {
130130
_varbit: 1563,
131131
_uuid: 2951,
132132
_jsonb: 3807,
133-
};
133+
} as const;
134+
135+
type INumericDataTypes = (typeof DataTypeOIDs)[keyof typeof DataTypeOIDs];
134136

135137
export const DataTypeNames = {
136138
[DataTypeOIDs.bool]: 'bool',
@@ -247,4 +249,6 @@ export const DataTypeNames = {
247249
[DataTypeOIDs._varbit]: '_varbit',
248250
[DataTypeOIDs._uuid]: '_uuid',
249251
[DataTypeOIDs._jsonb]: '_jsonb',
252+
} as const satisfies {
253+
[key in INumericDataTypes]: string;
250254
};

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export { DatabaseError } from './protocol/database-error.js';
2+
13
export * from './constants.js';
24
export * from './data-type-map.js';
35
export * from './types.js';

0 commit comments

Comments
 (0)