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

Port missing in 'ConnectionConfig' TypeScript definition? #3367

Closed
timorthi opened this issue Jul 23, 2019 · 5 comments · Fixed by #3372
Closed

Port missing in 'ConnectionConfig' TypeScript definition? #3367

timorthi opened this issue Jul 23, 2019 · 5 comments · Fixed by #3372

Comments

@timorthi
Copy link
Contributor

Environment

Knex version: 0.18.4
Database + version: Postgres 9.5
OS: macOS 10.14

If issue is about TypeScript definitions, tag @lorefnon.

Bug

(I'm opening this issue under the assumption that I'm supposed to use 'ConnectionConfig' to type my PG connection config object. If my assumption is wrong, then there seems to be a missing type definition for Postgres connection config?)


The pg library accepts a port key, and passing the port key to knex indeed works:

import Knex from 'knex';

// TS compiler complaining about 'port' not being in the type definition
const pgConnectionConfig: Knex.ConnectionConfig = {
    port: 1234,
    host: 'myhost'
    user: 'myuser'
    password: 'mypw'
    database: 'mydb'
};

// Attempts to connect to 'myhost' on port 1234
const k = Knex({
  client: 'pg',
  connection: pgConnectionConfig,
  ...
});

but this key is missing in the ConnectionConfig interface.

@kibertoad
Copy link
Collaborator

Could you create a pr with the fix?

@kibertoad
Copy link
Collaborator

isn't there separate interface for pg config in master, though?

@timorthi
Copy link
Contributor Author

@kibertoad Sure! As for the config interfaces, I only see these: ConnectionConfig | MariaSqlConnectionConfig | MySqlConnectionConfig | MsSqlConnectionConfig | OracleDbConnectionConfig | Sqlite3ConnectionConfig | SocketConnectionConfig (link).

There isn't an interface called PgConnectionConfig or something similar, which is why I assumed ConnectionConfig to be the "PG interface". Should that be renamed to PgConnectionConfig?

@timorthi
Copy link
Contributor Author

@kibertoad Just submitted a PR for a separate PgConnectionConfig interface -- I'm still unsure about what driver ConnectionConfig is meant for...

@kibertoad
Copy link
Collaborator

Released in 0.20.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants