Skip to content

Commit

Permalink
Disable skipLibCheck to allow d.ts file checks, simplify typings
Browse files Browse the repository at this point in the history
  • Loading branch information
TAEMBO committed Aug 13, 2024
1 parent 4397224 commit 6640143
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
12 changes: 1 addition & 11 deletions src/structures/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,9 @@ export class Command<
/** The amount of times this command has been used */
public uses = 0;

public constructor(commandData: (
{
readonly data: TBuilder;
run(interaction: TInteraction): Promise<any>;
} & (TCommand extends "chatInput"
? { autocomplete?: TAutocomplete }
: Record<string, any>
)
)) {
public constructor(commandData: Omit<Command<TCommand, TBuilder, TInteraction, TAutocomplete>, "uses">) {
this.autocomplete = commandData.autocomplete;
this.run = commandData.run;
this.data = commandData.data;

if (!this.autocomplete) delete this.autocomplete;
}
}
9 changes: 2 additions & 7 deletions src/structures/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@ export class Event<TEvent extends keyof ClientEvents> {
/** The function to be ran when this event is emitted */
public readonly run: (...args: ClientEvents[TEvent]) => Promise<any>;

public constructor(eventData: {
name: TEvent;
once?: boolean;
run: (...args: ClientEvents[TEvent]) => Promise<any>;
}) {
public constructor(eventData: Event<TEvent>) {
this.name = eventData.name;
this.once = eventData.once;
this.run = eventData.run;

if (eventData.once) this.once = eventData.once;
}
}
5 changes: 2 additions & 3 deletions src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ import type {
Collection,
MessageContextMenuCommandInteraction,
PresenceData,
SlashCommandBuilder,
SlashCommandOptionsOnlyBuilder,
SlashCommandSubcommandsOnlyBuilder,
Snowflake,
UserContextMenuCommandInteraction
} from "discord.js";
import type config from "#config";
import type TClient from "./client.js";
import { type PlayerUsed } from "farming-simulator-types/2022";
import type { Command, FSServers, RepeatedMessages } from "#structures";
import type { Command, RepeatedMessages } from "#structures";
import type {
BannedWords,
DailyMsgs,
FMList,
MCPlayerTimes,
PlayerTimes,
Punishments,
Reminders,
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"skipLibCheck": true,
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 6640143

Please sign in to comment.