How to add a new hash to empty array of hashes?

Suppose there is an array of hashes:

array = [{"a" => "Aa", "b" => 66, "c" => Time.now}]

I can easily add another element:

array << {"c" => "Bb", "d" => 2, "f" => 1.year.from_now}

But when I start from the empty array:

empty = [] of Hash(String, String | Time | Int64)

and try to add new element, an error appears:

empty << {"a" => "Aa", "b" => 66, "c" => Time.now}
# no overload matches 'Array(Hash(String, Int64 | String | Time))#<<' 
# with type Hash(String, Int32 | String | Time)

Could you please explain what I do wrong?

Link to sample code

You have to cast 66 to Int64, so it turns into 66_i64https://play.crystal-lang.org/#/r/618p

Thank’s a lot.
Why didn’t I see that before? :)

1 Like