Skip to content

Type mismatch when setting up connection #569

Answered by boromisp
fernandocanizo asked this question in Q&A
Discussion options

You must be logged in to vote

Actually, typescript complains that:

      Types of property 'port' are incompatible.
        Type 'string | number' is not assignable to type 'number | undefined'.
          Type 'string' is not assignable to type 'number'.

The last line is the most specific.

In order to satisfy the Options type, you would have to do something like this:

{
  port: parseInt(process.env.PGPORT, 10) || 5432
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fernandocanizo
Comment options

Answer selected by fernandocanizo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants