Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Do not add ? to export type
  • Loading branch information
Emyrk committed Oct 20, 2022
commit daa5eec261c6c926f7e17d08cf9f97d6b92ce4f6
5 changes: 2 additions & 3 deletions scripts/apitypings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,11 @@ func (g *Generator) buildUnion(obj types.Object, st *types.Union) (string, error
optional = optional || scriptType.Optional
}

qMark := ""
if optional {
qMark = "?"
allTypes = append(allTypes, "null")
}

s.WriteString(fmt.Sprintf("export type %s%s = %s\n", obj.Name(), qMark, strings.Join(allTypes, " | ")))
s.WriteString(fmt.Sprintf("export type %s = %s\n", obj.Name(), strings.Join(allTypes, " | ")))

return s.String(), nil
}
Expand Down