mirror of
https://github.com/spacebarchat/server.git
synced 2026-03-30 16:05:41 +00:00
Remove array global pollution
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -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(),
|
||||
|
||||
@@ -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", () => {
|
||||
//
|
||||
});
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user