Skip to content

Commit

Permalink
Map bytes to string
Browse files Browse the repository at this point in the history
  • Loading branch information
spinillos committed Dec 15, 2022
1 parent c39ec1b commit 447a2f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,8 @@ func tsprintField(v cue.Value, isType bool) (ts.Expr, error) {
fallthrough
case cue.TopKind:
return tsprintType(ik), nil
case cue.BytesKind:
return tsprintType(cue.StringKind), nil
}

// Having more than one possible kind entails a disjunction, TopKind, or
Expand Down
12 changes: 12 additions & 0 deletions testdata/bytes_to_string.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- one.cue --
package cuetsy

ByteToString: {
value: bytes
} @cuetsy(kind="interface")

-- out/gen --

export interface ByteToString {
value: string;
}

0 comments on commit 447a2f8

Please sign in to comment.