Skip to content

fix: make language parameter optional in FormattedString.pre#56

Merged
KnightNiwrem merged 1 commit into
grammyjs:masterfrom
p0we7:fix/optional-language-param-in-pre
Feb 6, 2026
Merged

fix: make language parameter optional in FormattedString.pre#56
KnightNiwrem merged 1 commit into
grammyjs:masterfrom
p0we7:fix/optional-language-param-in-pre

Conversation

@p0we7
Copy link
Copy Markdown
Contributor

@p0we7 p0we7 commented Feb 6, 2026

Summary

The pre() function in entity-tag.ts accepts an optional language parameter (language?: string), but the FormattedString.pre static and instance methods in format.ts require it as mandatory (language: string). This inconsistency causes TypeScript compilation errors when calling FormattedString.pre(text) without specifying a language.

Changes

  • Make language parameter optional in FormattedString.pre static method (format.ts:355)
  • Make language parameter optional in FormattedString.pre instance method (format.ts:662)

Both now match the signature of the underlying pre() entity tag function in entity-tag.ts:95.

The `pre` function in entity-tag.ts accepts an optional language
parameter, but the static and instance methods on FormattedString
require it. This inconsistency causes TypeScript errors when
calling FormattedString.pre(text) without a language argument.

Add the optional modifier to both method signatures to match
the underlying entity tag function.
@p0we7
Copy link
Copy Markdown
Contributor Author

p0we7 commented Feb 6, 2026

Do i need to bump a version to 2.2.1 ?

@KnightNiwrem
Copy link
Copy Markdown
Collaborator

Do i need to bump a version to 2.2.1 ?

No need

@KnightNiwrem KnightNiwrem merged commit 1d4348b into grammyjs:master Feb 6, 2026
4 checks passed
@KnightNiwrem
Copy link
Copy Markdown
Collaborator

Thanks for the PQ!

@p0we7 p0we7 deleted the fix/optional-language-param-in-pre branch February 6, 2026 17:43
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.

2 participants