Skip to content

Flow doesn’t error for undefined in tuples #785

Description

@iamdustan

When declaring a tuple type with expected types at each index, Flow doesn’t error on undefined slots. Doing the wrong type in a given index does error as expected.

Example repro at: https://gist.github.com/iamdustan/0fd4559b1339c0cb8759

/** @flow */

declare type ExampleTuple = [string, string, string];

function concat(ex:ExampleTuple): string {
  return ex.join(' ');
}

concat(['hello', 'world', 'golly']);

// I would expect flow to error on this line
concat(['hello', 'world']);

// I would expect this to error, too
var x:[string] = [];

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