# MutableNamedTuple Type conversion error

**URL:** <https://discourse.julialang.org/t/mutablenamedtuple-type-conversion-error/52020>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 18, 2020, 2:39am UTC](https://discourse.julialang.org/t/mutablenamedtuple-type-conversion-error/52020 "2020-12-18T02:39:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zq\_F](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zq_f/32/20147_2.png) [@Zq\_F](https://discourse.julialang.org/u/Zq_F)\
**Post date:** [December 18, 2020, 2:39am UTC](https://discourse.julialang.org/t/mutablenamedtuple-type-conversion-error/52020/1 "2020-12-18T02:39:20Z")

</div>

Hello everyone  
I want to encapsulate a MutableNamedTuple in my own structure, but I always encounter type conversion errors, please help to see, thank you

using MutableNamedTuples

```julia
mutable struct TM{N,T}
  field1::Int32
  field2::String
  
  pm::MutableNamedTuple{N,T}
  function TM{N,T}(;kwargs...) where {N,T}
    a=MutableNamedTuple{N}(values(kwargs.data)) #Here I have successfully generated the MutableNamedTuple of the specified type
    println(dump(a))  
    this =new()
    this.pm=a #Type conversion error here
    return this
  end
end
TM(;kwargs...) = TM{keys(kwargs.data),typeof(values(kwargs.data))}(;kwargs...) 

function test()
  g = TM(b = 3,)
  #println(dump(g))
  return
end

function ttt()
  @time test()
  #@code_typed test()
end

ttt()

```
