bitwalker / bitwalker/strukt

Precise typing of embeds

Open
#11 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
80
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Currently strukt typing `embeds_one :foo, Foo`'s type as `Foo.t()`, `embeds_many :foos, Foo` as `[Foo.t()]`:

https://github.com/bitwalker/strukt/blob/2b6c643aededaae571658f7dca1cb634b49c2cdb/lib/typespec.ex#L72-L77

it couldn't handle situations like
- `:foo` field could be null which type should be `Foo.t() | nil`,
- `:foos` could be nil, but element couldn't: `[Foo.t()] | nil`
- `:foos` could be nil, element's could be nil too: `nil | [Foo.t() | nil]`

any idea for handle these cases?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.