Ailrun / typed-f

Typed functional programming utilities
MIT License
20 stars 2 forks source link

fix(lens): remove optional types from proxy result #36

Closed Ailrun closed 6 years ago

Ailrun commented 6 years ago

Description

Optional type make problem with following example.

type Example = {
  key?: string;
};

const exampleLens = new LensGenerator<Example>().byProxy();
// TS emit an error with message `Object is possibly 'undefined'`
example.key.set()({})('abc');

This change will not make any problems with following case, since type parameters for LensSProxy will include undefined as a value of key.

example.key.set()({ key: 'abc' })(undefined);