Typescript-ref and similar class names, different namescape

We’ve started to run into issues with models sharing the same name, however in different namespaces, that then collide when running typescript-ref, leaving code with the following kinds of errors:

error TS2300: Duplicate identifier ‘Customer’.
error TS2449: Class ‘Customer’ used before its declaration.

namespace Project.A
{
    public class Customer { }
}

namespace Project.B
{
    public class Customer { }
}

Somewhere in the middle of plugging features in (same class name, different namespace), and typescript-ref parsing metadata of the API with multiple features plugged-in, the names collide and typescript is not happy.

Is it possible to keep track of the namespaces various classes are in, so that the same class name can be used, so long as it sits in a different namespace (as the c# spec)?

What is the best way to work around this?

Only .NET languages can differentiate using .NET namespaces, but DTOs need to be unique for Add ServiceStack Reference languages:
https://docs.servicestack.net/add-servicestack-reference#limitations

1 Like