Skip to content

Commit cf7a1d4

Browse files
committed
ignore some types to cleanup typescript generated
1 parent ffb67a7 commit cf7a1d4

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

types/parameter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"github.com/zclconf/go-cty/cty"
1212
)
1313

14+
// @typescript-ignore BlockTypeParameter
15+
// @typescript-ignore BlockTypeWorkspaceTag
1416
const (
1517
BlockTypeParameter = "coder_parameter"
1618
BlockTypeWorkspaceTag = "coder_workspace_tag"

types/tags.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/coder/preview/hclext"
77
)
88

9+
// @typescript-ignore TagBlocks
910
type TagBlocks []TagBlock
1011

1112
func (b TagBlocks) ValidTags() map[string]string {
@@ -26,6 +27,7 @@ func (b TagBlocks) InvalidTags() Tags {
2627
return tags
2728
}
2829

30+
// @typescript-ignore TagBlock
2931
type TagBlock struct {
3032
Tags Tags
3133
Block *terraform.Block
@@ -56,6 +58,7 @@ func (b TagBlock) ValidTags() map[string]string {
5658
return tags
5759
}
5860

61+
// @typescript-ignore Tags
5962
type Tags []Tag
6063

6164
func (t Tags) SafeNames() []string {
@@ -66,6 +69,7 @@ func (t Tags) SafeNames() []string {
6669
return names
6770
}
6871

72+
// @typescript-ignore Tag
6973
type Tag struct {
7074
Key HCLString
7175
Value HCLString

types/value.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/zclconf/go-cty/cty"
99
)
1010

11+
// @typescript-ignore HCLString
1112
type HCLString struct {
1213
Value cty.Value
1314

web/genweb/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ func main() {
2222
}
2323

2424
generateDirectories := map[string]string{
25-
"github.com/coder/preview/web": "",
25+
"github.com/coder/preview/web": "",
26+
"github.com/coder/preview/types": "",
2627
}
2728
for dir, prefix := range generateDirectories {
2829
err = gen.IncludeGenerateWithPrefix(dir, prefix)
@@ -31,9 +32,7 @@ func main() {
3132
}
3233
}
3334

34-
referencePackages := map[string]string{
35-
"github.com/coder/preview/types": "",
36-
}
35+
referencePackages := map[string]string{}
3736
for pkg, prefix := range referencePackages {
3837
err = gen.IncludeReference(pkg, prefix)
3938
if err != nil {

web/session.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type Response struct {
2222
// TODO: Workspace tags
2323
}
2424

25+
// @typescript-ignore Session
2526
type Session struct {
2627
logger slog.Logger
2728
dir fs.FS

web/typescripttypes/preview.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export interface ParameterOption {
2929
}
3030

3131
// From types/enum.go
32-
export type ParameterType = string;
32+
export type ParameterType = "boolean" | "list(string)" | "number" | "string";
33+
34+
export const ParameterTypes: ParameterType[] = ["boolean", "list(string)", "number", "string"];
3335

3436
// From types/parameter.go
3537
export interface ParameterValidation {
@@ -68,7 +70,3 @@ export interface RichParameter {
6870
readonly ephemeral: boolean;
6971
}
7072

71-
// From web/session.go
72-
export interface Session {
73-
}
74-

0 commit comments

Comments
 (0)