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

Remove Instance_ internal type #43

Open
klntsky opened this issue Mar 5, 2025 · 0 comments
Open

Remove Instance_ internal type #43

klntsky opened this issue Mar 5, 2025 · 0 comments

Comments

@klntsky
Copy link

klntsky commented Mar 5, 2025

I can't type my code properly:

import { definePool, Pool, Instance } from 'prool';
...
  let instance: Instance;
  instance = await pool.start(1);
Type 'Instance_' is not assignable to type 'Instance'.
  Property 'create' is missing in type 'Instance_' but required in type '{ _internal: object | undefined; create(parameters?: { port?: number | undefined; } | undefined): Omit<Instance<object | undefined>, "create">; host: string; ... 6 more ...; stop(): Promise<...>; }'.

That's because

type Instance_ = Omit<Instance, 'create'>

Proposed solution: do not use Instance_, make create disabled at runtime instead of removing it on the type level. Alternatively, make it a static method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant