Make tsc happier

This commit is contained in:
Michael Telatynski
2026-06-08 11:42:00 +01:00
parent 788c76d677
commit af74f511ed
9 changed files with 109 additions and 17 deletions
+7 -7
View File
@@ -32,28 +32,28 @@ describe("Image", () => {
describe("blobIsAnimated", () => {
it("Animated GIF", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.gif"))], {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.gif")).slice()], {
type: "image/gif",
});
expect(await blobIsAnimated(img)).toBeTruthy();
});
it("Static GIF", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.gif"))], {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.gif")).slice()], {
type: "image/gif",
});
expect(await blobIsAnimated(img)).toBeFalsy();
});
it("Animated WEBP", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.webp"))], {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.webp")).slice()], {
type: "image/webp",
});
expect(await blobIsAnimated(img)).toBeTruthy();
});
it("Static WEBP", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.webp"))], {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.webp")).slice()], {
type: "image/webp",
});
expect(await blobIsAnimated(img)).toBeFalsy();
@@ -61,14 +61,14 @@ describe("Image", () => {
it("Static WEBP in extended file format", async () => {
const img = new Blob(
[fs.readFileSync(path.resolve(__dirname, "images", "static-logo-extended-file-format.webp"))],
[fs.readFileSync(path.resolve(__dirname, "images", "static-logo-extended-file-format.webp")).slice()],
{ type: "image/webp" },
);
expect(await blobIsAnimated(img)).toBeFalsy();
});
it("Animated PNG", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.apng"))]);
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.apng")).slice()]);
const pngBlob = img.slice(0, img.size, "image/png");
const apngBlob = img.slice(0, img.size, "image/apng");
expect(await blobIsAnimated(pngBlob)).toBeTruthy();
@@ -76,7 +76,7 @@ describe("Image", () => {
});
it("Static PNG", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.png"))]);
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.png")).slice()]);
const pngBlob = img.slice(0, img.size, "image/png");
const apngBlob = img.slice(0, img.size, "image/apng");
expect(await blobIsAnimated(pngBlob)).toBeFalsy();
+2 -2
View File
@@ -6,8 +6,8 @@
"main": "lib/index.js",
"license": "SEE LICENSE IN README.md",
"scripts": {
"build": "vite build",
"lint:types": "tsc --noEmit"
"build": "nx build",
"lint:types": "nx lint:types"
},
"devDependencies": {
"@arcmantle/vite-plugin-import-css-sheet": "^1.0.12",
+21
View File
@@ -0,0 +1,21 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"targets": {
"build": {
"cache": true,
"command": "vite build",
"inputs": ["src"],
"outputs": ["{projectRoot}/lib"],
"options": { "cwd": "modules/banner" },
"dependsOn": ["^build"]
},
"lint:types": {
"command": "tsc --noEmit",
"options": {
"cwd": "modules/banner"
},
"dependsOn": ["^build"]
}
}
}
+2 -2
View File
@@ -6,8 +6,8 @@
"main": "lib/index.js",
"license": "SEE LICENSE IN README.md",
"scripts": {
"build": "vite build",
"lint:types": "tsc --noEmit"
"build": "nx build",
"lint:types": "nx lint:types"
},
"devDependencies": {
"@arcmantle/vite-plugin-import-css-sheet": "^1.0.12",
+21
View File
@@ -0,0 +1,21 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"targets": {
"build": {
"cache": true,
"command": "vite build",
"inputs": ["src"],
"outputs": ["{projectRoot}/lib"],
"options": { "cwd": "modules/restricted-guests" },
"dependsOn": ["^build"]
},
"lint:types": {
"command": "tsc --noEmit",
"options": {
"cwd": "modules/restricted-guests"
},
"dependsOn": ["^build"]
}
}
}
+3 -3
View File
@@ -6,9 +6,9 @@
"main": "lib/index.js",
"license": "SEE LICENSE IN README.md",
"scripts": {
"build": "vite build",
"lint:types": "tsc --noEmit",
"test:unit": "vitest run"
"build": "nx build",
"lint:types": "nx lint:types",
"test:unit": "nx test:unit"
},
"devDependencies": {
"@element-hq/element-web-module-api": "workspace:*",
+25
View File
@@ -0,0 +1,25 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"targets": {
"build": {
"cache": true,
"command": "vite build",
"inputs": ["src"],
"outputs": ["{projectRoot}/lib"],
"options": { "cwd": "modules/widget-lifecycle" },
"dependsOn": ["^build"]
},
"test:unit": {
"command": "vitest run",
"options": { "cwd": "modules/widget-lifecycle" }
},
"lint:types": {
"command": "tsc --noEmit",
"options": {
"cwd": "modules/widget-lifecycle"
},
"dependsOn": ["^build"]
}
}
}
+3 -3
View File
@@ -6,9 +6,9 @@
"main": "lib/index.js",
"license": "SEE LICENSE IN README.md",
"scripts": {
"build": "vite build",
"lint:types": "tsc --noEmit",
"test:unit": "vitest run"
"build": "nx build",
"lint:types": "nx lint:types",
"test:unit": "nx test:unit"
},
"devDependencies": {
"@arcmantle/vite-plugin-import-css-sheet": "^1.0.12",
+25
View File
@@ -0,0 +1,25 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"targets": {
"build": {
"cache": true,
"command": "vite build",
"inputs": ["src"],
"outputs": ["{projectRoot}/lib"],
"options": { "cwd": "modules/widget-toggles" },
"dependsOn": ["^build"]
},
"test:unit": {
"command": "vitest run",
"options": { "cwd": "modules/widget-toggles" }
},
"lint:types": {
"command": "tsc --noEmit",
"options": {
"cwd": "modules/widget-toggles"
},
"dependsOn": ["^build"]
}
}
}