From e5a0ff4aafe5d986467ec67a0ba672cd63a25efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20LES=C3=89N=C3=89CHAL?= Date: Tue, 30 Jan 2024 11:16:11 +0100 Subject: [PATCH] refactor(mw.Map): use generics Avoid passing types when using `mw.messages.exists()` and `mw.messages.set()` to prevent the error "An_instantiation_expression_cannot_be_followed_by_a_property_access" Copied from https://github.com/AnYiEE/types-mediawiki-renovate/commit/6df693ab18bb3008051dbbd1b49ca219683fdd0b by @AnYiEE --- mw/Map.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mw/Map.d.ts b/mw/Map.d.ts index a14e25f..adfb0c3 100644 --- a/mw/Map.d.ts +++ b/mw/Map.d.ts @@ -27,7 +27,7 @@ declare global { * @returns True if the key exists * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.Map-method-exists */ - exists(selection: keyof V): boolean; + exists(selection: S): selection is S; /** * Get the value of one or more keys. @@ -53,7 +53,7 @@ declare global { * @see https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.Map-method-set */ set(selection: S, value: V[S]): boolean; - set(selection: Partial): boolean; + set>(selection: S): boolean; } } }