We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
I have a generic cache class (see below).
import { injectable } from 'tsyringe'; import { Cache } from '../contract/cache'; @injectable() export class CacheImpl<DataT> implements Cache<DataT> { private data = {} as Partial<DataT>; getValue<K extends keyof DataT>(key: K): DataT[K] { return this.data[key]; } setValue<K extends keyof DataT>(key: K, value: DataT[K]): void { this.data[key] = value; } }
Here is how I try to register it:
container.register<Cache<MyDto>>( TYPES.ModuleAccessDetailsCache, { useClass: CacheImpl<MyDto> }, { lifecycle: Lifecycle.Singleton } );
I get the following errors when I try to compile
Are generic types supported and how can I register them?
To Reproduce
Expected behavior The registration should be successful
Version:
The text was updated successfully, but these errors were encountered:
Xapphire13
No branches or pull requests
Describe the bug
I have a generic cache class (see below).
Here is how I try to register it:
I get the following errors when I try to compile
Are generic types supported and how can I register them?
To Reproduce
Expected behavior
The registration should be successful
Version:
The text was updated successfully, but these errors were encountered: