Open
Description
// @flow
type Stuff<T> = {[string]: T | Stuff<T>}
const stuff: Stuff<number> = { a: { b: 'not a number' } } // errors as expected
type Record<K, V> = {[K]: V}
type RecordStuff<T> = Record<string, T | RecordStuff<T>>
const recordStuff: RecordStuff<number> = { a: { b: 'not a number' } } // should error, but doesn't
TypeScript reports a circular reference error in the recordStuff
case but not the stuff
case. Seems like there's something hard about supporting types like this, but I don't understand why it would be impossible?
Flow version: 0.164.0
Expected behavior
stuff
and recordStuff
have the same error
Actual behavior
No error on recordStuff
Activity