Skip to content

fix: Use readonly type for languages array.#41

Open
sbaechler wants to merge 3 commits into
tinganho:masterfrom
sbaechler:types-readonly
Open

fix: Use readonly type for languages array.#41
sbaechler wants to merge 3 commits into
tinganho:masterfrom
sbaechler:types-readonly

Conversation

@sbaechler

@sbaechler sbaechler commented Sep 23, 2025

Copy link
Copy Markdown

Defining the array argument as readonly allows setting the language array as const.
Regular arrays are still allowed as languages param. The readonly is only applied to within the languages function.

Defining the language array as const makes typescript aware of the available languages.

Update: With the change from @MiroslavPetrik at least one language is enforced via the type system.

Fixes #40

Defining the array argument as readonly allows setting the language array as const.
Regular arrays are still allowed as `languages` param. The `readonly` is only applied to within the languages function.

Defining the language array as const makes typescript aware of the available languages.
Comment thread Library/Typings.d.ts Outdated

@MiroslavPetrik MiroslavPetrik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require 1 language

sbaechler and others added 2 commits September 29, 2025 21:25
Co-authored-by: MiroslavPetrik <miroslavpetrik@outlook.com>

@MiroslavPetrik MiroslavPetrik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Type error if languages is a readonly array.

2 participants