Skip to content

Commit

Permalink
Allow deeper extends
Browse files Browse the repository at this point in the history
  • Loading branch information
spinillos committed Jul 21, 2023
1 parent e5c32fb commit 1d2bf86
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ func findExtends(v cue.Value) ([]ts.Expr, cue.Value, error) {
// generated as literals.
baseNolit := v.Context().CompileString("")
nolit := v.Context().CompileString("")

var walkExpr func(v cue.Value) error
walkExpr = func(v cue.Value) error {
op, dvals := v.Expr()
Expand All @@ -600,6 +601,12 @@ func findExtends(v cue.Value) ([]ts.Expr, cue.Value, error) {
case cue.OrOp:
return valError(v, "typescript interfaces cannot be constructed from disjunctions")
case cue.SelectorOp:
deref := cue.Dereference(v)
_, dexpr := deref.Expr()
if dexpr[len(dexpr)-1].IncompleteKind() == cue.TopKind {
return walkExpr(deref)
}

expr, err := refAsInterface(v)
if err != nil {
return err
Expand Down

0 comments on commit 1d2bf86

Please sign in to comment.