Skip to content

compiler error #19527

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

Closed
dulmandakh opened this issue Oct 27, 2017 · 2 comments
Closed

compiler error #19527

dulmandakh opened this issue Oct 27, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@dulmandakh
Copy link

TypeScript Version: 2.7.0-dev.20171027

Code

const HTTP_PORT = (process.env && process.env.HTTP_PORT) ? parseInt(process.env.HTTP_PORT) : 3000;

or

const HTTP_PORT = (process.env && typeof process.env.HTTP_PORT === 'string') ? parseInt(process.env.HTTP_PORT) : 3000;

Expected behavior:
There shouldn't be a compile error

Actual behavior:
error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.

@aluanhaddad
Copy link
Contributor

This is a duplicate of #17960

@mhegazy mhegazy added the Duplicate An existing issue was already created label Oct 27, 2017
@typescript-bot
Copy link
Collaborator

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants