fix typescript AGAIN, fix icons, ignore pnpm lock

This commit is contained in:
AAGaming
2022-05-28 20:54:25 -04:00
parent f882636be7
commit a5ac702820
5 changed files with 15 additions and 7 deletions

3
.gitignore vendored
View File

@@ -35,3 +35,6 @@ Thumbs.db
dist/
research/
# PNPM lockfile
pnpm-lock.yaml

5
globals.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
declare global {
interface Window {
SP_REACT: typeof React;
}
}

View File

@@ -12,5 +12,5 @@ import { IconsModule } from '../webpack';
// }
export const Spinner = Object.values(IconsModule).find((mod: any) =>
mod?.toString()?.includes("Spinner)}),a.createElement(\"path\",{d:\"M18 "),
mod?.toString && /Spinner\)}\),.\.createElement\(\"path\",{d:\"M18 /.test(mod.toString())
) as FC<{}>;

View File

@@ -58,14 +58,13 @@ export const CommonUIModule = allModules.find((m: Module) => {
return false;
});
export const IconsModule = allModules.find((m: Module) => {
if (typeof m !== "object") return undefined;
export const IconsModule = findModule((m: Module) => {
if (typeof m !== "object") return false;
for (let prop in m) {
if (m[prop]?.toString()?.includes("Spinner)}),a.createElement(\"path\",{d:\"M18 ")) return true;
if (m[prop]?.toString && /Spinner\)}\),.\.createElement\(\"path\",{d:\"M18 /.test(m[prop].toString())) return true;
}
return false;
})
export const Router = findModuleChild((m: Module) => {
if (typeof m !== "object") return undefined;
for (let prop in m) {

View File

@@ -3,7 +3,8 @@
"outDir": "dist",
"module": "ESNext",
"target": "ES2020",
"jsx": "react-jsx",
"jsx": "react",
"jsxFactory": "SP_REACT.createElement",
"declaration": true,
"moduleResolution": "node",
"noUnusedLocals": true,
@@ -17,6 +18,6 @@
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
},
"include": ["src"],
"include": ["src", "globals.d.ts"],
"exclude": ["node_modules"]
}