# Type check conventions

**URL:** <https://discourse.julialang.org/t/type-check-conventions/99047>\
**Category:** General Usage\
**Created:** [May 18, 2023, 8:58am UTC](https://discourse.julialang.org/t/type-check-conventions/99047 "2023-05-18T08:58:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gxyau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gxyau/32/50421_2.png) [@gxyau](https://discourse.julialang.org/u/gxyau)\
**Post date:** [May 18, 2023, 8:58am UTC](https://discourse.julialang.org/t/type-check-conventions/99047/1 "2023-05-18T08:58:11Z")

</div>

I recently just discovered how to do type check in Julia, and I was just wondering what the convention is, and what differences are the two methods.

Say I have a variable `vec1` of type `Vector{<:Number}`. If I understand it correctly, this should include vectors that contains of only numbers (integers, complex, floating point, etc, but not strings). Now if I have, more concretely, `vec1` is of type `Vector{Int64}`, then the following will return true:

- `typeof(vec1) <: Vector{<:Number}`
- `vec1 isa Vector{<:Number}`
- `vec1 isa Vector{Int64}`
- `typeof(vec1) == Vector{Int64}`

But not the following:

- `typeof(vec1) <: Vector{Number}`
- `vec1 isa Vector{Number}`
- `typeof(vec1) == Vector{Number}`

Which of the correct syntax (ones that return true) is the conventional way of doing the type check? Are they equivalent, or are there any differences? Also, I understand that `Vector{Number}` is a type consist of any number type (i.e. we can view it as a singleton set), hence when we write `Vector{Int64} <: Vector{Number}`, it will return `false`. Is my understanding correct?

Thanks a lot in advance. (:

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [May 18, 2023, 2:37pm UTC](https://discourse.julialang.org/t/type-check-conventions/99047/2 "2023-05-18T14:37:12Z")

</div>

For the reasons why the last 3 statements are false see

[https://docs.julialang.org/en/v1/manual/types/#man-parametric-composite-types](https://docs.julialang.org/en/v1/manual/types/#man-parametric-composite-types)

Whether you check with `typeof` or `isa` likely won’t matter.
