Make typescript happy, tsc test run in CI
This commit is contained in:
		
							parent
							
								
									5610df8b37
								
							
						
					
					
						commit
						a89e17a390
					
				
					 11 changed files with 45 additions and 36 deletions
				
			
		
							
								
								
									
										2
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
								
							|  | @ -24,4 +24,4 @@ jobs: | ||||||
|               run: pnpm install --frozen-lockfile |               run: pnpm install --frozen-lockfile | ||||||
| 
 | 
 | ||||||
|             - name: Lint & Test if it compiles |             - name: Lint & Test if it compiles | ||||||
|               run: pnpm lint && pnpm build |               run: pnpm test | ||||||
|  |  | ||||||
							
								
								
									
										54
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								package.json
									
									
									
									
									
								
							|  | @ -1,28 +1,30 @@ | ||||||
| { | { | ||||||
|     "devDependencies": { |   "scripts": { | ||||||
|         "@types/node": "^18.7.13", |     "build": "node build.mjs", | ||||||
|         "@types/react": "^18.0.17", |     "buildWeb": "node buildWeb.mjs", | ||||||
|         "@types/yazl": "^2.4.2", |     "inject": "node scripts/patcher/install.js", | ||||||
|         "@typescript-eslint/parser": "^5.39.0", |     "lint": "eslint . --ext .js,.jsx,.ts,.tsx", | ||||||
|         "electron": "^20.1.0", |     "lint:fix": "pnpm lint --fix", | ||||||
|         "esbuild": "^0.15.5", |     "test": "pnpm lint && pnpm build && pnpm testTsc", | ||||||
|         "eslint": "^8.24.0", |     "testTsc": "tsc --noEmit", | ||||||
|         "typescript": "^4.8.4", |     "uninject": "node scripts/patcher/uninstall.js", | ||||||
|         "yazl": "^2.5.1" |     "watch": "node build.mjs --watch" | ||||||
|     }, |   }, | ||||||
|     "dependencies": { |   "dependencies": { | ||||||
|         "console-menu": "^0.1.0", |     "console-menu": "^0.1.0", | ||||||
|         "discord-types": "^1.3.26", |     "electron-devtools-installer": "^3.2.0" | ||||||
|         "electron-devtools-installer": "^3.2.0" |   }, | ||||||
|     }, |   "devDependencies": { | ||||||
|     "scripts": { |     "@types/node": "^18.7.13", | ||||||
|         "buildWeb": "node buildWeb.mjs", |     "@types/react": "^18.0.17", | ||||||
|         "build": "node build.mjs", |     "@types/yazl": "^2.4.2", | ||||||
|         "watch": "node build.mjs --watch", |     "@typescript-eslint/parser": "^5.39.0", | ||||||
|         "inject": "node scripts/patcher/install.js", |     "discord-types": "^1.3.26", | ||||||
|         "uninject": "node scripts/patcher/uninstall.js", |     "electron": "^20.1.0", | ||||||
|         "lint": "eslint . --ext .js,.jsx,.ts,.tsx", |     "esbuild": "^0.15.5", | ||||||
|         "lint:fix": "pnpm lint --fix" |     "eslint": "^8.24.0", | ||||||
|     }, |     "typescript": "^4.8.4", | ||||||
|     "packageManager": "pnpm@7.12.2" |     "yazl": "^2.5.1" | ||||||
|  |   }, | ||||||
|  |   "packageManager": "pnpm@7.12.2" | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -22,7 +22,7 @@ Object.defineProperty(window, "IS_WEB", { | ||||||
|     enumerable: true |     enumerable: true | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| export let Components; | export let Components: any; | ||||||
| 
 | 
 | ||||||
| async function init() { | async function init() { | ||||||
|     await onceReady; |     await onceReady; | ||||||
|  |  | ||||||
|  | @ -67,7 +67,7 @@ type ClickListener = (message: Message, channel: Channel, event: MouseEvent) => | ||||||
| 
 | 
 | ||||||
| const listeners = new Set<ClickListener>(); | 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) { |     for (const listener of listeners) { | ||||||
|         try { |         try { | ||||||
|             listener(message, channel, event); |             listener(message, channel, event); | ||||||
|  |  | ||||||
|  | @ -127,7 +127,7 @@ export default ErrorBoundary.wrap(function Settings() { | ||||||
|                         disabled={p.required || dependency} |                         disabled={p.required || dependency} | ||||||
|                         key={p.name} |                         key={p.name} | ||||||
|                         value={settings.plugins[p.name].enabled || p.required || dependency} |                         value={settings.plugins[p.name].enabled || p.required || dependency} | ||||||
|                         onChange={v => { |                         onChange={(v: boolean) => { | ||||||
|                             settings.plugins[p.name].enabled = v; |                             settings.plugins[p.name].enabled = v; | ||||||
|                             let needsRestart = Boolean(p.patches?.length); |                             let needsRestart = Boolean(p.patches?.length); | ||||||
|                             if (v) { |                             if (v) { | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								src/globals.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								src/globals.d.ts
									
									
									
									
										vendored
									
									
								
							|  | @ -12,7 +12,7 @@ declare global { | ||||||
|             push(chunk: any): any; |             push(chunk: any): any; | ||||||
|             pop(): any; |             pop(): any; | ||||||
|         }; |         }; | ||||||
|         [k: PropertyKey]: any; |         [k: string]: any; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ export default definePlugin({ | ||||||
|         }, |         }, | ||||||
|     ], |     ], | ||||||
| 
 | 
 | ||||||
|     rand(file) { |     rand(file: string) { | ||||||
|         const chars = |         const chars = | ||||||
|             "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; |             "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | ||||||
|         const rand = Array.from( |         const rand = Array.from( | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| export class ChangeList<T>{ | export class ChangeList<T>{ | ||||||
|     private set = new Set<T>; |     private set = new Set<T>(); | ||||||
| 
 | 
 | ||||||
|     public get changeCount() { |     public get changeCount() { | ||||||
|         return this.set.size; |         return this.set.size; | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ export function lazyWebpack<T = any>(filter: FilterFn): T { | ||||||
|         construct: (_, args, newTarget) => Reflect.construct(getMod(), args, newTarget), |         construct: (_, args, newTarget) => Reflect.construct(getMod(), args, newTarget), | ||||||
|         deleteProperty: (_, prop) => delete getMod()[prop], |         deleteProperty: (_, prop) => delete getMod()[prop], | ||||||
|         defineProperty: (_, property, attributes) => !!Object.defineProperty(getMod(), property, attributes) |         defineProperty: (_, property, attributes) => !!Object.defineProperty(getMod(), property, attributes) | ||||||
|     }) as T; |     }) as any as T; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  |  | ||||||
|  | @ -12,7 +12,8 @@ export async function toggle(isEnabled: boolean) { | ||||||
|             VencordNative.ipc.on(IpcEvents.QUICK_CSS_UPDATE, (_, css: string) => style.innerText = css); |             VencordNative.ipc.on(IpcEvents.QUICK_CSS_UPDATE, (_, css: string) => style.innerText = css); | ||||||
|             style.innerText = await VencordNative.ipc.invoke(IpcEvents.GET_QUICK_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", () => { | document.addEventListener("DOMContentLoaded", () => { | ||||||
|  |  | ||||||
|  | @ -2,7 +2,13 @@ | ||||||
|     "compilerOptions": { |     "compilerOptions": { | ||||||
|         "allowSyntheticDefaultImports": true, |         "allowSyntheticDefaultImports": true, | ||||||
|         "esModuleInterop": true, |         "esModuleInterop": true, | ||||||
|         "lib": ["DOM", "esnext", "esnext.array", "esnext.asynciterable", "esnext.symbol"], |         "lib": [ | ||||||
|  |             "DOM", | ||||||
|  |             "esnext", | ||||||
|  |             "esnext.array", | ||||||
|  |             "esnext.asynciterable", | ||||||
|  |             "esnext.symbol" | ||||||
|  |         ], | ||||||
|         "module": "commonjs", |         "module": "commonjs", | ||||||
|         "moduleResolution": "node", |         "moduleResolution": "node", | ||||||
|         "strict": true, |         "strict": true, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue