Skip to content

export modifier on enum disables This condition will always return * ts2845Β #63565

Description

@eps1lon

πŸ”Ž Search Terms

export enum ts2845

πŸ•— Version & Regression Information

5.4 doesn't flag it without the export modifier either.

⏯ Playground Link

https://www.typescriptlang.org/play/?target=99&module=0&ts=6.0.0-dev.20260416#code/KYDwDg9gTgLgBMAdgVwLZwIIBMCGYbBQDyyMYpAKgJ5jBwDeAUHJgAqsD6rGA4gKIAaZnG78AykIC+jRlmABjADY4odeREQBneDBrAAXJlz5CJMpT0z1W+AGsAloixwAvMN21XLl0bwFipOQw1LQAdBjsXLx8cAA+sb4mAebBeqGifGLCLAD0OSwFhUXFJaUUABb2mnDWWPYw9hpwAO72iopwOIrNOFTVqjDIUIhwAOQwUMjAo6EAFABMABwALACsAJTZcAD8Y4rAAGYwo1uGo1D2AOblxwDcQA

πŸ’» Code

// remove `export` modifier 
export enum AdapterOutputType {
  APP_PAGE,
  PAGES,
}

declare const type: AdapterOutputType

const kind =
  type === AdapterOutputType.APP_PAGE || AdapterOutputType.PAGES
    //                                   ~ should be flagged with: This condition will always return 'true'.(2845)
    ? 'left'
    : 'right';

πŸ™ Actual behavior

No typechecking error

πŸ™‚ Expected behavior

ts2845 because the condition is always true.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: check: Control FlowThe issue relates to control flow analysis

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions