Flow: $Shape<T> allows undefined and null values

Created on 27 Feb 2018  路  3Comments  路  Source: facebook/flow

/* @flow */

(undefined: $Shape<{}>); // no error
(null: $Shape<{ a: 1 }>); // no error either

I know that $Shape<T> is sort of an undocumented feature, yet I doubt this is expected behaviour.

Checked against 0.66

Most helpful comment

fixed in v0.90.0

All 3 comments

v0.85 - still works incorrect.

Workaround type SaveShape<T> = $Shape<T> & {};
Try Flow

fixed in v0.90.0

Was this page helpful?
0 / 5 - 0 ratings