Skip to content

Commit 815274b

Browse files
committed
fix: type check failed for Uint8Array
1 parent ba52b9d commit 815274b

5 files changed

Lines changed: 7 additions & 9 deletions

File tree

2txt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ElementArray<T extends XmlNode> extends Array<T> {
7878
* @param input 输入的文件名
7979
* @param output 输出位置
8080
*/
81-
export async function toTXT2(source: Uint8Array, outdir: string, options = {
81+
export async function toTXT2(source: Uint8Array<ArrayBuffer>, outdir: string, options = {
8282
addTitle: true,
8383
removeHTMLTitle: true
8484
}) {

cbz2img.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if(self.postMessage && import.meta.main){
2323

2424
export default async function cbz2jpg(imgfiles: {
2525
name: string;
26-
data: Uint8Array;
26+
data: Uint8Array<ArrayBuffer>;
2727
lastModification?: Date;
2828
}[], outbasename: string = 'out') {
2929
const images = imgfiles.filter(e => e.data.byteLength > 16 * 1024).map(e => {
@@ -79,7 +79,7 @@ export default async function cbz2jpg(imgfiles: {
7979
console.log(`Done!`);
8080
}
8181

82-
async function cbz2jpg2(buffer: Uint8Array, outbasename: string = 'out'){
82+
async function cbz2jpg2(buffer: Uint8Array<ArrayBuffer>, outbasename: string = 'out'){
8383
return cbz2jpg(await extract(buffer), outbasename);
8484
}
8585

comic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ export async function mkCbzOrLongImg(format: string, data: EpubContentOptions[],
117117
if(format == 'cbz'){
118118
const res = await create(imageres.map((img, i) => ({
119119
name: (i + 1).toString().padStart(3, '0') + '.' + images[i].split('.').pop()!,
120-
data: img,
120+
data: img as Uint8Array<ArrayBuffer>,
121121
lastModification: new Date()
122122
})).concat([ { name: 'ComicInfo.xml', data: new TextEncoder().encode(xml), lastModification: new Date() } ]));
123123
await Deno.writeFile(path, res);
124124
}else{
125125
cbz2jpg(imageres.map((img, i) => ({
126126
name: (i + 1).toString().padStart(3, '0') + '.' + images[i].split('.').pop()!,
127-
data: img,
127+
data: img as Uint8Array<ArrayBuffer>,
128128
lastModification: new Date()
129129
})), path.substring(0, path.lastIndexOf('.')));
130130
}

data.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,4 @@ declare interface Data{
4949

5050
declare type Callback = (url_start: URL | string) => AsyncGenerator<Data, void, void>;
5151

52-
declare const document: import("jsr:@b-fuze/deno-dom").HTMLDocument;
53-
54-
declare type ArrayBufferLike = ArrayBuffer;
52+
declare const document: import("jsr:@b-fuze/deno-dom").HTMLDocument;

genepub.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ interface EpubMedia {
8787

8888
interface FileEntry {
8989
path: string;
90-
content: Uint8Array;
90+
content: Uint8Array<ArrayBuffer>;
9191
}
9292

9393
type UnPromise<T> = T extends Promise<infer U> ? U : T;

0 commit comments

Comments
 (0)