Skip to content

Commit b02af17

Browse files
authored
Merge pull request #114 from malthe/dts-bundle-generator
Roll up type declarations
2 parents 426e932 + a1b24b4 commit b02af17

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
npm run build:esm
4646
echo '{"type": "commonjs"}' > dist/commonjs/package.json
4747
echo '{"type": "module"}' > dist/module/package.json
48+
npm i --no-save dts-bundle-generator
49+
npx dts-bundle-generator -o dist/index.d.ts src/index.ts
4850
mkdir dest
4951
npm pack --pack-destination=dest
5052
- name: Typedoc

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@
1313
"homepage": "https://github.com/malthe/ts-postgres",
1414
"author": "Malthe Borch <[email protected]>",
1515
"main": "./dist/module/index.js",
16-
"types": "./dist/module/index.d.ts",
16+
"types": "./dist/index.d.ts",
1717
"exports": {
18-
"require": "./dist/commonjs/index.js",
19-
"import": "./dist/module/index.js"
18+
".": {
19+
"require": {
20+
"types": "./dist/index.d.ts",
21+
"default": "./dist/commonjs/index.js"
22+
},
23+
"import": {
24+
"types": "./dist/index.d.ts",
25+
"default": "./dist/module/index.js"
26+
}
27+
}
2028
},
2129
"files": [
2230
"/dist"
@@ -58,6 +66,7 @@
5866
"@typescript-eslint/eslint-plugin": "^6",
5967
"@typescript-eslint/parser": "^6",
6068
"colors": "^1",
69+
"dts-bundle-generator": "^9.3.1",
6170
"eslint": "^8",
6271
"eslint-config-standard": "^17",
6372
"eslint-plugin-import": "^2",

src/client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import {
4040
} from './protocol.js';
4141

4242
import {
43-
BufferEncoding,
4443
DataFormat,
4544
DataType,
4645
ValueTypeReader,

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import type { Configuration } from './client.js';
1414
export {
1515
DataFormat,
1616
DataType,
17-
type BufferEncoding,
1817
type Point,
1918
type ValueTypeReader,
2019
} from './types.js';

src/protocol.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { sum } from './utils.js';
88
import {
99
arrayDataTypeMapping,
1010
isPoint,
11-
BufferEncoding,
1211
DataFormat,
1312
DataType,
1413
ValueTypeReader,

src/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { Buffer } from 'node:buffer';
22

3-
// This type isn't really exposed, but we can tease it out using some type gymnastics.
4-
export type BufferEncoding = NonNullable<
5-
Required<Parameters<Buffer['toString']>[0]>
6-
>;
7-
83
export const enum DataType {
94
Bool = 16,
105
Bytea = 17,

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"strict": true,
88
"sourceMap": true,
99
"inlineSourceMap": false,
10-
"declaration": true,
10+
"declaration": false,
1111
"noImplicitAny": true,
1212
"isolatedModules": true,
1313
"noUnusedParameters": true,

0 commit comments

Comments
 (0)