Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roll up type declarations #114

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
npm run build:esm
echo '{"type": "commonjs"}' > dist/commonjs/package.json
echo '{"type": "module"}' > dist/module/package.json
npm i --no-save dts-bundle-generator
npx dts-bundle-generator -o dist/index.d.ts src/index.ts
mkdir dest
npm pack --pack-destination=dest
- name: Typedoc
Expand Down
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@
"homepage": "https://github.com/malthe/ts-postgres",
"author": "Malthe Borch <[email protected]>",
"main": "./dist/module/index.js",
"types": "./dist/module/index.d.ts",
"types": "./dist/index.d.ts",
"exports": {
"require": "./dist/commonjs/index.js",
"import": "./dist/module/index.js"
".": {
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/commonjs/index.js"
},
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/module/index.js"
}
}
},
"files": [
"/dist"
Expand Down Expand Up @@ -58,6 +66,7 @@
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"colors": "^1",
"dts-bundle-generator": "^9.3.1",
"eslint": "^8",
"eslint-config-standard": "^17",
"eslint-plugin-import": "^2",
Expand Down
1 change: 0 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {
} from './protocol.js';

import {
BufferEncoding,
DataFormat,
DataType,
ValueTypeReader,
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type { Configuration } from './client.js';
export {
DataFormat,
DataType,
type BufferEncoding,
type Point,
type ValueTypeReader,
} from './types.js';
Expand Down
1 change: 0 additions & 1 deletion src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { sum } from './utils.js';
import {
arrayDataTypeMapping,
isPoint,
BufferEncoding,
DataFormat,
DataType,
ValueTypeReader,
Expand Down
5 changes: 0 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { Buffer } from 'node:buffer';

// This type isn't really exposed, but we can tease it out using some type gymnastics.
export type BufferEncoding = NonNullable<
Required<Parameters<Buffer['toString']>[0]>
>;

export const enum DataType {
Bool = 16,
Bytea = 17,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"strict": true,
"sourceMap": true,
"inlineSourceMap": false,
"declaration": true,
"declaration": false,
"noImplicitAny": true,
"isolatedModules": true,
"noUnusedParameters": true,
Expand Down
Loading