Effect CommunityEC
Effect Community3y ago
3 replies
Stephen Bluck

Questioning the functionality of `Effect.fromNullable` and its handling of null values

I am not sure if Effect.fromNullable is doing what it should or I am doing something wrong.
const intent = yield* $(
    Effect.fromNullable(formData.get('intent')), // FormDataEntryValue | null
    Effect.mapError(() => new NoIntentProvided()),
    Effect.map(a => a) // <---- this is a string | null
);

Shouldn't it remove the null?
Was this page helpful?