JavaScript

JavaScript

Made by DeepSource

Use $Exact to make type spreading safe JS-0508

Anti-pattern
Major

Prefer that the object types that are spread to be exact type explicitly.

It is recommended by flow community to use exact type whenever possible as they are much more precise and interact better with other type system features, like spreads.

Bad Practice

type city = {...{test: string}}

type location = {test: number}; type city = {...location}

Recommended

type city = {...$Exact<{test: string}>}

type location = {test: number}; type city = {...$Exact<location>}