Skip to content
New issue

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

Consider using an overridable Services interface #125

Open
nfroidure opened this issue Aug 13, 2023 · 0 comments
Open

Consider using an overridable Services interface #125

nfroidure opened this issue Aug 13, 2023 · 0 comments
Assignees
Milestone

Comments

@nfroidure
Copy link
Owner

nfroidure commented Aug 13, 2023

In order to allow users to override it and get auto-completion for services injections, a global Services interface mapping to all services types could be useful.

It would give something like services.d.ts in the root of projects sources:

import type { BaseServices } from 'knifecycle'; // For injector/instance etc...

declare module 'knifecycle' {
  // Eventually override the process env type here
  export interface Services
    extends Services {
      pg: PGService;
      log: LogService;
      // ...
  }

Maybe that using this could help: https://www.typescriptlang.org/docs/handbook/declaration-merging.html

@nfroidure nfroidure self-assigned this Aug 13, 2023
@nfroidure nfroidure modified the milestones: 16.0.0, 17.0.0 Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant