fix TS errors

This commit is contained in:
MathMan05 2024-09-19 14:53:54 -05:00
parent 4e0fa3fdbb
commit 6a7a7a15e4
9 changed files with 20 additions and 16 deletions

View file

@ -248,6 +248,7 @@ class Channel extends SnowFlake{
}
}
return undefined;
},
async (id: string): Promise<HTMLElement>=>{
//await new Promise(_=>{setTimeout(_,Math.random()*10)})
@ -367,7 +368,7 @@ class Channel extends SnowFlake{
return(
Boolean(this.lastmessageid) &&
(!this.lastreadmessageid ||
SnowFlake.stringToUnixTime(this.lastmessageid) >
SnowFlake.stringToUnixTime(this.lastmessageid as string) >
SnowFlake.stringToUnixTime(this.lastreadmessageid)) &&
this.type !== 4
);
@ -504,7 +505,7 @@ class Channel extends SnowFlake{
decdiv.classList.add("channeleffects");
decdiv.classList.add("channel");
Channel.contextmenu.bindContextmenu(decdiv, this);
Channel.contextmenu.bindContextmenu(decdiv, this,undefined);
// @ts-ignore I dont wanna deal with this
decdiv.all = this;
@ -540,7 +541,7 @@ class Channel extends SnowFlake{
if(this.hasunreads){
div.classList.add("cunread");
}
Channel.contextmenu.bindContextmenu(div, this);
Channel.contextmenu.bindContextmenu(div, this,undefined);
if(admin){
this.coatDropDiv(div);
}
@ -576,7 +577,7 @@ class Channel extends SnowFlake{
if(this.html){
return this.html.deref();
}else{
return;
}
}
readbottom(){
@ -781,7 +782,7 @@ class Channel extends SnowFlake{
}
}
async getmessage(id: string): Promise<Message>{
console.log("getting:"+id)
console.log("getting:"+id);
const message = this.messages.get(id);
if(message){
return message;

View file

@ -150,7 +150,7 @@ class Group extends Channel{
}
createguildHTML(){
const div = document.createElement("div");
Group.contextmenu.bindContextmenu(div, this);
Group.contextmenu.bindContextmenu(div, this,undefined);
this.html = new WeakRef(div);
div.classList.add("channeleffects");
const myhtml = document.createElement("span");

View file

@ -17,6 +17,8 @@ class Emoji{
get guild(){
if(this.owner instanceof Guild){
return this.owner;
}else{
return undefined;
}
}
get localuser(){
@ -121,6 +123,7 @@ class Emoji{
return e.arrayBuffer();
})
.then(e=>{
console.log(e);
Emoji.decodeEmojiList(e);
});
}

View file

@ -72,7 +72,7 @@ class Guild extends SnowFlake{
Guild.contextmenu.addbutton(
"Create invite",
(this: Guild)=>{},
function(this: Guild){},
null,
_=>true,
_=>false
@ -377,7 +377,7 @@ class Guild extends SnowFlake{
guild.loadGuild();
guild.loadChannel();
};
Guild.contextmenu.bindContextmenu(img, guild);
Guild.contextmenu.bindContextmenu(img, guild,undefined);
}
}else{
const div = document.createElement("div");
@ -399,7 +399,7 @@ class Guild extends SnowFlake{
guild.loadGuild();
guild.loadChannel();
};
Guild.contextmenu.bindContextmenu(div, guild);
Guild.contextmenu.bindContextmenu(div, guild,undefined);
}
}
return divy;

View file

@ -1769,7 +1769,7 @@ class Localuser{
value.delete(thing);
continue;
}
func();
func(undefined);
value.delete(thing);
}
}

View file

@ -94,7 +94,7 @@ static async resolveMember(
const promise = new Promise<Member | undefined>(async res=>{
const membjson = await membpromise;
if(membjson === undefined){
return res();
return res(undefined);
}else{
const member = new Member(membjson, guild);
const map = guild.localuser.presences;

View file

@ -227,7 +227,7 @@ class Message extends SnowFlake{
}else if(userd instanceof Member){
return this.mentions.includes(userd.user);
}else{
return false;
}
}
getimages(){

View file

@ -140,7 +140,7 @@ class User extends SnowFlake{
});
this.contextmenu.addbutton(
"Kick member",
(this: User, member: Member | undefined)=>{
function(this: User, member: Member | undefined){
member?.kick();
},
null,
@ -158,7 +158,7 @@ class User extends SnowFlake{
);
this.contextmenu.addbutton(
"Ban member",
(this: User, member: Member | undefined)=>{
function(this: User, member: Member | undefined){
member?.ban();
},
null,

View file

@ -29,7 +29,7 @@
"useDefineForClassFields": true,
"resolvePackageJsonImports": true,
"skipLibCheck": true,
"outDir": "./dist",
"outDir": "./dist"
},
"include": [
"src/**/*.ts"
@ -37,4 +37,4 @@
"exclude": [
"node_modules"
]
}
}