Remove array global pollution

This commit is contained in:
Rory&
2026-03-14 06:01:48 +01:00
parent f641215a0d
commit c8af1e125f
5 changed files with 3 additions and 21 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -197,7 +197,7 @@ export class Channel extends BaseClass {
skipEventEmit?: boolean;
skipNameChecks?: boolean;
},
) {
): Promise<Channel> {
if (!opts?.skipPermissionCheck) {
// Always check if user has permission first
const permissions = await getPermission(user_id, channel.guild_id);
@@ -281,7 +281,8 @@ export class Channel extends BaseClass {
// total_message_sent: 0,
};
const ret = Channel.create(channel);
// TODO: figure out why the generic is required here
const ret = Channel.create<Channel>(channel);
await Promise.all([
ret.save(),

View File

@@ -1,9 +0,0 @@
import moduleAlias from "module-alias";
moduleAlias();
import "./Array";
import { describe, it } from "node:test";
import assert from "node:assert/strict";
describe("Array extensions", () => {
//
});

View File

@@ -16,14 +16,6 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare global {
interface Array<T> {
/**
* @deprecated never use, idk why but I can't get rid of this without errors
*/
remove(h: T): never;
}
}
/* https://stackoverflow.com/a/50636286 */
export function arrayPartition<T>(array: T[], filter: (elem: T) => boolean): [T[], T[]] {
const pass: T[] = [],
@@ -38,5 +30,3 @@ export function arrayRemove<T>(array: T[], item: T): void {
array.splice(index, 1);
}
}
// register extensions