From 0343328cf1f90b41233d5a969b38181b95e6d05d Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Wed, 2 Feb 2022 16:49:59 +0800 Subject: [PATCH] remove epubjs type --- components/previews/EPUBPreview.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/previews/EPUBPreview.tsx b/components/previews/EPUBPreview.tsx index 58435c4..2e2b56e 100644 --- a/components/previews/EPUBPreview.tsx +++ b/components/previews/EPUBPreview.tsx @@ -1,14 +1,13 @@ import type { OdFileObject } from '../../types' -import { FC, useEffect, useRef, useState } from 'react' +import { FC, useEffect, useRef, useState } from 'react' import { ReactReader } from 'react-reader' -import type { Rendition } from 'epubjs' import Loading from '../Loading' import DownloadButtonGroup from '../DownloadBtnGtoup' import { DownloadBtnContainer } from './Containers' -const EPUBPreview: FC<{ file: OdFileObject}> = ({ file }) => { +const EPUBPreview: FC<{ file: OdFileObject }> = ({ file }) => { const [epubContainerWidth, setEpubContainerWidth] = useState(400) const epubContainer = useRef(null) @@ -21,9 +20,9 @@ const EPUBPreview: FC<{ file: OdFileObject}> = ({ file }) => { // Fix for not valid epub files according to // https://github.com/gerhardsletten/react-reader/issues/33#issuecomment-673964947 - const fixEpub = (rendition: Rendition) => { + const fixEpub = rendition => { const spineGet = rendition.book.spine.get.bind(rendition.book.spine) - rendition.book.spine.get = function (target) { + rendition.book.spine.get = function (target: string) { const targetStr = target as string let t = spineGet(target) while (t == null && targetStr.startsWith('../')) {