You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Types from npm run build-dts and esm build from npm run build-esm don't work together
Problem
Plain project, no bundlers, just Typescript 3.9.6 with "es6" target to compile.
I was going to use gl-matrix as a bundled dependency because of no bundler. I got esm dist from npm run build-esm then copy to my ./src/esm dir. Works just fine, but no types (like mat4.create() returns any instead of mat4 so I can't handle it with Typescript)
So I have made index.d.ts from npm run build-dts. Keeping this in root folder provides no types, for this reason I just copied this right to ./src/esm. But now I got
src/Cube.ts:7:22 - error TS2306: File '/mnt/c/Project/subtract-n-triangulate/src/esm/index.d.ts' is not a module.
7 import { mat4 } from "./esm/index.js";
~~~~~~~~~~~~~~~~
Found 1 error.
For sure I can not an expert in typescript module declarations, but something looks wrong with all this. Would be happy to get some advice or solution. Thank you.
The text was updated successfully, but these errors were encountered:
Second, even if we replace declare with export we still don't have types, because of module "gl-matrix" wrap. There is probably a reason for this to be here, but if I remove it, everything works just as I initially expect.
TLDR
Types from
npm run build-dts
and esm build fromnpm run build-esm
don't work togetherProblem
Plain project, no bundlers, just Typescript 3.9.6 with "es6" target to compile.
I was going to use gl-matrix as a bundled dependency because of no bundler. I got esm dist from
npm run build-esm
then copy to my./src/esm
dir. Works just fine, but no types (likemat4.create()
returnsany
instead ofmat4
so I can't handle it with Typescript)So I have made
index.d.ts
fromnpm run build-dts
. Keeping this in root folder provides no types, for this reason I just copied this right to./src/esm
. But now I gotFor sure I can not an expert in typescript module declarations, but something looks wrong with all this. Would be happy to get some advice or solution. Thank you.
The text was updated successfully, but these errors were encountered: