(obj interface{})
| 254 | } |
| 255 | |
| 256 | func (t *TypeScriptify) Add(obj interface{}) *TypeScriptify { |
| 257 | switch ty := obj.(type) { |
| 258 | case StructType: |
| 259 | t.structTypes = append(t.structTypes, ty) |
| 260 | case *StructType: |
| 261 | t.structTypes = append(t.structTypes, *ty) |
| 262 | case reflect.Type: |
| 263 | t.AddType(ty) |
| 264 | default: |
| 265 | t.AddType(reflect.TypeOf(obj)) |
| 266 | } |
| 267 | return t |
| 268 | } |
| 269 | |
| 270 | func (t *TypeScriptify) AddType(typeOf reflect.Type) *TypeScriptify { |
| 271 | t.structTypes = append(t.structTypes, StructType{Type: typeOf}) |