Merge pull request #201 from element-hq/t3chguy-patch-2

Specify ThisType on i18nApi
This commit is contained in:
Michael Telatynski
2026-02-20 12:48:01 +00:00
committed by GitHub
3 changed files with 8 additions and 7 deletions
@@ -174,10 +174,10 @@ export interface ExtrasApi {
// @public // @public
export interface I18nApi { export interface I18nApi {
humanizeTime(timeMillis: number): string; humanizeTime(this: void, timeMillis: number): string;
get language(): string; get language(): string;
register(translations: Partial<Translations>): void; register(this: void, translations: Partial<Translations>): void;
translate(key: keyof Translations, variables?: Variables): string; translate(this: void, key: keyof Translations, variables?: Variables): string;
} }
// @alpha @deprecated (undocumented) // @alpha @deprecated (undocumented)
@@ -445,3 +445,4 @@ export interface WidgetVariablesCustomisations {
// (No @packageDocumentation comment for this package) // (No @packageDocumentation comment for this package)
``` ```
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@element-hq/element-web-module-api", "name": "@element-hq/element-web-module-api",
"type": "module", "type": "module",
"version": "1.9.0", "version": "1.9.1",
"description": "Module API surface for element-web", "description": "Module API surface for element-web",
"repository": { "repository": {
"type": "git", "type": "git",
@@ -41,19 +41,19 @@ export interface I18nApi {
/** /**
* Register translations for the module, may override app's existing translations * Register translations for the module, may override app's existing translations
*/ */
register(translations: Partial<Translations>): void; register(this: void, translations: Partial<Translations>): void;
/** /**
* Perform a translation, with optional variables * Perform a translation, with optional variables
* @param key - The key to translate * @param key - The key to translate
* @param variables - Optional variables to interpolate into the translation * @param variables - Optional variables to interpolate into the translation
*/ */
translate(key: keyof Translations, variables?: Variables): string; translate(this: void, key: keyof Translations, variables?: Variables): string;
/** /**
* Convert a timestamp into a translated, human-readable time, * Convert a timestamp into a translated, human-readable time,
* using the current system time as a reference, eg. "5 minutes ago". * using the current system time as a reference, eg. "5 minutes ago".
* @param timeMillis - The time in milliseconds since epoch * @param timeMillis - The time in milliseconds since epoch
*/ */
humanizeTime(timeMillis: number): string; humanizeTime(this: void, timeMillis: number): string;
} }