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

@timorthi timorthi commented Jul 23, 2019

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

This comment has been minimized.

Copy link
Collaborator

@kibertoad kibertoad commented Jul 23, 2019

Could you create a pr with the fix?

@kibertoad

This comment has been minimized.

Copy link
Collaborator

@kibertoad kibertoad commented Jul 23, 2019

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

@timorthi

This comment has been minimized.

Copy link
Contributor Author

@timorthi timorthi commented Jul 23, 2019

@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

This comment has been minimized.

Copy link
Contributor Author

@timorthi timorthi commented Jul 26, 2019

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

kibertoad added a commit that referenced this issue Oct 26, 2019
@kibertoad

This comment has been minimized.

Copy link
Collaborator

@kibertoad kibertoad commented Oct 29, 2019

Released in 0.20.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.