thrift/thrift-gen/typestate.go
func (s *State) rootType(thriftType *parser.Type) *parser.Type {
	if state, newType, include := s.checkInclude(thriftType); include != nil {
		return state.rootType(newType)
	}

	if v, ok := s.typedefs[thriftType.Name]; ok {
		return s.rootType(v)
	}
	return thriftType
}
func (s *State) rootType(thriftType *parser.Type) *parser.Type {
	if state, newType, include := s.checkInclude(thriftType); include != nil {
		return state.rootType(newType)
	}

	if v, ok := s.typedefs[thriftType.Name]; ok {
		return s.rootType(v)
	}
	return thriftType
}
// rootType recurses through typedefs and returns the underlying type.