I have multiple Ionic mobile apps that I have backend services written with ServiceStack. The apps are using TypeScript and I am very interested in generating a strongly typed API definition as described here, however the projects have nothing to do with Visual Studio and the Add TypeScript Reference functionality.
Can you suggest a method whereby a dtos.ts file can be generated such that I can include in the VS Code projects?
I am in a similar situation in VS Code, I have used ssutil.exe to create the Typescript file, however it has included types such as IRequest and IResponse which reference unknown types such as Cookie and Uri:
However invoking ssutil.exe again just re-writes this file, calling it with just the filename as suggested by Git repo to update the file with the appropriate settings tells me *.ts is not a valid extension:
ssutil src\app\services\dtos.ts --lang=typescript
Failed to complete operation. Update file path provided does not have a valid ServiceStack reference extension.
What is the recommended way of resolving this? I know I can start a simple Visual Studio project and do the same to get the right files, but I would like this file to get updated on the build server against the running API to catch any breaking changes at compile time.
Also I have operations such as this, which return a HttpResult due to only needing to provide a StatusCode, this results in HttpResult being created in the dtos.ts file - I would rather represent the result with StatusCode than adding a ResponseDto with the appropriate flags.
public HttpResult Delete(DeleteBankAccountRequest request)
var bankAccount = BankAccountRepository.GetById(request.BankAccountId);
if (bankAccount == null || bankAccount.OrganisationId != this.OrganisationId)
return new HttpResult(HttpStatusCode.NotFound);
return new HttpResult(HttpStatusCode.OK);
You should never have HttpResult in IReturn Interface markers, they’re a server-side decorator to add additional metadata like Headers to the Response. Only the Response DTO Type returned in the HTTP Response should be in IReturn markers.