How to correct flow warning: destructuring (Missing annotation)

I would write this as

type StationType = {
  code: String,
  label: String,
}

function StationDetail({ station } : {station : StationType}) => {
  const {
    code,
    label,
} = station;

It’s necessary to declare the type of the object parameter that the function accepts.

Leave a Comment

tech