Skip to content

Array(n).fill(value) isn't typechecked #7887

@julienw

Description

@julienw

With this code, Flow doesn't find the error:

type Plop = {
  prop: string[],
};

var a: Plop = {
  prop: Array(5).fill(1),
}

I believe this is because the Array constructor returns an array of any items in

static (...values:Array<any>): Array<any>;
.

try link

Metadata

Metadata

Assignees

No one assigned

    Labels

    Has PRLibrary definitionsIssues or pull requests about core library definitionsTyping: soundnessNo false negatives (type checker claims that there is no error in the incorrect program)bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions