Skip to content

Commit

Permalink
fix: TypeScript doesn't like black magic
Browse files Browse the repository at this point in the history
More specifically, hooking into some low-level `wasm-bindgen` stuff is
awkwardly typed.
  • Loading branch information
elijah-potter committed Dec 18, 2024
1 parent e45366e commit 4b9aafc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module.exports = {
rules: {
'prettier/prettier': 'error',
// Just annoying
'@typescript-eslint/no-explicit-any': ['off']
'@typescript-eslint/no-explicit-any': ['off'],
'@typescript-eslint/ban-ts-comment': ['off']
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier'],
Expand Down
6 changes: 4 additions & 2 deletions packages/harper.js/src/loadWasm.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// @ts-ignore
// @ts-expect-error because this virtual module hasn't been added to a `d.ts` file.
import wasmUri from 'virtual:wasm';

let curWasmUri = wasmUri;

/** Get the currently set data URI for the WebAssembly module. */
/** Get the currently set data URI for the WebAssembly module.
* I'm not a huge of the singleton, but we're swapping out same data, just from a different source, so the state doesn't meaningfully change. */
export function getWasmUri(): string {
return curWasmUri;
}
Expand All @@ -18,6 +19,7 @@ export function setWasmUri(uri: string) {
* */
export default async function loadWasm() {
const wasm = await import('wasm');
// @ts-ignore
await wasm.default(getWasmUri());

return wasm;
Expand Down

0 comments on commit 4b9aafc

Please sign in to comment.