As it turned out it was so easy! )
@Injectable({
providedIn: 'root'
})
export class JsonPlaceholderService implements BaseDataService {
get(): Observable<any> {};
}
@Injectable({
providedIn: 'root',
useClass: JsonPlaceholderService
})
export class BaseDataService implements IDataService {
get(): Observable<any> {
throw new Error('Method not implemented.');
}
}
export interface IDataService {
get(): Observable<any>;
}
And then we can use it as a dependency in a @Component()
#jsonPlaceholderService = inject(BaseDataService);
No providers array in a @Component or AppConfig. So this way, our dependency is tree-shakable.