Skip to content

Commit

Permalink
Merge pull request #63 from gzuidhof/map-rune-to-number
Browse files Browse the repository at this point in the history
Map rune to number
  • Loading branch information
gzuidhof authored Jul 20, 2024
2 parents 1295fc3 + fec722f commit 2986c9a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions examples/rune/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Code generated by tygo. DO NOT EDIT.

//////////
// source: rune.go

/**
* Should be a number in TypeScript.
*/
export type MyRune = number /* rune */;
4 changes: 4 additions & 0 deletions examples/rune/rune.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package rune

// Should be a number in TypeScript.
type MyRune rune
1 change: 1 addition & 0 deletions tygo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ packages:
- path: "github.com/gzuidhof/tygo/examples/emit"
exclude_files:
- "excluded.go"
- path: "github.com/gzuidhof/tygo/examples/rune"


3 changes: 2 additions & 1 deletion tygo/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func getIdent(s string) string {
case "int", "int8", "int16", "int32", "int64",
"uint", "uint8", "uint16", "uint32", "uint64",
"float32", "float64",
"complex64", "complex128":
"complex64", "complex128",
"rune":
return "number /* " + s + " */"
}
return s
Expand Down

0 comments on commit 2986c9a

Please sign in to comment.