From bfce140b64c10f460ee91975b51fe4f7634a3e80 Mon Sep 17 00:00:00 2001 From: Andrey Aleksandrov Date: Thu, 5 Jan 2023 21:44:59 +0300 Subject: [PATCH] make sourceViewObserver a little stricter --- .betterer.results | 372 +++++++++++++++++++------------------ src/main.tsx | 8 +- src/sourceViewObserver.tsx | 30 +-- 3 files changed, 208 insertions(+), 202 deletions(-) diff --git a/.betterer.results b/.betterer.results index d4818fe..2c68973 100644 --- a/.betterer.results +++ b/.betterer.results @@ -20,9 +20,9 @@ exports[`stricter ts`] = { [185, 16, 1, "Type \'RegExpExecArray | null\' is not assignable to type \'RegExpExecArray\'.\\n Type \'null\' is not assignable to type \'RegExpExecArray\'.", "177608"], [190, 26, 15, "Property \'annotationBlock\' does not exist on type \'{ [key: string]: string; } | undefined\'.", "2446031659"], [190, 43, 12, "Property \'annotationId\' does not exist on type \'{ [key: string]: string; } | undefined\'.", "2626623183"], - [201, 55, 6, "Object is possibly \'null\'.", "1898504825"], - [202, 65, 6, "Object is possibly \'null\'.", "1898504825"], - [203, 65, 6, "Object is possibly \'null\'.", "1898504825"], + [201, 55, 6, "\'params\' is possibly \'null\'.", "1898504825"], + [202, 65, 6, "\'params\' is possibly \'null\'.", "1898504825"], + [203, 65, 6, "\'params\' is possibly \'null\'.", "1898504825"], [229, 4, 28, "Type \'string | null\' is not assignable to type \'string\'.\\n Type \'null\' is not assignable to type \'string\'.", "1436049888"] ], "src/annotatorView.tsx:2447669251": [ @@ -37,23 +37,23 @@ exports[`stricter ts`] = { [236, 22, 13, "Type \'HTMLIFrameElement | null | undefined\' is not assignable to type \'HTMLIFrameElement\'.\\n Type \'undefined\' is not assignable to type \'HTMLIFrameElement\'.", "1026342619"], [247, 21, 27, "Object is possibly \'null\'.", "2692294385"], [251, 26, 13, "Type \'HTMLElement | null\' is not assignable to type \'HTMLElement\'.\\n Type \'null\' is not assignable to type \'HTMLElement\'.", "1997734481"], - [251, 55, 29, "Object is possibly \'null\'.", "3199209555"], + [251, 55, 29, "\'sidebarIframe.contentDocument\' is possibly \'null\'.", "3199209555"], [255, 26, 15, "Type \'HTMLElement | null\' is not assignable to type \'HTMLElement\'.\\n Type \'null\' is not assignable to type \'HTMLElement\'.", "2601235299"], - [255, 57, 29, "Object is possibly \'null\'.", "3199209555"], + [255, 57, 29, "\'sidebarIframe.contentDocument\' is possibly \'null\'.", "3199209555"], [274, 65, 1, "Parameter \'x\' implicitly has an \'any\' type.", "177629"], [276, 34, 1, "Parameter \'x\' implicitly has an \'any\' type.", "177629"], [277, 37, 1, "Parameter \'a\' implicitly has an \'any\' type.", "177604"], [277, 40, 1, "Parameter \'b\' implicitly has an \'any\' type.", "177607"], [282, 44, 1, "Parameter \'x\' implicitly has an \'any\' type.", "177629"], - [303, 32, 29, "Object is possibly \'null\'.", "3199209555"], + [303, 32, 29, "\'sidebarIframe.contentDocument\' is possibly \'null\'.", "3199209555"], [303, 32, 59, "Object is possibly \'null\'.", "2939097158"], [307, 92, 1, "Parameter \'x\' implicitly has an \'any\' type.", "177629"], - [309, 24, 29, "Object is possibly \'null\'.", "3199209555"], + [309, 24, 29, "\'sidebarIframe.contentDocument\' is possibly \'null\'.", "3199209555"], [309, 24, 59, "Object is possibly \'null\'.", "2939097158"], - [313, 29, 8, "Object is possibly \'null\'.", "257747018"] + [313, 29, 8, "\'document\' is possibly \'null\'.", "257747018"] ], "src/defineEpubAnnotation.tsx:2524315979": [ - [30, 20, 22, "Object is possibly \'null\'.", "1250166809"], + [30, 20, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], [68, 35, 2, "Argument of type \'Document | null\' is not assignable to parameter of type \'Document\'.\\n Type \'null\' is not assignable to type \'Document\'.", "5861160"], [70, 45, 2, "Argument of type \'Document | null\' is not assignable to parameter of type \'Document\'.\\n Type \'null\' is not assignable to type \'Document\'.", "5861160"], [72, 86, 2, "Argument of type \'Document | null\' is not assignable to parameter of type \'Document\'.\\n Type \'null\' is not assignable to type \'Document\'.", "5861160"], @@ -63,108 +63,108 @@ exports[`stricter ts`] = { [114, 16, 32, "Object is possibly \'null\'.", "540434707"], [114, 16, 44, "Type \'string | undefined\' is not assignable to type \'string | null\'.\\n Type \'undefined\' is not assignable to type \'string | null\'.", "4251952809"], [118, 67, 12, "Argument of type \'string | undefined\' is not assignable to parameter of type \'string | number | boolean\'.\\n Type \'undefined\' is not assignable to type \'string | number | boolean\'.", "3338407963"], - [135, 28, 22, "Object is possibly \'null\'.", "1250166809"], - [136, 30, 22, "Object is possibly \'null\'.", "1250166809"], - [140, 33, 22, "Object is possibly \'null\'.", "1250166809"], - [141, 33, 22, "Object is possibly \'null\'.", "1250166809"], + [135, 28, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], + [136, 30, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], + [140, 33, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], + [141, 33, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], [151, 47, 3, "No overload matches this call.\\n Overload 1 of 2, \'(target?: string | undefined): Promise\', gave the following error.\\n Argument of type \'string | null\' is not assignable to parameter of type \'string | undefined\'.\\n Overload 2 of 2, \'(target?: number | undefined): Promise\', gave the following error.\\n Argument of type \'string | null\' is not assignable to parameter of type \'number | undefined\'.\\n Type \'null\' is not assignable to type \'number | undefined\'.", "193422222"], - [156, 16, 3, "Object is possibly \'null\'.", "193422141"], - [164, 12, 22, "Object is possibly \'null\'.", "1250166809"], + [156, 16, 3, "\'toc\' is possibly \'null\'.", "193422141"], + [164, 12, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], [164, 12, 46, "Object is possibly \'null\'.", "2457752360"], - [165, 12, 22, "Object is possibly \'null\'.", "1250166809"], + [165, 12, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], [165, 12, 47, "Object is possibly \'null\'.", "1256381181"], - [170, 31, 22, "Object is possibly \'null\'.", "1250166809"], - [201, 51, 46, "Argument of type \'(e: HTMLElement) => string\' is not assignable to parameter of type \'(value: Element, key: number, parent: NodeListOf) => void\'.\\n Types of parameters \'e\' and \'value\' are incompatible.\\n Type \'Element\' is missing the following properties from type \'HTMLElement\': accessKey, accessKeyLabel, autocapitalize, dir, and 127 more.", "4014636933"], + [170, 31, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], + [201, 51, 46, "Argument of type \'(e: HTMLElement) => string\' is not assignable to parameter of type \'(value: Element, key: number, parent: NodeListOf) => void\'.\\n Types of parameters \'e\' and \'value\' are incompatible.\\n Type \'Element\' is missing the following properties from type \'HTMLElement\': accessKey, accessKeyLabel, autocapitalize, dir, and 129 more.", "4014636933"], [202, 12, 27, "Object is possibly \'null\'.", "2528167425"], [205, 8, 25, "Object is possibly \'null\'.", "963886398"], [214, 8, 25, "Object is possibly \'null\'.", "418257800"], [244, 8, 27, "Object is possibly \'null\'.", "2912345050"], - [247, 16, 3, "Object is possibly \'null\'.", "193419516"], + [247, 16, 3, "\'nav\' is possibly \'null\'.", "193419516"], [252, 8, 27, "Object is possibly \'null\'.", "4205223709"], - [255, 16, 3, "Object is possibly \'null\'.", "193419516"], + [255, 16, 3, "\'nav\' is possibly \'null\'.", "193419516"], [262, 8, 27, "Object is possibly \'null\'.", "3294465699"] ], - "src/defineGenericAnnotation.tsx:4092558775": [ + "src/defineGenericAnnotation.tsx:380103985": [ [33, 35, 5, "Parameter \'event\' implicitly has an \'any\' type.", "165702089"], - [55, 28, 8, "Object is possibly \'undefined\'.", "2281432508"], + [55, 28, 8, "\'subFrame\' is possibly \'undefined\'.", "2281432508"], [72, 16, 5, "Type \'(requestInfo: RequestInfo, requestInit?: RequestInit) => Promise\' is not assignable to type \'(input: URL | RequestInfo, init?: RequestInit | undefined) => Promise\'.\\n Types of parameters \'requestInfo\' and \'input\' are incompatible.\\n Type \'URL | RequestInfo\' is not assignable to type \'RequestInfo\'.", "171106201"], [86, 47, 8, "Argument of type \'(requestInfo: RequestInfo, requestInit?: RequestInit | undefined) => Promise\' is not assignable to parameter of type \'(input: URL | RequestInfo, init?: RequestInit | undefined) => Promise\'.\\n Types of parameters \'requestInfo\' and \'input\' are incompatible.\\n Type \'URL | RequestInfo\' is not assignable to type \'RequestInfo\'.\\n Type \'URL\' is not assignable to type \'RequestInfo\'.", "2945397682"], - [93, 32, 11, "Object is possibly \'undefined\'.", "2008546382"], - [115, 51, 11, "Object is possibly \'undefined\'.", "2008546382"], - [115, 51, 16, "Object is possibly \'null\' or \'undefined\'.", "1835142768"], - [125, 58, 11, "Object is possibly \'undefined\'.", "2008546382"], - [125, 58, 16, "Object is possibly \'null\' or \'undefined\'.", "1835142768"], + [93, 32, 11, "\'requestInit\' is possibly \'undefined\'.", "2008546382"], + [115, 51, 11, "\'requestInit\' is possibly \'undefined\'.", "2008546382"], + [115, 51, 16, "\'requestInit.body\' is possibly \'null\' or \'undefined\'.", "1835142768"], + [125, 58, 11, "\'requestInit\' is possibly \'undefined\'.", "2008546382"], + [125, 58, 16, "\'requestInit.body\' is possibly \'null\' or \'undefined\'.", "1835142768"], [220, 46, 35, "Object is possibly \'null\'.", "3753385185"], [226, 60, 3, "No overload matches this call.\\n Overload 1 of 4, \'(arrayBuffer: WithImplicitCoercion, byteOffset?: number | undefined, length?: number | undefined): Buffer\', gave the following error.\\n Argument of type \'{ user: { name: string; email: string; image: string; _id: string; createdAt: any; updatedAt: any; }; expires: any; } | { data: { deleted: boolean; id: string; }; } | { data: VideoAnnotation[]; } | { ...; }[] | { ...; } | null\' is not assignable to parameter of type \'WithImplicitCoercion\'.\\n Type \'null\' is not assignable to type \'WithImplicitCoercion\'.\\n Overload 2 of 4, \'(str: WithImplicitCoercion | { [Symbol.toPrimitive](hint: \\"string\\"): string; }, encoding?: BufferEncoding | undefined): Buffer\', gave the following error.\\n Argument of type \'{ user: { name: string; email: string; image: string; _id: string; createdAt: any; updatedAt: any; }; expires: any; } | { data: { deleted: boolean; id: string; }; } | { data: VideoAnnotation[]; } | { ...; }[] | { ...; } | null\' is not assignable to parameter of type \'WithImplicitCoercion | { [Symbol.toPrimitive](hint: \\"string\\"): string; }\'.\\n Type \'null\' is not assignable to type \'WithImplicitCoercion | { [Symbol.toPrimitive](hint: \\"string\\"): string; }\'.", "193432417"], - [253, 28, 11, "Object is possibly \'undefined\'.", "2008546382"], - [261, 43, 11, "Object is possibly \'undefined\'.", "2008546382"], - [261, 43, 16, "Object is possibly \'null\' or \'undefined\'.", "1835142768"], + [253, 28, 11, "\'requestInit\' is possibly \'undefined\'.", "2008546382"], + [261, 43, 11, "\'requestInit\' is possibly \'undefined\'.", "2008546382"], + [261, 43, 16, "\'requestInit.body\' is possibly \'null\' or \'undefined\'.", "1835142768"], [307, 37, 1, "Parameter \'_\' implicitly has an \'any\' type.", "177658"], [307, 40, 3, "Parameter \'buf\' implicitly has an \'any\' type.", "193415540"], [313, 48, 3, "Argument of type \'unknown\' is not assignable to parameter of type \'BodyInit | null | undefined\'.", "193415540"], - [340, 46, 4, "Object is possibly \'null\'.", "2087597251"], - [366, 34, 33, "Argument of type \'WeakRef\' is not assignable to parameter of type \'WeakRef\'.\\n Type \'{}\' is missing the following properties from type \'Window\': clientInformation, closed, customElements, devicePixelRatio, and 195 more.", "2740597614"], + [340, 46, 4, "\'file\' is possibly \'null\'.", "2087597251"], + [366, 34, 33, "Argument of type \'WeakRef\' is not assignable to parameter of type \'WeakRef\'.\\n Type \'{}\' is missing the following properties from type \'Window\': clientInformation, closed, customElements, devicePixelRatio, and 197 more.", "2740597614"], [366, 46, 20, "Argument of type \'Window | null\' is not assignable to parameter of type \'object\'.\\n Type \'null\' is not assignable to type \'object\'.", "3173381594"], - [380, 76, 20, "Object is possibly \'null\'.", "3173381594"], - [383, 20, 22, "Object is possibly \'null\'.", "1250166809"], - [385, 56, 22, "Object is possibly \'null\'.", "1250166809"], - [392, 20, 22, "Object is possibly \'null\'.", "1250166809"], - [394, 56, 22, "Object is possibly \'null\'.", "1250166809"], - [401, 20, 22, "Object is possibly \'null\'.", "1250166809"], - [419, 28, 18, "Object is possibly \'null\'.", "2854804508"], - [461, 39, 15, "Property \'contentDocument\' does not exist on type \'Element\'. Did you mean \'ownerDocument\'?", "1301047619"], - [466, 47, 15, "Property \'contentDocument\' does not exist on type \'Element\'. Did you mean \'ownerDocument\'?", "1301047619"], - [500, 33, 15, "Property \'contentDocument\' does not exist on type \'Element\'. Did you mean \'ownerDocument\'?", "1301047619"], - [521, 47, 22, "Element implicitly has an \'any\' type because expression of type \'string\' can\'t be used to index type \'Element\'.\\n No index signature with a parameter of type \'string\' was found on type \'Element\'.", "2507990410"], - [528, 8, 8, "Property \'markdown\' has no initializer and is not definitely assigned in the constructor.", "1536110786"], - [532, 33, 4, "Parameter \'name\' implicitly has an \'any\' type.", "2087876002"], - [532, 39, 8, "Parameter \'oldValue\' implicitly has an \'any\' type.", "2452599369"], - [532, 49, 8, "Parameter \'newValue\' implicitly has an \'any\' type.", "288015442"], - [536, 83, 4, "Argument of type \'null\' is not assignable to parameter of type \'Component\'.", "2087897566"], - [556, 44, 4, "Argument of type \'null\' is not assignable to parameter of type \'Component\'.", "2087897566"], - [567, 78, 24, "Argument of type \'string | null\' is not assignable to parameter of type \'string\'.\\n Type \'null\' is not assignable to type \'string\'.", "3890701775"], - [569, 76, 22, "Argument of type \'string | null\' is not assignable to parameter of type \'string\'.\\n Type \'null\' is not assignable to type \'string\'.", "2443824688"], - [590, 4, 20, "Object is possibly \'null\'.", "3173381594"], - [592, 59, 8, "Parameter \'markdown\' implicitly has an \'any\' type.", "1536110786"], - [643, 12, 7, "Type \'undefined\' is not assignable to type \'URL\'.", "1369680980"], - [656, 12, 7, "Type \'undefined\' is not assignable to type \'URL\'.", "1369680980"], - [730, 48, 1, "Object is of type \'unknown\'.", "177600"] + [380, 76, 20, "\'iframe.contentWindow\' is possibly \'null\'.", "3173381594"], + [383, 20, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], + [385, 56, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], + [392, 20, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], + [394, 56, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], + [401, 20, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], + [419, 28, 18, "\'event.dataTransfer\' is possibly \'null\'.", "2854804508"], + [462, 39, 15, "Property \'contentDocument\' does not exist on type \'Element\'. Did you mean \'ownerDocument\'?", "1301047619"], + [467, 47, 15, "Property \'contentDocument\' does not exist on type \'Element\'. Did you mean \'ownerDocument\'?", "1301047619"], + [501, 33, 15, "Property \'contentDocument\' does not exist on type \'Element\'. Did you mean \'ownerDocument\'?", "1301047619"], + [522, 47, 22, "Element implicitly has an \'any\' type because expression of type \'string\' can\'t be used to index type \'Element\'.\\n No index signature with a parameter of type \'string\' was found on type \'Element\'.", "2507990410"], + [529, 8, 8, "Property \'markdown\' has no initializer and is not definitely assigned in the constructor.", "1536110786"], + [533, 33, 4, "Parameter \'name\' implicitly has an \'any\' type.", "2087876002"], + [533, 39, 8, "Parameter \'oldValue\' implicitly has an \'any\' type.", "2452599369"], + [533, 49, 8, "Parameter \'newValue\' implicitly has an \'any\' type.", "288015442"], + [537, 83, 4, "Argument of type \'null\' is not assignable to parameter of type \'Component\'.", "2087897566"], + [557, 44, 4, "Argument of type \'null\' is not assignable to parameter of type \'Component\'.", "2087897566"], + [568, 78, 24, "Argument of type \'string | null\' is not assignable to parameter of type \'string\'.\\n Type \'null\' is not assignable to type \'string\'.", "3890701775"], + [570, 76, 22, "Argument of type \'string | null\' is not assignable to parameter of type \'string\'.\\n Type \'null\' is not assignable to type \'string\'.", "2443824688"], + [591, 4, 20, "\'iframe.contentWindow\' is possibly \'null\'.", "3173381594"], + [593, 59, 8, "Parameter \'markdown\' implicitly has an \'any\' type.", "1536110786"], + [644, 12, 7, "Type \'undefined\' is not assignable to type \'URL\'.", "1369680980"], + [657, 12, 7, "Type \'undefined\' is not assignable to type \'URL\'.", "1369680980"], + [731, 48, 1, "\'e\' is of type \'unknown\'.", "177600"] ], "src/definePdfAnnotation.tsx:1681251266": [ - [18, 37, 22, "Object is possibly \'null\'.", "1250166809"], + [18, 37, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], [22, 51, 20, "Property \'PDFViewerApplication\' does not exist on type \'Window\'.", "3802277943"], [26, 28, 20, "Property \'PDFViewerApplication\' does not exist on type \'Window\'.", "3802277943"], [58, 34, 5, "Property \'scale\' does not exist on type \'TouchEvent\'.", "195776893"], - [65, 53, 9, "Object is possibly \'null\'.", "1873118818"], - [66, 53, 9, "Object is possibly \'null\'.", "1873118818"], - [68, 28, 6, "Object is possibly \'null\'.", "1982106143"], - [69, 28, 6, "Object is possibly \'null\'.", "1982106143"], - [77, 24, 6, "Object is possibly \'null\'.", "1982106143"], - [78, 24, 6, "Object is possibly \'null\'.", "1982106143"], - [80, 37, 9, "Object is possibly \'null\'.", "1873118818"], - [83, 24, 9, "Object is possibly \'null\'.", "1873118818"], - [84, 24, 9, "Object is possibly \'null\'.", "1873118818"] + [65, 53, 9, "\'container\' is possibly \'null\'.", "1873118818"], + [66, 53, 9, "\'container\' is possibly \'null\'.", "1873118818"], + [68, 28, 6, "\'viewer\' is possibly \'null\'.", "1982106143"], + [69, 28, 6, "\'viewer\' is possibly \'null\'.", "1982106143"], + [77, 24, 6, "\'viewer\' is possibly \'null\'.", "1982106143"], + [78, 24, 6, "\'viewer\' is possibly \'null\'.", "1982106143"], + [80, 37, 9, "\'container\' is possibly \'null\'.", "1873118818"], + [83, 24, 9, "\'container\' is possibly \'null\'.", "1873118818"], + [84, 24, 9, "\'container\' is possibly \'null\'.", "1873118818"] ], "src/defineWebAnnotation.tsx:1080056303": [ - [19, 35, 22, "Object is possibly \'null\'.", "1250166809"], - [21, 20, 22, "Object is possibly \'null\'.", "1250166809"] - ], - "src/main.tsx:2982372853": [ - [35, 11, 8, "Type \'null\' is not assignable to type \'AnnotatorPlugin\'.", "485577868"], - [58, 4, 13, "Property \'styleObserver\' has no initializer and is not definitely assigned in the constructor.", "2152625754"], - [166, 45, 21, "Object is possibly \'undefined\'.", "1934721455"], - [208, 8, 29, "Type \'null\' is not assignable to type \'Set<(style: string) => void>\'.", "1108488515"], - [209, 8, 18, "Type \'null\' is not assignable to type \'StyleObserver\'.", "4114987506"], - [210, 8, 24, "Type \'null\' is not assignable to type \'AnnotatorPlugin\'.", "1391598809"], - [294, 38, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], - [296, 70, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], - [297, 62, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], - [300, 42, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], - [310, 55, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], - [323, 50, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], - [323, 56, 19, "Argument of type \'[{ type: string; state?: any; active?: boolean | undefined; pinned?: boolean | undefined; group?: WorkspaceLeaf | undefined; }, ...unknown[]]\' is not assignable to parameter of type \'[viewState: ViewState, eState?: any]\'.\\n Target allows only 2 element(s) but source may have more.", "2235535674"], - [327, 42, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], - [327, 48, 16, "Argument of type \'[ViewState, ...unknown[]]\' is not assignable to parameter of type \'[viewState: ViewState, eState?: any]\'.\\n Target allows only 2 element(s) but source may have more.", "2605853574"] + [19, 35, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"], + [21, 20, 22, "\'iframe.contentDocument\' is possibly \'null\'.", "1250166809"] + ], + "src/main.tsx:1503025909": [ + [36, 11, 8, "Type \'null\' is not assignable to type \'AnnotatorPlugin\'.", "485577868"], + [59, 4, 13, "Property \'styleObserver\' has no initializer and is not definitely assigned in the constructor.", "2152625754"], + [187, 45, 21, "\'transaction.selection\' is possibly \'undefined\'.", "1934721455"], + [229, 8, 29, "Type \'null\' is not assignable to type \'Set<(style: string) => void>\'.", "1108488515"], + [230, 8, 18, "Type \'null\' is not assignable to type \'StyleObserver\'.", "4114987506"], + [231, 8, 24, "Type \'null\' is not assignable to type \'AnnotatorPlugin\'.", "1391598809"], + [319, 38, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], + [321, 70, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], + [322, 62, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], + [325, 42, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], + [335, 55, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], + [348, 50, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], + [348, 56, 19, "Argument of type \'[{ type: string; state?: any; active?: boolean | undefined; pinned?: boolean | undefined; group?: WorkspaceLeaf | undefined; }, ...unknown[]]\' is not assignable to parameter of type \'[viewState: ViewState, eState?: any]\'.\\n Target allows only 2 element(s) but source may have more.", "2235535674"], + [352, 42, 4, "\'this\' implicitly has type \'any\' because it does not have a type annotation.", "2087959715"], + [352, 48, 16, "Argument of type \'[ViewState, ...unknown[]]\' is not assignable to parameter of type \'[viewState: ViewState, eState?: any]\'.\\n Target allows only 2 element(s) but source may have more.", "2605853574"] ], "src/resourcesFolder.tsx:3252219439": [ [14, 39, 4, "Type \'string | null\' is not assignable to type \'string | undefined\'.", "2087944093"], @@ -173,9 +173,14 @@ exports[`stricter ts`] = { "src/settings.tsx:1213848199": [ [229, 30, 34, "Argument of type \'string | undefined\' is not assignable to parameter of type \'string\'.\\n Type \'undefined\' is not assignable to type \'string\'.", "3704152578"] ], + "src/sourceViewObserver.tsx:1977082719": [ + [162, 12, 7, "Type \'Element | null\' is not assignable to type \'Element\'.\\n Type \'null\' is not assignable to type \'Element\'.", "4115912507"], + [164, 32, 8, "Type \'string | null\' is not assignable to type \'string\'.\\n Type \'null\' is not assignable to type \'string\'.", "611121976"], + [188, 44, 12, "Argument of type \'string | null\' is not assignable to parameter of type \'string\'.\\n Type \'null\' is not assignable to type \'string\'.", "2626624175"] + ], "src/styleObserver.tsx:606482222": [ [8, 8, 13, "Type \'null\' is not assignable to type \'Timeout | undefined\'.", "1188016178"], - [15, 34, 7, "Object is possibly \'null\'.", "2036523900"] + [15, 34, 7, "\'x.sheet\' is possibly \'null\'.", "2036523900"] ], "src/utils.tsx:2109709068": [ [25, 12, 11, "Type \'string | null\' is not assignable to type \'string | undefined\'.\\n Type \'null\' is not assignable to type \'string | undefined\'.", "237013012"], @@ -209,8 +214,8 @@ exports[`stricter ts`] = { [140, 4, 28, "Type \'string | null\' is not assignable to type \'string\'.\\n Type \'null\' is not assignable to type \'string\'.", "1436049888"] ], "src/youtube-captions-scraper.tsx:1122952690": [ - [2, 15, 4, "Could not find a declaration file for module \'he\'. \'obsidian-annotator/node_modules/he/he.js\' implicitly has an \'any\' type.\\n Try \`npm i --save-dev @types/he\` if it exists or add a new declaration (.d.ts) file containing \`declare module \'he\';\`", "2085186632"], - [3, 21, 8, "Could not find a declaration file for module \'lodash\'. \'obsidian-annotator/node_modules/lodash/lodash.js\' implicitly has an \'any\' type.\\n Try \`npm i --save-dev @types/lodash\` if it exists or add a new declaration (.d.ts) file containing \`declare module \'lodash\';\`", "792480568"], + [2, 15, 4, "Could not find a declaration file for module \'he\'. \'obsidian-annotator/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js\' implicitly has an \'any\' type.\\n Try \`npm i --save-dev @types/he\` if it exists or add a new declaration (.d.ts) file containing \`declare module \'he\';\`", "2085186632"], + [3, 21, 8, "Could not find a declaration file for module \'lodash\'. \'obsidian-annotator/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js\' implicitly has an \'any\' type.\\n Try \`npm i --save-dev @types/lodash\` if it exists or add a new declaration (.d.ts) file containing \`declare module \'lodash\';\`", "792480568"], [24, 10, 7, "Type \'RegExpExecArray | null\' must have a \'[Symbol.iterator]()\' method that returns an iterator.", "4196045296"], [34, 31, 5, "Binding element \'vssId\' implicitly has an \'any\' type.", "189160062"] ], @@ -247,24 +252,24 @@ exports[`eslint recommended rules`] = { [30, 36, 11, "\'url\' is defined but never used.", "1884124129"], [35, 13, 18, "\'exportGeneratedCSS\' is defined but never used.", "101250989"] ], - "src/defineGenericAnnotation.tsx:4092558775": [ + "src/defineGenericAnnotation.tsx:380103985": [ [23, 29, 25, "\'iframe\' is defined but never used.", "3579356060"], [47, 42, 5, "\'Proxy\' is not defined.", "231940265"], [226, 48, 6, "\'Buffer\' is not defined.", "2686813381"], [236, 44, 6, "\'Buffer\' is not defined.", "2686813381"], - [523, 20, 2, "Empty block statement.", "5861859"], - [549, 40, 173, "Unexpected lexical declaration in case block.", "1677356781"], - [608, 8, 9, "Unexpected \'debugger\' statement.", "3201740415"] - ], - "src/main.tsx:2982372853": [ - [45, 20, 25, "\'props\' is defined but never used.", "2326264458"], - [45, 50, 3, "\'JSX\' is not defined.", "193455940"], - [47, 21, 26, "\'props\' is defined but never used.", "3027674394"], - [47, 52, 3, "\'JSX\' is not defined.", "193455940"], - [49, 22, 27, "\'props\' is defined but never used.", "3219987113"], - [49, 54, 3, "\'JSX\' is not defined.", "193455940"], - [51, 20, 25, "\'props\' is defined but never used.", "2862218600"], - [51, 50, 3, "\'JSX\' is not defined.", "193455940"] + [524, 20, 2, "Empty block statement.", "5861859"], + [550, 40, 173, "Unexpected lexical declaration in case block.", "1677356781"], + [609, 8, 9, "Unexpected \'debugger\' statement.", "3201740415"] + ], + "src/main.tsx:1503025909": [ + [46, 20, 25, "\'props\' is defined but never used.", "2326264458"], + [46, 50, 3, "\'JSX\' is not defined.", "193455940"], + [48, 21, 26, "\'props\' is defined but never used.", "3027674394"], + [48, 52, 3, "\'JSX\' is not defined.", "193455940"], + [50, 22, 27, "\'props\' is defined but never used.", "3219987113"], + [50, 54, 3, "\'JSX\' is not defined.", "193455940"], + [52, 20, 25, "\'props\' is defined but never used.", "2862218600"], + [52, 50, 3, "\'JSX\' is not defined.", "193455940"] ], "src/styleObserver.tsx:606482222": [ [2, 21, 13, "\'style\' is defined but never used.", "1243315005"], @@ -403,7 +408,7 @@ exports[`eslint ts stricter type checking`] = { [227, 16, 22, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "2610928271"], [232, 16, 22, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "2391970937"] ], - "src/defineGenericAnnotation.tsx:4092558775": [ + "src/defineGenericAnnotation.tsx:380103985": [ [33, 41, 2, "Async arrow function \'listener\' has no \'await\' expression.", "5859494"], [34, 42, 5, "Unsafe argument of type \`any\` assigned to a parameter of type \`object\`.", "165702089"], [35, 60, 10, "Unsafe member access .data on an \`any\` value.", "4128218071"], @@ -457,38 +462,38 @@ exports[`eslint ts stricter type checking`] = { [380, 20, 40, "Unsafe member access .DarkReader on an \`any\` value.", "3964117864"], [380, 20, 55, "Unsafe call of an \`any\` typed value.", "4222974631"], [380, 76, 26, "Avoid referencing unbound methods which may cause unintentional scoping of \`this\`.\\nIf your function does not access \`this\`, you can annotate it with \`this: void\`, or consider using an arrow function instead.", "2367488392"], - [451, 24, 502, "Unsafe assignment of an \`any\` value.", "3544909097"], - [461, 25, 29, "Unsafe member access .contentDocument on an \`any\` value.", "2320015749"], - [461, 25, 44, "Unsafe call of an \`any\` typed value.", "3130067179"], - [466, 26, 59, "Unsafe assignment of an \`any\` value.", "2245193426"], - [466, 34, 28, "Unsafe member access .contentDocument on an \`any\` value.", "4152505018"], - [466, 34, 42, "Unsafe call of an \`any\` typed value.", "4022395374"], - [467, 20, 17, "Unsafe member access .textContent on an \`any\` value.", "880734568"], - [500, 20, 28, "Unsafe member access .contentDocument on an \`any\` value.", "4152505018"], - [500, 20, 45, "Unsafe call of an \`any\` typed value.", "679833270"], - [516, 10, 53, "Unsafe assignment of an \`any\` value.", "4135945176"], - [516, 26, 37, "Unsafe member access .Element on an \`any\` value.", "262525615"], - [517, 64, 23, "Unsafe member access .prototype on an \`any\` value.", "3898988143"], - [521, 16, 53, "Unsafe assignment of an \`any\` value.", "1755531628"], - [521, 16, 23, "Unsafe member access .prototype on an \`any\` value.", "3898988143"], - [527, 36, 41, "Unsafe member access .HTMLElement on an \`any\` value.", "3204092978"], - [535, 16, 4190, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "3267290452"], - [535, 26, 2, "Async arrow function has no \'await\' expression.", "5859494"], - [536, 20, 69, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "1814443347"], - [540, 67, 3728, "Promise returned in function argument where a void return was expected.", "710042801"], - [552, 40, 323, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "2172593494"], - [558, 40, 52, "Unexpected \`await\` of a non-Promise (non-\\"Thenable\\") value.", "3727760542"], - [592, 4, 52, "Unsafe member access .renderObsidianMarkdown on an \`any\` value.", "1948543913"], - [624, 36, 40, "Unsafe argument of type \`any\` assigned to a parameter of type \`Event\`.", "802889426"], - [624, 36, 40, "Unsafe construction of an any type value.", "802889426"], - [624, 41, 21, "This assertion is unnecessary since it does not change the type of the expression.", "3347631028"], - [624, 41, 14, "Unsafe member access .constructor on an \`any\` value.", "2522513264"], - [624, 64, 7, "Unsafe member access .type on an \`any\` value.", "144314304"], - [650, 23, 4, "Unsafe argument of type \`any\` assigned to a parameter of type \`string | URL\`.", "2088095368"], - [663, 23, 4, "Unsafe argument of type \`any\` assigned to a parameter of type \`string | URL\`.", "2088095368"], - [730, 48, 12, "Unsafe argument of type \`any\` assigned to a parameter of type \`string | number | boolean\`.", "1680180449"], - [730, 48, 10, "Unsafe member access .toString on an \`any\` value.", "56758240"], - [730, 48, 10, "Unsafe call of an \`any\` typed value.", "56758240"] + [452, 24, 502, "Unsafe assignment of an \`any\` value.", "3544909097"], + [462, 25, 29, "Unsafe member access .contentDocument on an \`any\` value.", "2320015749"], + [462, 25, 44, "Unsafe call of an \`any\` typed value.", "3130067179"], + [467, 26, 59, "Unsafe assignment of an \`any\` value.", "2245193426"], + [467, 34, 28, "Unsafe member access .contentDocument on an \`any\` value.", "4152505018"], + [467, 34, 42, "Unsafe call of an \`any\` typed value.", "4022395374"], + [468, 20, 17, "Unsafe member access .textContent on an \`any\` value.", "880734568"], + [501, 20, 28, "Unsafe member access .contentDocument on an \`any\` value.", "4152505018"], + [501, 20, 45, "Unsafe call of an \`any\` typed value.", "679833270"], + [517, 10, 53, "Unsafe assignment of an \`any\` value.", "4135945176"], + [517, 26, 37, "Unsafe member access .Element on an \`any\` value.", "262525615"], + [518, 64, 23, "Unsafe member access .prototype on an \`any\` value.", "3898988143"], + [522, 16, 53, "Unsafe assignment of an \`any\` value.", "1755531628"], + [522, 16, 23, "Unsafe member access .prototype on an \`any\` value.", "3898988143"], + [528, 36, 41, "Unsafe member access .HTMLElement on an \`any\` value.", "3204092978"], + [536, 16, 4190, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "3267290452"], + [536, 26, 2, "Async arrow function has no \'await\' expression.", "5859494"], + [537, 20, 69, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "1814443347"], + [541, 67, 3728, "Promise returned in function argument where a void return was expected.", "710042801"], + [553, 40, 323, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "2172593494"], + [559, 40, 52, "Unexpected \`await\` of a non-Promise (non-\\"Thenable\\") value.", "3727760542"], + [593, 4, 52, "Unsafe member access .renderObsidianMarkdown on an \`any\` value.", "1948543913"], + [625, 36, 40, "Unsafe argument of type \`any\` assigned to a parameter of type \`Event\`.", "802889426"], + [625, 36, 40, "Unsafe construction of an any type value.", "802889426"], + [625, 41, 21, "This assertion is unnecessary since it does not change the type of the expression.", "3347631028"], + [625, 41, 14, "Unsafe member access .constructor on an \`any\` value.", "2522513264"], + [625, 64, 7, "Unsafe member access .type on an \`any\` value.", "144314304"], + [651, 23, 4, "Unsafe argument of type \`any\` assigned to a parameter of type \`string | URL\`.", "2088095368"], + [664, 23, 4, "Unsafe argument of type \`any\` assigned to a parameter of type \`string | URL\`.", "2088095368"], + [731, 48, 12, "Unsafe argument of type \`any\` assigned to a parameter of type \`string | number | boolean\`.", "1680180449"], + [731, 48, 10, "Unsafe member access .toString on an \`any\` value.", "56758240"], + [731, 48, 10, "Unsafe call of an \`any\` typed value.", "56758240"] ], "src/definePdfAnnotation.tsx:1681251266": [ [21, 25, 26, "Unsafe member access .contentDocument on an \`any\` value.", "2513102171"], @@ -549,55 +554,54 @@ exports[`eslint ts stricter type checking`] = { [83, 24, 20, "Unsafe member access .scrollLeft on an \`any\` value.", "1612420442"], [84, 24, 19, "Unsafe member access .scrollTop on an \`any\` value.", "2001127978"] ], - "src/main.tsx:2982372853": [ - [84, 8, 18, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "3515082203"], - [113, 20, 41, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "1879446176"], - [117, 20, 41, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "3149801344"], - [162, 45, 15, "Unsafe return of an \`any\` typed value.", "49725155"], - [162, 45, 6, "Unsafe member access .text on an \`any\` value.", "2274581710"], - [162, 45, 11, "Unsafe call of an \`any\` typed value.", "3086081666"], - [168, 34, 310, "Unsafe assignment of an \`any\` value.", "1811042378"], - [168, 63, 41, "Unsafe argument of type \`any\` assigned to a parameter of type \`{}\`.", "941194689"], - [168, 63, 33, "Unsafe member access .config on an \`any\` value.", "2601364793"], - [170, 42, 43, "Unsafe return of an \`any\` typed value.", "3906983353"], - [170, 42, 32, "Unsafe member access .field on an \`any\` value.", "863086289"], - [170, 42, 32, "Unsafe call of an \`any\` typed value.", "863086289"], - [171, 45, 7, "Unsafe member access .file on an \`any\` value.", "1407613802"], - [214, 8, 74, "Unsafe assignment of an \`any\` value.", "2342158860"], - [219, 27, 29, "Promise returned in function argument where a void return was expected.", "2042982007"], - [251, 12, 38, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "3135566631"], - [257, 29, 12, "Unsafe member access .api on an \`any\` value.", "1432009774"], - [257, 46, 12, "Unsafe member access .api on an \`any\` value.", "1432009774"], - [257, 46, 17, "Unsafe call of an \`any\` typed value.", "2943671347"], - [272, 16, 26, "Unsafe member access .path on an \`any\` value.", "3365253047"], - [273, 67, 26, "Unsafe argument of type \`any\` assigned to a parameter of type \`string\`.", "3365253047"], - [273, 67, 26, "Unsafe member access .path on an \`any\` value.", "3365253047"], - [275, 64, 21, "Unsafe argument of type \`any\` assigned to a parameter of type \`string\`.", "3743879060"], - [294, 30, 29, "Unsafe assignment of an \`any\` value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "119685691"], - [294, 38, 9, "Unsafe member access .view on an \`any\` value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "1162983360"], - [294, 38, 19, "Unsafe call of an \`any\` typed value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "2066778864"], - [296, 28, 11, "Unsafe member access .file on an \`any\` value.", "93474597"], - [296, 70, 21, "Computed name [this.id || state.file] resolves to an any value.", "3790623103"], - [296, 70, 7, "Unsafe member access .id on an \`any\` value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "1929661248"], - [296, 81, 10, "Unsafe member access .file on an \`any\` value.", "3925554426"], - [297, 62, 21, "Computed name [this.id || state.file] resolves to an any value.", "3790623103"], - [297, 62, 7, "Unsafe member access .id on an \`any\` value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "1929661248"], - [297, 73, 10, "Unsafe member access .file on an \`any\` value.", "3925554426"], - [300, 24, 24, "Unsafe return of an \`any\` typed value.", "98186542"], - [309, 28, 17, "Unsafe member access .file on an \`any\` value.", "1819858684"], - [310, 55, 27, "Computed name [this.id || state.state.file] resolves to an any value.", "3532845062"], - [310, 55, 7, "Unsafe member access .id on an \`any\` value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "1929661248"], - [310, 66, 16, "Unsafe member access .file on an \`any\` value.", "3421129411"], - [313, 78, 16, "Unsafe argument of type \`any\` assigned to a parameter of type \`string\`.", "3421129411"], - [313, 78, 16, "Unsafe member access .file on an \`any\` value.", "3421129411"], - [321, 59, 16, "Unsafe member access .file on an \`any\` value.", "3421129411"], - [321, 59, 16, "Computed name [state.state.file] resolves to an any value.", "3421129411"], - [323, 32, 45, "Unsafe return of an \`any\` typed value.", "2464750589"], - [327, 24, 42, "Unsafe return of an \`any\` typed value.", "1035967905"], - [337, 12, 27, "Unsafe assignment of an \`any\` value.", "4164923371"], - [346, 16, 27, "Unsafe assignment of an \`any\` value.", "4164923371"], - [358, 97, 2, "Async arrow function \'markdownPostProcessor\' has no \'await\' expression.", "5859494"], - [374, 24, 57, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "639710904"] + "src/main.tsx:1503025909": [ + [88, 8, 18, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "3515082203"], + [119, 20, 41, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "1879446176"], + [123, 20, 41, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "3149801344"], + [183, 45, 15, "Unsafe return of an \`any\` typed value.", "49725155"], + [183, 45, 6, "Unsafe member access .text on an \`any\` value.", "2274581710"], + [183, 45, 11, "Unsafe call of an \`any\` typed value.", "3086081666"], + [189, 34, 310, "Unsafe assignment of an \`any\` value.", "1811042378"], + [189, 63, 41, "Unsafe argument of type \`any\` assigned to a parameter of type \`{}\`.", "941194689"], + [189, 63, 33, "Unsafe member access .config on an \`any\` value.", "2601364793"], + [191, 42, 43, "Unsafe return of an \`any\` typed value.", "3906983353"], + [191, 42, 32, "Unsafe member access .field on an \`any\` value.", "863086289"], + [191, 42, 32, "Unsafe call of an \`any\` typed value.", "863086289"], + [192, 45, 7, "Unsafe member access .file on an \`any\` value.", "1407613802"], + [239, 8, 74, "Unsafe assignment of an \`any\` value.", "2342158860"], + [244, 27, 29, "Promise returned in function argument where a void return was expected.", "2042982007"], + [276, 12, 38, "Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the \`void\` operator.", "3135566631"], + [282, 29, 12, "Unsafe member access .api on an \`any\` value.", "1432009774"], + [282, 46, 12, "Unsafe member access .api on an \`any\` value.", "1432009774"], + [282, 46, 17, "Unsafe call of an \`any\` typed value.", "2943671347"], + [297, 16, 26, "Unsafe member access .path on an \`any\` value.", "3365253047"], + [298, 67, 26, "Unsafe argument of type \`any\` assigned to a parameter of type \`string\`.", "3365253047"], + [298, 67, 26, "Unsafe member access .path on an \`any\` value.", "3365253047"], + [300, 64, 21, "Unsafe argument of type \`any\` assigned to a parameter of type \`string\`.", "3743879060"], + [319, 30, 29, "Unsafe assignment of an \`any\` value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "119685691"], + [319, 38, 9, "Unsafe member access .view on an \`any\` value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "1162983360"], + [319, 38, 19, "Unsafe call of an \`any\` typed value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "2066778864"], + [321, 28, 11, "Unsafe member access .file on an \`any\` value.", "93474597"], + [321, 70, 21, "Computed name [this.id || state.file] resolves to an any value.", "3790623103"], + [321, 70, 7, "Unsafe member access .id on an \`any\` value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "1929661248"], + [321, 81, 10, "Unsafe member access .file on an \`any\` value.", "3925554426"], + [322, 62, 21, "Computed name [this.id || state.file] resolves to an any value.", "3790623103"], + [322, 62, 7, "Unsafe member access .id on an \`any\` value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "1929661248"], + [322, 73, 10, "Unsafe member access .file on an \`any\` value.", "3925554426"], + [325, 24, 24, "Unsafe return of an \`any\` typed value.", "98186542"], + [334, 28, 17, "Unsafe member access .file on an \`any\` value.", "1819858684"], + [335, 55, 27, "Computed name [this.id || state.state.file] resolves to an any value.", "3532845062"], + [335, 55, 7, "Unsafe member access .id on an \`any\` value. \`this\` is typed as \`any\`.\\nYou can try to fix this by turning on the \`noImplicitThis\` compiler option, or adding a \`this\` parameter to the function.", "1929661248"], + [335, 66, 16, "Unsafe member access .file on an \`any\` value.", "3421129411"], + [338, 78, 16, "Unsafe argument of type \`any\` assigned to a parameter of type \`string\`.", "3421129411"], + [338, 78, 16, "Unsafe member access .file on an \`any\` value.", "3421129411"], + [346, 59, 16, "Unsafe member access .file on an \`any\` value.", "3421129411"], + [346, 59, 16, "Computed name [state.state.file] resolves to an any value.", "3421129411"], + [348, 32, 45, "Unsafe return of an \`any\` typed value.", "2464750589"], + [352, 24, 42, "Unsafe return of an \`any\` typed value.", "1035967905"], + [362, 12, 27, "Unsafe assignment of an \`any\` value.", "4164923371"], + [371, 16, 27, "Unsafe assignment of an \`any\` value.", "4164923371"], + [383, 97, 2, "Async arrow function \'markdownPostProcessor\' has no \'await\' expression.", "5859494"] ], "src/resourcesFolder.tsx:3252219439": [ [14, 58, 27, "Unsafe argument of type \`any\` assigned to a parameter of type \`string\`.", "3353493259"], diff --git a/src/main.tsx b/src/main.tsx index ab4258d..66bdffa 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -55,10 +55,11 @@ export default class AnnotatorPlugin extends Plugin implements IHasAnnotatorSett // Used to store text of hypothesis highlight during drag-and-drop event dragData: null | { annotationFilePath: string; annotationId: string; annotationText: string } = null; - // @ts-ignore initialized in onload() + // @ts-ignore initializes in onload() setupPromise: Promise; styleObserver: StyleObserver; + // @ts-ignore initializes in onloadImpl() sourceViewObserver: SourceViewObserver; async onload() { @@ -232,7 +233,6 @@ export default class AnnotatorPlugin extends Plugin implements IHasAnnotatorSett if (this.sourceViewObserver.getObserver()) { this.sourceViewObserver.getObserver().disconnect(); - this.sourceViewObserver.setObserver(null); } } @@ -245,7 +245,7 @@ export default class AnnotatorPlugin extends Plugin implements IHasAnnotatorSett this.views.forEach(v => v.onDarkReadersUpdated()); } - public async openAnnotationTarget(annotationTargetFile: TFile, onNewPane: boolean, annotationId: string | null) { + public async openAnnotationTarget(annotationTargetFile: TFile, onNewPane: boolean, annotationId: string | null): Promise { const leaves = this.app.workspace.getLeavesOfType(VIEW_TYPE_PDF_ANNOTATOR); let leaf: WorkspaceLeaf | null = null; @@ -391,7 +391,7 @@ export default class AnnotatorPlugin extends Plugin implements IHasAnnotatorSett const annotationid = parsedLink.subpath.startsWith('#^') ? parsedLink.subpath.substr(2) : null; const file: TFile | null = this.app.metadataCache.getFirstLinkpathDest(parsedLink.path, ctx.sourcePath); - if (file !== null && this.isAnnotationFile(file)) { + if (file !== null && annotationid != null && this.isAnnotationFile(file)) { this.sourceViewObserver.addClickListener(link, annotationid, file, true); } } diff --git a/src/sourceViewObserver.tsx b/src/sourceViewObserver.tsx index 86bcb00..1086cda 100644 --- a/src/sourceViewObserver.tsx +++ b/src/sourceViewObserver.tsx @@ -10,6 +10,8 @@ export default class SourceViewObserver { private tmpLinkInfos: {linkText: string; count: number}[] = []; private tmpTargetIndex = -1; private targetClassNameSet: Set = new Set(); + + // @ts-ignore initializes in initObserver() when active view is MarkdownView private observer: MutationObserver; constructor(plugin: AnnotatorPlugin) { @@ -40,12 +42,12 @@ export default class SourceViewObserver { initObserver() { const activeLeaf = this.plugin.app.workspace.getActiveViewOfType(MarkdownView); - if (!activeLeaf) return; + const filePath = this.plugin.app.workspace.getActiveFile()?.path; + if (!activeLeaf || filePath === undefined) return; const that = this; const observedClassName = 'cm-hmd-internal-link cm-link-has-alias'; const targetClassName = 'cm-hmd-internal-link cm-link-alias'; - const filePath = this.plugin.app.workspace.getActiveFile().path; const observeCallback = function(mutations: MutationRecord[]) { that.plugin.log('-----------------------------'); for (const mutation of mutations) { @@ -59,7 +61,7 @@ export default class SourceViewObserver { for (const removedNode of mutation.removedNodes) { const removedElement = removedNode as Element; if (removedElement.className && removedElement.className.indexOf(observedClassName) >= 0) { - const removedLinkText = removedElement.textContent; + const removedLinkText = removedElement.textContent ? removedElement.textContent : ''; that.plugin.log('remove'); that.linkOnBlur(mutation.target as Element, removedLinkText, filePath, targetClassName); } @@ -85,10 +87,10 @@ export default class SourceViewObserver { watch() { const activeLeaf = this.plugin.app.workspace.getActiveViewOfType(MarkdownView); - if (!activeLeaf) return; + const filePath = this.plugin.app.workspace.getActiveFile()?.path; + if (!activeLeaf || filePath === undefined) return; - const regex2Find = /(?<=[\[]{2})[^\]]*(?=[\]]{2})/gm; - const filePath = this.plugin.app.workspace.getActiveFile().path; + const regex2Find = /(?<=[[]{2})[^\]]*(?=[\]]{2})/gm; const view = activeLeaf.leaf.view.containerEl; const editor = activeLeaf.editor; const oldText = editor.getValue(); @@ -97,7 +99,7 @@ export default class SourceViewObserver { const tempSourceLinks = view.getElementsByClassName('cm-hmd-internal-link cm-link-alias') as HTMLCollectionOf; const length = tempSourceLinks.length; - const sourceLinks = []; + const sourceLinks = new Array(); if (length > 1) { let prev = tempSourceLinks[0]; for (let i = 1; i < length; i++) { @@ -132,9 +134,9 @@ export default class SourceViewObserver { const annotationid = parsedLink.subpath.startsWith('#^') ? parsedLink.subpath.substring(2) : null; const file: TFile | null = this.plugin.app.metadataCache.getFirstLinkpathDest(parsedLink.path, filePath); - if (this.plugin.isAnnotationFile(file)) { + if (file && this.plugin.isAnnotationFile(file) && annotationid) { this.addClickListener(sourceLinks[i], annotationid, file, false); - this.observer.observe(sourceLinks[i].parentNode, observeConfig); + this.observer.observe(sourceLinks[i].parentNode as Node, observeConfig); } } } @@ -148,7 +150,7 @@ export default class SourceViewObserver { ev.stopPropagation(); ev.stopImmediatePropagation(); const inNewPane = ev.metaKey || ev.ctrlKey || ev.button == 1; - this.plugin.openAnnotationTarget(file, inNewPane, annotationid); + void this.plugin.openAnnotationTarget(file, inNewPane, annotationid); }); } } @@ -175,10 +177,10 @@ export default class SourceViewObserver { const targets = node.getElementsByClassName(className) as HTMLCollectionOf; const uniqueTarget = targets[linkIndex]; this.plugin.log( - 'linkText: ' + link.path + - ' tarIndex: ' + this.tmpTargetIndex + - ' linkIndex: ' + linkIndex + - ' size: ' + this.tmpLinkInfos.length + 'linkText: ' + link.path + + ' tarIndex: ' + this.tmpTargetIndex.toString() + + ' linkIndex: ' + linkIndex.toString() + + ' size: ' + this.tmpLinkInfos.length.toString() ); this.plugin.log(uniqueTarget);