facebook/idx

Consider to support nullable type in `idx` first argument

Closed this issue · 0 comments

E.g.

type Obj = {
  a?: {
    b?: {
      c?: string
    }
  }
}
let obj: Obj = {} as any;
const a = idx(obj, _ => _.a);
const b = idx(a, _ => _!.b); // a can be null or undefined
const c = idx(b, _ => _!.c); // b can be null or undefined

Can we ignore the ! in the last two lines ?

FYI: @mohsen1