File tree 6 files changed +685
-280
lines changed
6 files changed +685
-280
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ func New(serverURL *url.URL) *Client {
26
26
}
27
27
28
28
// Client is an HTTP caller for methods to the Coder API.
29
+ // @typescript-ignore Client
29
30
type Client struct {
30
31
HTTPClient * http.Client
31
32
SessionToken string
@@ -113,6 +114,7 @@ func readBodyAsError(res *http.Response) error {
113
114
}
114
115
115
116
// Error represents an unaccepted or invalid request to the API.
117
+ // @typescript-ignore Error
116
118
type Error struct {
117
119
httpapi.Response
118
120
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ require (
109
109
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
110
110
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
111
111
golang.org/x/text v0.3.7
112
+ golang.org/x/tools v0.1.10
112
113
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f
113
114
google.golang.org/api v0.75.0
114
115
google.golang.org/protobuf v1.28.0
Original file line number Diff line number Diff line change @@ -2287,6 +2287,7 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
2287
2287
golang.org/x/tools v0.1.5 /go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk =
2288
2288
golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2 /go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk =
2289
2289
golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20 =
2290
+ golang.org/x/tools v0.1.10 /go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E =
2290
2291
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373 /go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0 =
2291
2292
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522 /go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0 =
2292
2293
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 /go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0 =
Original file line number Diff line number Diff line change
1
+ # APITypings
2
+
3
+ This main.go generates typescript types from the codersdk types in Go.
4
+
5
+ # Features
6
+
7
+ - Supports Go types
8
+ - [x] Basics (string/int/etc)
9
+ - [x] Maps
10
+ - [x] Slices
11
+ - [x] Enums
12
+ - [x] Pointers
13
+ - [ ] External Types (uses ` any ` atm)
14
+ - Some custom external types are hardcoded in (eg: time.Time)
15
+
16
+
17
+ ## Type overrides
18
+
19
+ ``` golang
20
+ type Foo struct {
21
+ // Force the typescript type to be a number
22
+ CreatedAt time.Duration ` json:"created_at" typescript:"number"`
23
+ }
24
+ ```
25
+
26
+ ## Ignore Types
27
+
28
+ Do not generate ignored types.
29
+
30
+ ``` golang
31
+ // @typescript-ignore InternalType
32
+ type InternalType struct {
33
+ // ...
34
+ }
35
+ ```
36
+
37
+ # Future Ideas
38
+
39
+ - Should ` omitempty ` in the ` json ` tag indicate optional?
40
+ - Use a yaml config for overriding certain types
You can’t perform that action at this time.
0 commit comments