You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Errors is a collection of form errors//// const errors = { // title: ["can't be blank", "invalid characters"],// text: ["too long"],// }//// It could be rendered as// // <FormInput name="title" errors={errors}/>// Requiring that Errors had field of type TtypeErrors<Textendsstring>={[kinT]?: string[]}exportfunctionFormInput<Textendsstring>({ name, errors }: {name: T,errors: Errors<T>}){// TS complains that there's no lengthconsthasErrors=(errors[name]||[]).length>0}
Expected behavior:
Should correctly infer that (errors[name] || []) is an Array.
TS v 3.3.3, enable strictNullChecks
Code
Expected behavior:
Should correctly infer that
(errors[name] || [])
is an Array.Actual behavior:
Wrongly complains about
null
Playground Link:
Play
The text was updated successfully, but these errors were encountered: