Typescript Check If An Array Can Be Used To Replace