#importing a ts file in astro.config causes any .d.ts file in src/ to be imported and fails the build

2 messages · Page 1 of 1 (latest)

native egret
#

hi all ! I think i stumbled upon a bug ? at least an unexpected behaviour. I have a minimal repro.

I use rust compiled to wasm to build interactive visualization. this creates a bunch of js/ts/.d.ts files, including one that looks like that:

// src/myrustlib_bg.wasm.d.ts
export const memory: WebAssembly.Memory;

I have an unrelated ts file containing an astro integration, at the root (same behaviour if in the src folder):

// ./test.ts
export const TEST = 42;

I import it, not even use it in my astro.config.mjs:

import {TEST} from './test';

this creates an error:

[ERROR] The constant "memory" must be initialized

    src/rust_wasm_lib_bg.wasm.d.ts:3:13:
      3 │ export const memory: WebAssembly.Memory; 

which feels like importing one ts file causes every .d.ts file to be...typechecked ? imported as js ? any idea ?

I'll post the link to the github repo containing the repro very soon

native egret