Precise typing of embeds
Open
- 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.