How about this?
@with_kw struct Par1{T<:Union{Float64, VecOrMat{Float64}}}
D::T = 5.0
G::Float64 = 1.0
dims::Int64 = 1
Nx::Int64 = 256
Lx::Float64 = 1.0
x0::Float64 = 0.0
x = range(x0, x0+Lx, length=Nx+1)[1:end-1]
dx::Float64 = x[2] - x[1]
order::Int64 = 2
end
Note that in your current struct, x also seems to have an undetermined type (Any if I’m correct)