wevm / wevm/prool

Remove Instance_ internal type

Open
#43 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
141
Forks
26
Avg merge
2d 6h
Merged PRs (30d)
6

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Instance_ and Instance type definitions and the pool.start(1) entry point. Compare the public return type with the runtime API, then resolve whether create should remain on the type, be disabled at runtime, or become static; done means the example assigns successfully without exposing an unusable create method.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.