Added strict type checking to the project. (#236)

* Implement strict typing (WIP).

* changes

* Finish type checks

* Fix notification icon, matugen settings and update tsconfig.

* OSD Styling updates and added the ability to configure OSD duration.
This commit is contained in:
Jas Singh
2024-09-09 00:44:51 -07:00
committed by GitHub
parent 41dbc3829a
commit bb3b3dfdfb
56 changed files with 468 additions and 240 deletions

View File

@@ -69,7 +69,6 @@ export const pollVariableBash = <T>(
});
};
// Set up the interval initially with the provided polling interval
Utils.merge([pollingInterval, ...trackers], (pollIntrvl: number) => {
intervalFn(pollIntrvl);
});

View File

@@ -1,8 +1,6 @@
// @ts-expect-error
import GTop from 'gi://GTop';
const defaultCpuData: number = 0;
let previousCpuData = new GTop.glibtop_cpu();
GTop.glibtop_get_cpu(previousCpuData);

View File

@@ -1,8 +1,5 @@
import options from "options";
// @ts-expect-error
import GTop from 'gi://GTop';
// Module initializer
import { module } from "../module"

View File

@@ -1,4 +1,4 @@
import { HyprctlDeviceLayout, HyprctlKeyboard, KbLabelType } from "lib/types/customModules/kbLayout";
import { HyprctlDeviceLayout, HyprctlKeyboard, KbLabelType, LayoutKeys, LayoutValues } from "lib/types/customModules/kbLayout";
import { layoutMap } from "./layouts";
export const getKeyboardLayout = (obj: string, format: KbLabelType) => {
@@ -15,7 +15,8 @@ export const getKeyboardLayout = (obj: string, format: KbLabelType) => {
mainKb = keyboards[keyboards.length - 1];
}
let layout = mainKb['active_keymap'];
let layout: LayoutKeys = mainKb['active_keymap'] as LayoutKeys;
const foundLayout: LayoutValues = layoutMap[layout];
return format === "code" ? layoutMap[layout] || layout : layout;
return format === "code" ? foundLayout || layout : layout;
}

View File

@@ -581,4 +581,4 @@ export const layoutMap = {
"Wolof": "SN",
"Yakut": "RU (Sah)",
"Yoruba": "NG (Yoruba)"
};
} as const;

View File

@@ -1,4 +1,5 @@
import { Module } from "lib/types/bar";
import { BarButtonStyles } from "lib/types/options";
import options from "options";
import Gtk from "types/@girs/gtk-3.0/gtk-3.0";
import { Binding } from "types/service";
@@ -40,7 +41,7 @@ export const module = ({
return {
component: Widget.Box({
className: Utils.merge([style.bind("value"), showLabelBinding], (style: string, shwLabel: boolean) => {
className: Utils.merge([style.bind("value"), showLabelBinding], (style: BarButtonStyles, shwLabel: boolean) => {
const shouldShowLabel = shwLabel || showLabel;
const styleMap = {
default: "style1",

View File

@@ -1,5 +1,6 @@
import { ResourceLabelType } from 'lib/types/bar';
import { GenericResourceData } from 'lib/types/customModules/generic';
import { InputHandlerEvents } from 'lib/types/customModules/utils';
import { Binding } from 'lib/utils';
import { openMenu } from 'modules/bar/utils';
import options from 'options';
@@ -75,7 +76,7 @@ export const inputHandler = (
onMiddleClick,
onScrollUp,
onScrollDown,
}
}: InputHandlerEvents
) => {
const sanitizeInput = (input: VariableType<string>): string => {
if (input === undefined) {