Skip to content

More explicit documentation Nullable. fromOption showing both branches #1160

@kevgathuku

Description

@kevgathuku

Hello,
Just going through the docs and found a minor issue with the Nullable.fromOption documentation which seems a bit incomplete, since it does not show what to expect for the None case

It does show how the Some branch is handled, which is great.
Nullable.fromOption documentation

Considering the Nullable type is used for handling both null and undefined values it could be nice to mention or add an example showing what is returned for the None case.

I found out through trial and error that it does return undefined, but it would be nice to have this clearly documented, since it is also reasonable to expect it to return null

Maybe something like this could work?

let nullableString = None
let asNullable = nullableString->Nullable.fromOption // undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions