-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from 0x-buidl/feat/interface_inheritance
feat: integrate interface inheritance
- Loading branch information
Showing
11 changed files
with
217 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
|
||
examples/time | ||
examples/tygo | ||
examples/http | ||
examples/http |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Code generated by tygo. DO NOT EDIT. | ||
import * as bookapp from "../bookstore" | ||
|
||
////////// | ||
// source: inheritance.go | ||
|
||
export interface Base { | ||
name: string; | ||
} | ||
export interface Base2<T extends string | number /* int */> { | ||
id: T; | ||
} | ||
export interface Base3<T extends string, X extends number /* int */> { | ||
class: T; | ||
level: X; | ||
} | ||
export interface Other<T extends number /* int */, X extends string> extends Base, Base2<T>, Base3<X, T>, bookapp.Book, bookapp.TextBook<T> { | ||
otherWithBase: Base; | ||
otherWithBase2: Base2<X>; | ||
otherValue: string; | ||
author: bookapp.AuthorWithInheritance<T>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package inheritance | ||
|
||
import bookapp "github.com/gzuidhof/tygo/examples/bookstore" | ||
|
||
type Base struct { | ||
Name string `json:"name"` | ||
} | ||
|
||
type Base2[T string | int] struct { | ||
ID T `json:"id"` | ||
} | ||
|
||
type Base3[T string, X int] struct { | ||
Class T `json:"class"` | ||
Level X `json:"level"` | ||
} | ||
|
||
type Other[T int, X string] struct { | ||
Base `tstype:",extends"` | ||
Base2[T] `tstype:",extends"` | ||
Base3[X, T] `tstype:",extends"` | ||
OtherWithBase Base ` json:"otherWithBase"` | ||
OtherWithBase2 Base2[X] ` json:"otherWithBase2"` | ||
OtherValue string ` json:"otherValue"` | ||
Author bookapp.AuthorWithInheritance[T] `tstype:"bookapp.AuthorWithInheritance<T>" json:"author"` | ||
bookapp.Book `tstype:",extends"` | ||
bookapp.TextBook[T] `tstype:",extends"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters