Skip to content

Commit

Permalink
return value in new
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Sep 14, 2023
1 parent 35e3a1f commit a1093ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func MoveToParent(kid Ki, parent Ki) {
// New adds a new child of the given the type
// with the given name to the given parent.
// It is a helper function that calls [Ki.NewChild].
func New[T Ki](par Ki, name string) {
par.NewChild(gti.TypeByValue((*T)(nil)), name)
func New[T Ki](par Ki, name string) T {
return par.NewChild(gti.TypeByValue((*T)(nil)), name).(T)
}

// IsRoot tests if this node is the root node -- checks Parent = nil.
Expand Down

0 comments on commit a1093ed

Please sign in to comment.