diff --git a/src/KM3io.jl b/src/KM3io.jl
index fd1c11e76af3b22145a90c76dea4032caeecaddb..9574f4375096dc82370a7f52fe0cdc6dc77718e6 100644
--- a/src/KM3io.jl
+++ b/src/KM3io.jl
@@ -23,7 +23,8 @@ const version = let
 end
 
 using DocStringExtensions
-using StaticArrays: FieldVector, @SArray, SVector
+using StaticArrays: FieldVector, @SArray, SVector, Size
+import StaticArrays: similar_type
 import UnROOT
 
 using HDF5
diff --git a/src/types.jl b/src/types.jl
index 1da7b7cc5282fcc99f6844d79fc159a03fa66240..f25db0e90035c95ba8aa41f714961e2c66e032a6 100644
--- a/src/types.jl
+++ b/src/types.jl
@@ -12,6 +12,7 @@ struct Position{T} <: FieldVector{3, T}
     y::T
     z::T
 end
+similar_type(::Type{<:Position}, ::Type{T}, s::Size{(3,)}) where {T} = Position{T}
 
 """
 A vector to represent a direction in 3D.
@@ -20,14 +21,16 @@ struct Direction{T<:AbstractFloat} <: FieldVector{3, T}
     x::T
     y::T
     z::T
-    function Direction(x, y, z)
-        T = promote_type(typeof(x), typeof(y), typeof(z))
+    function Direction{U}(x, y, z) where U
+        T = promote_type(typeof(x), typeof(y), typeof(z), U)
         if !(T <: AbstractFloat)
             throw(ArgumentError("All elements must be convertible to an AbstractFloat"))
         end
         new{T}(x, y, z)
     end
 end
+similar_type(::Type{<:Direction}, ::Type{T}, s::Size{(3,)}) where {T} = Direction{T}
+
 """
 Fallback constructor to show a proper error message.
 """