microsoft / ConversationLearner-Samples

Sample bot using the ConversationLearner SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Error: Property 'port' does not exist on type 'string | AddressInfo'

mattmazzola opened this issue · comments

Do you want to request a feature or report a bug?

Bug

What's the current behavior?

When building there is a compilation error:

src/demos/demoMultiCL.ts:23:63 - error TS2339: Property 'port' does not exist on type 'string | AddressInfo'.
  Property 'port' does not exist on type 'string'.

console.log(`Server listening to ${listener.address().port}`)

What's the expected behavior?

Build should complete without errors

Please tell us about your environment:

N/A

I believe the issue is that @types/node version is not specified in package.json. It is resolved in package-lock.json but only based on the current installed version of node as it's dependency of other node libraries.

Solution 1:
Add @types/node to package.json in hopes that it locks it within package-lock.json instead of using "*"

Solution 2:
Avoid using address().port and simply use outer variable config.botPort which was given to server.