Flow: Flow indexer property + computed property = check fails

Created on 23 Jan 2019  路  2Comments  路  Source: facebook/flow

No errors here:

type RegionId = string;
type RegionName = string;

type Region = {
  id: RegionId,
  name: RegionName
};

type Regions = {
    [RegionId]: Region
};

const regionId: RegionId = 'region_id';

const region: Regions = {
  [regionId]: {
    banana: 500
  }
};

In playground

soundness bug

Most helpful comment

Yeah this is a known problem with computed indexer properties; we currently treat them as any. This is definitely on my radar though!

All 2 comments

Yeah this is a known problem with computed indexer properties; we currently treat them as any. This is definitely on my radar though!

Was this page helpful?
0 / 5 - 0 ratings