Skip to content

Remove Instance_ internal type #43

Description

@klntsky

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions