Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Declare option fields as optional instead of wrapping the types in `Partial`

Open Beginner friendly
#1,531 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
77/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
docker, node.js, typescript
Domain
backend, testing

Research direction

Read the option declarations and method signatures in packages/testcontainers/src/types.ts, packages/testcontainers/src/compose-runtime/clients/compose/types.ts, and packages/testcontainers/src/testcontainers.ts. Also compare the public and client ExecOptions types, including the client’s log field. Done means option fields document their defaults as optional, methods accept those types directly, and the affected callers and types remain consistent.

Written by the indexing model from the issue text.

Description

enhancement minor

What happens

Option types are declared with every field required, and each method then accepts Partial<...> and fills in defaults:

  • StopOptions in stop(options?: Partial<StopOptions>)
  • RestartOptions in restart(options?: Partial<RestartOptions>)
  • ExecOptions in exec(command, opts?: Partial<ExecOptions>)
  • ComposeDownOptions in down(options?: Partial<ComposeDownOptions>)

The exported type does not describe what a caller may pass, and a helper typed as StopOptions has to supply every field. The defaults (timeout: 0, remove, removeVolumes: true) are not visible in the type or in JSDoc.

There are also two ExecOptions types: the public one in types.ts and the container client's one in container-runtime/clients/container/types.ts, which adds log.

Expected

Option types declare optional fields as optional, with the default documented on each field, and methods accept the type directly.

Where

  • packages/testcontainers/src/test-container.ts
  • packages/testcontainers/src/types.ts
  • packages/testcontainers/src/container-runtime/clients/compose/types.ts

Notes

  • Loosening the field types is compatible for callers. Code that reads a StopOptions value and relies on the fields being required would need a change.

Dependencies

  • Nothing blocks this. It can start now.
Dominant language
TypeScript
Stars
2.6k
Forks
274
Avg merge
1d 14h
Merged PRs (30d)
44

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

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.

More from testcontainers/testcontainers-node

All issues in testcontainers/testcontainers-node

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.