Make typescript happy, tsc test run in CI

This commit is contained in:
Vendicated 2022-10-09 22:58:08 +02:00
parent 5610df8b37
commit a89e17a390
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
11 changed files with 45 additions and 36 deletions

View file

@ -22,7 +22,7 @@ Object.defineProperty(window, "IS_WEB", {
enumerable: true
});
export let Components;
export let Components: any;
async function init() {
await onceReady;

View file

@ -67,7 +67,7 @@ type ClickListener = (message: Message, channel: Channel, event: MouseEvent) =>
const listeners = new Set<ClickListener>();
export function _handleClick(message, channel, event) {
export function _handleClick(message: Message, channel: Channel, event: MouseEvent) {
for (const listener of listeners) {
try {
listener(message, channel, event);

View file

@ -127,7 +127,7 @@ export default ErrorBoundary.wrap(function Settings() {
disabled={p.required || dependency}
key={p.name}
value={settings.plugins[p.name].enabled || p.required || dependency}
onChange={v => {
onChange={(v: boolean) => {
settings.plugins[p.name].enabled = v;
let needsRestart = Boolean(p.patches?.length);
if (v) {

2
src/globals.d.ts vendored
View file

@ -12,7 +12,7 @@ declare global {
push(chunk: any): any;
pop(): any;
};
[k: PropertyKey]: any;
[k: string]: any;
}
}

View file

@ -16,7 +16,7 @@ export default definePlugin({
},
],
rand(file) {
rand(file: string) {
const chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
const rand = Array.from(

View file

@ -1,5 +1,5 @@
export class ChangeList<T>{
private set = new Set<T>;
private set = new Set<T>();
public get changeCount() {
return this.set.size;

View file

@ -28,7 +28,7 @@ export function lazyWebpack<T = any>(filter: FilterFn): T {
construct: (_, args, newTarget) => Reflect.construct(getMod(), args, newTarget),
deleteProperty: (_, prop) => delete getMod()[prop],
defineProperty: (_, property, attributes) => !!Object.defineProperty(getMod(), property, attributes)
}) as T;
}) as any as T;
}
/**

View file

@ -12,7 +12,8 @@ export async function toggle(isEnabled: boolean) {
VencordNative.ipc.on(IpcEvents.QUICK_CSS_UPDATE, (_, css: string) => style.innerText = css);
style.innerText = await VencordNative.ipc.invoke(IpcEvents.GET_QUICK_CSS);
}
} else style.disabled = !isEnabled;
} else // @ts-ignore yes typescript, property 'disabled' does exist on type 'HTMLStyleElement' u should try reading the docs some time
style.disabled = !isEnabled;
}
document.addEventListener("DOMContentLoaded", () => {