Check out these examples of different DefaultTypes
imports that are currently popular:
Additionally, I've added support for the concise Symbol:module
import. Here is an example of the output:
import { Symbol } from "module";
This enhancement is included in version v5.4.1, now accessible via MyGet.
If you are experiencing issues, I suggest updating the tools you use to fetch dtos to the latest version.
npm tools
To upgrade using @servicestack/cli npm tooling, uninstall and reinstall as follows:
$ npm uninstall @servicestack/cli
$ npm i -g @servicestack/cli
Ensure you are using at least v1.0.7 by checking the version:
$ typescript-ref -v
Version: 1.0.7
To update any *dtos.ts
in your directory, run the tool without arguments:
$ typescript-ref
Testing with DTOs (using latest ServiceStack v5.4.1 on MyGet) is successful with the new Symbol:Module
syntax:
/* Options:
...
DefaultImports: Zip:./ZipCodeValidator
*/
This generates the expected import:
import { Zip } from "./ZipCodeValidator";
The import you're trying also works:
/* Options:
...
DefaultImports: * as Zip from './ZipCodeValidator'
*/
Which generates the expected:
import * as Zip from './ZipCodeValidator';
If the issue persists, consider upgrading the ServiceStack version of the API you're generating DTOs from.
Ensure tool functionality by generating DTOs from , which uses the latest version of ServiceStack:
$ typescript-ref https://techstacks.io
dotnet tools
Alternatively, use the @servicestack/cli
npm tool or the web or app tool with these steps:
$ dotnet tool install -g web
Update it with:
$ dotnet tool update -g web
Check if you're using the latest 0.0.16
version:
$ web -v
Version: 0.0.16
Substitute web ts
for typescript-ref
(or ts-ref
) npm tools, e.g. to install DTOs:
$ web ts https://techstacks.io
To update DTOs:
$ web ts