Skip to content

Inference mismatch in strict and non-strict modeΒ #62814

@dipeshkaphle

Description

@dipeshkaphle

πŸ”Ž Search Terms

"type-inference", "bug", "boolean-literals"

πŸ•— Version & Regression Information

$ tsc --version
Version 5.9.3

⏯ Playground Link

https://www.typescriptlang.org/play/?#code/DYUwLgBAxgTg9gdwEYEMYGcIF4IAoJgwCuIEKmhJEAlAFC1RwB26kAjkSoSgJYvZ4CxUuQhI4cUCiY16oSAFs+PLkRikcuXLESoM1CAB9DeDlxi8W1OrQBmRJlDA9mY4HwDWuFBxBwi6ABcEKwwfADm1MEAtACsAGwQtADetBAQ8hAADgAWcGBwIAAmAvhxiaLlNADcadDMrBAAbiBOcBilELYowOgimOKSINI1dUpMKmBqGs2tBRi16epTMDLZeQXFtQC+tEA

πŸ’» Code

let crowbars = ( true as true )

const quatrains = ( true as boolean )

let miniature = ((crowbars) || (quatrains))

function blink(aqueous: string): -56 
{
  let photoed = ( -56 as -56 );
  const vectors = ( false as boolean );
  miniature = vectors;
  return  photoed;
}

πŸ™ Actual behavior

The program fails to compile in strict mode, but compiles fine in non-strict mode.

πŸ™‚ Expected behavior

This program doesn't have anything that should be affected by turning on strict mode, so behaviour should be exactly the same.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions