Skip to content

Type mismatch in nanoid #32

@phocks

Description

@phocks

I think maybe the docs are just a bit off

It seems to return a string pub fn generate() -> String

But then the usage seems to expect a Result let assert Ok(id) = nanoid.generate()

https://hexdocs.pm/ids/ids/nanoid.html

error: Type mismatch
  ┌─ /Users/byrd.joshua/src/uuid/src/uuid.gleam:4:14
  │
4 │   let assert Ok(id) = nanoid.generate()
  │              ^^^^^^

Expected type:

    String

Found type:

    Result(a, b)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions