You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: tsgen.go
    path of file: ./repos/storj/private/apigen
    
    the code of the file until where you have to start completion: // Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.

package apigen

import (
	"fmt"
	"os"
	"path/filepath"
	"reflect"
	"strings"

	"github.com/zeebo/errs"
)

// MustWriteTS writes generated TypeScript code into a file
    
func (f *tsGenFile) generateTS() {
	f.pf("// AUTOGENERATED BY private/apigen")
	f.pf("// DO NOT EDIT.")
	f.pf("")
	f.pf("import { HttpClient } from '@/utils/httpClient';")

	f.registerTypes()
	f.result += f.types.GenerateTypescriptDefinitions()

	f.result += `
class APIError extends Error {
	constructor(
		public readonly msg: string,
		public readonly responseStatusCode?: number,
	) {
		super(msg);
	}
}
`

	for _, group := range f.api.EndpointGroups {
		f.createAPIClient(group)
	}
}