Skip to content

Commit

Permalink
fix ts errors
Browse files Browse the repository at this point in the history
  • Loading branch information
djahandarie committed Dec 11, 2024
1 parent a8fb1b8 commit 3c0cca9
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 156 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
"url": "/ext/data/schemas/recommended-dictionaries-schema.json"
}
],
"typescript.tsdk": "node_modules\\typescript\\lib"
"typescript.tsdk": "node_modules\\typescript\\lib",
"nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix"
}
12 changes: 10 additions & 2 deletions benches/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noImplicitAny": true,
"strictPropertyInitialization": true,
"suppressImplicitAnyIndexErrors": false,
"skipLibCheck": false,
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"*": ["../types/ext/*"],
Expand All @@ -23,11 +23,18 @@
},
"types": [
"chrome",
"dom-webcodecs",
"firefox-webext-browser",
"handlebars",
"jszip",
"parse5",
"wanakana"
],
"lib": [
"ES2022",
"DOM",
"DOM.Iterable",
"WebWorker"
]
},
"include": [
Expand All @@ -41,6 +48,7 @@
],
"exclude": [
"../node_modules",
"../dev/lib"
"../dev/lib",
"../ext/lib"
]
}
12 changes: 10 additions & 2 deletions dev/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
"noImplicitAny": true,
"strictPropertyInitialization": true,
"suppressImplicitAnyIndexErrors": false,
"skipLibCheck": false,
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"api-map": ["../types/ext/api-map"],
"anki-templates": ["../types/ext/anki-templates"],
"anki-templates-internal": ["../types/ext/anki-templates-internal"],
"cache-map": ["../types/ext/cache-map"],
Expand Down Expand Up @@ -52,7 +53,14 @@
"assert",
"css",
"chrome",
"ajv"
"ajv",
"dom-webcodecs"
],
"lib": [
"ES2022",
"DOM",
"DOM.Iterable",
"WebWorker"
]
},
"include": [
Expand Down
1 change: 0 additions & 1 deletion ext/js/background/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {AccessibilityController} from '../accessibility/accessibility-controller.js';
import {AnkiConnect} from '../comm/anki-connect.js';
import {ClipboardMonitor} from '../comm/clipboard-monitor.js';
Expand Down
1 change: 0 additions & 1 deletion ext/js/dom/document-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ function computeCssZoomSupported() {
return (
typeof style === 'object' &&
style !== null &&
// @ts-expect-error - zoom is a non-standard property.
typeof style.zoom === 'string'
);
}
3 changes: 0 additions & 3 deletions ext/js/dom/text-source-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ export class TextSourceGenerator {
return document.caretRangeFromPoint(x, y);
}

// @ts-expect-error - caretPositionFromPoint is non-standard
if (typeof document.caretPositionFromPoint === 'function') {
// Firefox
return this._caretPositionFromPoint(x, y);
Expand All @@ -422,7 +421,6 @@ export class TextSourceGenerator {
* @returns {?Range}
*/
_caretPositionFromPoint(x, y) {
// @ts-expect-error - caretPositionFromPoint is non-standard
const position = /** @type {(x: number, y: number) => ?{offsetNode: Node, offset: number}} */ (document.caretPositionFromPoint)(x, y);
if (position === null) {
return null;
Expand Down Expand Up @@ -475,7 +473,6 @@ export class TextSourceGenerator {
nextElement.style.setProperty('user-select', 'text', 'important');
}

// @ts-expect-error - caretPositionFromPoint is non-standard
const position = /** @type {(x: number, y: number) => ?{offsetNode: Node, offset: number}} */ (document.caretPositionFromPoint)(x, y);
if (position === null) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noImplicitAny": true,
"strictPropertyInitialization": true,
"suppressImplicitAnyIndexErrors": false,
"skipLibCheck": false,
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"*": ["./types/ext/*"],
Expand Down
Loading

0 comments on commit 3c0cca9

Please sign in to comment.