Skip to content

Control flow analysis based on operators applied to an argument #15196

Closed
@mohsen1

Description

@mohsen1

TypeScript Version: 2.2.1 /

Code

function foo(a) {
  return a * 2
}

foo(''); // Flow throws an error but TypeScript marked foo as foo(a:a ny): number;

Expected behavior:
a is type number
Actual behavior:
a is type any

Try in Flow REPL

Try in TypeScript REPLE

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions