Skip to content

types: add missing encryption option to ServerOptions - #1512

Open
AnonymoDGH wants to merge 2 commits into
PrismarineJS:masterfrom
AnonymoDGH:fix/server-options-encryption-type
Open

types: add missing encryption option to ServerOptions#1512
AnonymoDGH wants to merge 2 commits into
PrismarineJS:masterfrom
AnonymoDGH:fix/server-options-encryption-type

Conversation

@AnonymoDGH

Copy link
Copy Markdown

Fixes #1503

Problem

The README's "Hello World server example" passes encryption: true to mc.createServer(...), and the option is used in several examples (examples/server_world, examples/server_channel, examples/server_custom_channel) and documented in HISTORY.md (renamed from encryption-enabled to encryption). However, encryption was missing from the ServerOptions interface in src/index.d.ts, so TypeScript users got an "Object literal may only specify known properties" error when following the documented example.

Fix

Added the missing optional encryption?: boolean property to ServerOptions:

export interface ServerOptions {
    ...
    'online-mode'?: boolean
    /** Whether to enable encryption (handshake + encrypted transport). Used together with online-mode. */
    encryption?: boolean
    ...
}

Verified

  • tsc --noEmit --skipLibCheck src/index.d.ts passes with the change.
  • The property matches the documented README example and the existing examples that pass encryption to createServer.

@AnonymoDGH

Copy link
Copy Markdown
Author

CI note: the single test (1.21.5) failure is a transient network error in the before all hook (FetchError: request to https://launchermeta.mojang.com/mc/game/version_manifest.json failed) — 227 tests passed and the failure occurs before any test logic runs. It is unrelated to this change, which only adds a property to src/index.d.ts (no runtime code). Pushed an empty commit to re-trigger CI.

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

Successfully merging this pull request may close these issues.

Missing type hint for ServerOptions encryption

1 participant