Skip to content

Parameter types of an unknown function are unknown #7702

Description

@sAs59

Flow version: 0.98.1

The code below used to be working fine on versions < 0.89
Now it breaks on versions > 0.90

// @flow

type A = {
  foo: 'foo',
  bar: () => void
};

type B = {
  foo: 'foo'
};


function func(obj: A | B) {
  if (typeof obj.bar === 'function') obj.bar();
}

Expected behavior

No error.

Actual behavior

Error: Cannot call obj.bar because the parameter types of an unknown function [1] are unknown.

Try-Flow

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions