Is there any way to override the value of a type exported and used by a TypeScript package?
So I have this in my typings file:
// index.d.ts
declare module 'my-package' {
namespace DependencyInjection {
type ServiceID = 'myServiceOne' | 'myServiceTwo'; // original type is "any";
}
}
and I get the following the error:
Duplicate identifier 'ServiceID'.ts(2300)
inject.ts(44, 10): 'ServiceID' was also declared here.
I'd like to be able to replace the type of ServiceID from the consuming code. Can it be done? I know interfaces can be extended but I haven't found a way to change or update a type.
Context
I'm writing a TypeScript package and I'd like users to be able to override some default types with their own when they integrate the package, rather than having to provide generics every time they use some methods.