Typescript baseUrl causing issues

Im my project the Angular template uses "baseUrl": "./src", in the tsconfig.json.

This hasn’t been a problem but I just updated my typescript DTO and it couldn’t find the class definitions for Cookie, NameValueCollection and Uri. It seems the baseUrl has to be set to "./" for it to find these definitions.

Changing baseUrl to / will mean updating every reference in app which will make merging from upstream repo quite arduous.

Is there a better solution?

I can manually add a reference for cookie after each update:

import { Cookie } from "../../../node_modules/@servicestack/client";

But I am not sure where Uri or NameValueCollection are defined so can’t get this to work. Adding in the imports manually after each update is not ideal either tbh but the easier of the 2 options.

Am I missing something? Is there a better solution that lets me keep baseUrl and read the DTO classes?

Check out the angular-cli project template for a working configuration of using @servicestack/cli with Angular JS.

The way to reference packages is to just use the module name, i.e. @servicestack/client.

If you modify any of the defaults you’ll need to ask the Angular project (or StackOverflow) for support for what’s possible or how to resolve any resolution issues.

BTW don’t leak .NET specific Uri or NameValueCollection in your DTOs, you should only expose common data types like string or Dictionary<string,string> otherwise they wont be interoperable with non .NET languages.

Ahh, my bad. It was leaking because of one of my endpoints.