From b47467755cb5d1dd779d79ad86eb678bb13541e9 Mon Sep 17 00:00:00 2001 From: Jeroen Claassens Date: Tue, 12 Oct 2021 19:38:12 +0200 Subject: [PATCH] fix(Types): export more types (#6808) --- typings/index.d.ts | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index 8e240cdfbe41..6ca1e7e65bb9 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -455,7 +455,7 @@ export abstract class Channel extends Base { public toString(): ChannelMention; } -type If = T extends true ? A : T extends false ? B : A | B; +export type If = T extends true ? A : T extends false ? B : A | B; export class Client extends BaseClient { public constructor(options: ClientOptions); @@ -1079,7 +1079,7 @@ export class Intents extends BitField { export type GuildCacheState = 'cached' | 'raw' | 'present'; -type CacheTypeReducer< +export type CacheTypeReducer< State extends GuildCacheState, CachedType, RawType = CachedType, @@ -1217,7 +1217,7 @@ export class LimitedCollection extends Collection { // This is a general conditional type utility that allows for specific union members to be extracted given // a tagged union. -type TaggedUnion = T extends Record +export type TaggedUnion = T extends Record ? T : T extends Record ? V extends U @@ -1226,28 +1226,27 @@ type TaggedUnion = T extends Record : never; // This creates a map of MessageComponentTypes to their respective `InteractionCollectorOptionsResolvable` variant. -type CollectorOptionsTypeResolver = { +export type CollectorOptionsTypeResolver = { readonly [T in U['componentType']]: TaggedUnion; }; // This basically says "Given a `InteractionCollectorOptionsResolvable` variant", I'll give the corresponding // `InteractionCollector` variant back. -type ConditionalInteractionCollectorType = +export type ConditionalInteractionCollectorType = T extends InteractionCollectorOptions ? InteractionCollector : InteractionCollector; // This maps each componentType key to each variant. -type MappedInteractionCollectorOptions = CollectorOptionsTypeResolver; +export type MappedInteractionCollectorOptions = CollectorOptionsTypeResolver; // Converts mapped types to complimentary collector types. -type InteractionCollectorReturnType = T extends - | MessageComponentType - | MessageComponentTypes - ? ConditionalInteractionCollectorType - : InteractionCollector; +export type InteractionCollectorReturnType = + T extends MessageComponentType | MessageComponentTypes + ? ConditionalInteractionCollectorType + : InteractionCollector; -type InteractionExtractor = T extends +export type InteractionExtractor = T extends | MessageComponentType | MessageComponentTypes ? MappedInteractionCollectorOptions[T] extends InteractionCollectorOptions @@ -1255,12 +1254,12 @@ type InteractionExtractor = +export type MessageCollectorOptionsParams = | { componentType?: T; } & MessageComponentCollectorOptions>; -type AwaitMessageCollectorOptionsParams = +export type AwaitMessageCollectorOptionsParams = | { componentType?: T } & Pick< InteractionCollectorOptions>, keyof AwaitMessageComponentOptions @@ -2347,9 +2346,9 @@ export class WelcomeScreen extends Base { //#region Constants -type EnumHolder = { [P in keyof T]: T[P] }; +export type EnumHolder = { [P in keyof T]: T[P] }; -type ExcludeEnum = Exclude; +export type ExcludeEnum = Exclude; export const Constants: { Package: { @@ -4282,7 +4281,7 @@ export interface InviteGenerationOptions { scopes: InviteScope[]; } -type GuildInvitableChannelResolvable = +export type GuildInvitableChannelResolvable = | TextChannel | VoiceChannel | NewsChannel