From 03fe6ee4e4daabebf1bc18be544f482c2a91b0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Rom=C3=A1n?= Date: Mon, 5 Jul 2021 17:07:45 +0200 Subject: [PATCH] test(Types): add `notPropertyOf` type-only utility (#6051) --- typings/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/typings/index.ts b/typings/index.ts index 77e49f49d..16f179cf8 100644 --- a/typings/index.ts +++ b/typings/index.ts @@ -428,6 +428,7 @@ client.login('absolutely-valid-token'); // Test type transformation: declare const assertType: (value: T) => asserts value is T; declare const serialize: (value: T) => Serialized; +declare const notPropertyOf: (value: T, property: P & Exclude) => void; assertType(serialize(undefined)); assertType(serialize(null)); @@ -483,7 +484,8 @@ assertType(dmChannel.lastMessage); assertType(threadChannel.lastMessage); assertType(newsChannel.lastMessage); assertType(textChannel.lastMessage); -// @ts-expect-error -assertType(user.lastMessage); -// @ts-expect-error -assertType(guildMember.lastMessage); + +notPropertyOf(user, 'lastMessage'); +notPropertyOf(user, 'lastMessageId'); +notPropertyOf(guildMember, 'lastMessage'); +notPropertyOf(guildMember, 'lastMessageId');