[dry-type] Params namespace

I’m trying to define new types and some of them are specific to Params so I would like to create the in the Params namespace/module:

module Types
  include Dry.Types()
  
  module Params
    PageSize = Types::Params::Integer
  end
end

But I got “(irb):39:in `module:Params’: uninitialized constant Types::Params::Integer (NameError)”

If I don’t use a module for the namespace it’s working

module Types
  include Dry.Types()
  
  PageSize = Types::Params::Integer
end

What am I supposed to do ?

So, this is unfortunate. I’d say this should be reported as a bug. For now, you can do this:

module Types
  include Dry.Types()

  Params::PageSize = Types::Params::Integer
end
1 Like

For the record, Nikita provided an explanation why it works the way it works here.