That’s precisely the problem, @option
isn’t nilable, but you’re allowed to pass a nil
argument to the constructor. This in turn changes the error from “no overload” to what you see there because you’re trying to assign a variable that can be nilable to an ivar that cannot.
In this case, I’d do something like:
def initialize(option : YAML::Any? = nil)
@option = option || YAML.parse("{}")
end
Related: [RFC] Undefined Type