# TypeError in typeassert, expected

**URL:** <https://discourse.julialang.org/t/typeerror-in-typeassert-expected/133021>\
**Category:** New to Julia\
**Created:** [October 9, 2025, 6:05pm UTC](https://discourse.julialang.org/t/typeerror-in-typeassert-expected/133021 "2025-10-09T18:05:17Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [October 9, 2025, 9:02pm UTC](https://discourse.julialang.org/t/typeerror-in-typeassert-expected/133021/7 "2025-10-09T21:02:04Z")

</div>

I think the author is referencing [another thread](https://discourse.julialang.org/t/i-want-it-all-and-i-want-it-now-debugging-julia-code/133012) where `MethodError`’s “closest candidates” list does not show field names:

```julia-repl
julia> struct TEST_STRUCT; A; B end

julia> TEST_STRUCT(1)
ERROR: MethodError: no method matching TEST_STRUCT(::Int64)
The type `TEST_STRUCT` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  TEST_STRUCT(::Any, ::Any)
   @ Main REPL[131]:1

Stacktrace:
 [1] top-level scope
   @ REPL[132]:1

julia> methods(TEST_STRUCT) # me checking that default constructors have field names
# 1 method for type constructor:
 [1] TEST_STRUCT(A, B)
     @ REPL[131]:1

```

That might be a helpful addition.

---

_[View the full topic](https://discourse.julialang.org/t/typeerror-in-typeassert-expected/133021)._
