How to nilify in the same way rails does with new versions of dry-types?

Hi there,
been working on the dry-v/types upgrade for Trailblazer gems (Reform and Disposable) and found an interesting “problem” (maybe not a problem) about nilify.
Disposable has a coercion feature where you can pass either type and/or nilify and it uses dry-types for the coercion but for new dry-type’s versions, this has changed a lot.
Disposable basically works quite similar to dry-struct so here a super simple example:

class MyTwin < Disposable::Twin
  property :title, nilify: true

With dry-types < 1.0 this was returning this: 'title').title -> 'title' '').title -> nil nil).title -> nil

This because we are using a setter that it will do something like this: if nilify

Now for dry-types this “should” be but this will raise an error if value is not nil which breaks a lot of people projects.

Tried to use Nominal but it doesn’t actually nilify since '' are not coerced into nil.

How can I reproduce the same behaviour using newer versions of dry-types (do not raise an error if passing a not nil value)?

Thank you

This should work:

[3] pry(main)> (Types::Params::Nil | Types::String)['']
=> nil
[4] pry(main)> (Types::Params::Nil | Types::String)[nil]
=> nil
[5] pry(main)> (Types::Params::Nil | Types::String)['foo']
=> "foo"