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
My project uses @hexagon/base64, which cross-publishes to deno.land as b64. I'm experimenting with migrating my Node library to use dnt so I can start cross-publishing as well, and so I updated my import to point to deno.land:
import base64 from "https://deno.land/x/b64@1.1.27/src/base64.js";
Which I then map to the NPM equivalent in my dnt build script:
When I run the build script, the export maps over as expected:
importbase64from"@hexagon/base64";
BUT dnt fails to build when it tries to type check the ESM it just output:
deno task build
Task build deno run -A build_npm.ts 0.0.1
[dnt] Transforming...
[dnt] Running npm install...
added 2 packages, and audited 3 packages in 849ms
found 0 vulnerabilities
[dnt] Building project...
[dnt] Type checking ESM...
src/helpers/iso/isoBase64URL.ts:1:20 - error TS7016: Could not find a declaration file for module '@hexagon/base64'. '/Users/matt/Developer/simplewebauthn/packages/server/npm/node_modules/@hexagon/base64/dist/base64.cjs' implicitly has an 'any' type.
Try `npm i --save-dev @types/hexagon__base64` if it exists or add a new declaration (.d.ts) file containing `declare module '@hexagon/base64';`
1 import base64 from "@hexagon/base64";
~~~~~~~~~~~~~~~~~
error: Uncaught (in promise) Error: Had 1 diagnostics.
throw new Error(`Had ${diagnostics.length} diagnostics.`);
^
at getProgramAndMaybeTypeCheck (https://deno.land/x/dnt@0.38.0/mod.ts:456:17)
at build (https://deno.land/x/dnt@0.38.0/mod.ts:345:17)
at eventLoopTick (ext:core/01_core.js:183:11)
at async file:///Users/matt/Developer/simplewebauthn/packages/server/build_npm.ts:7:1
The @hexagon/base64 package includes its own .d.ts file, though, that has all the type declarations:
It doesn't seem possible to get dnt to see these types. My project currently gets TypeScript to see these types by including "./node_modules/@types" in tsconfig.json's typeRoots (which, I know, doesn't really make sense since @hexagon/base64's types aren't actually in node_modules/@types/ but it works 🤷♂️), but typeRoots isn't a valid value for dnt's compilerOptions:
I tried adding /// <reference types="https://deno.land/x/b64@1.1.27/types/base64.d.ts" /> above my deno.land import in the source file, but it just gets stripped out by dnt so that doesn't seem to be an option either.
Any idea how I can get ESM type checking to see this package's types?
The text was updated successfully, but these errors were encountered:
My project uses @hexagon/base64, which cross-publishes to deno.land as b64. I'm experimenting with migrating my Node library to use dnt so I can start cross-publishing as well, and so I updated my import to point to deno.land:
Which I then map to the NPM equivalent in my dnt build script:
When I run the build script, the export maps over as expected:
BUT dnt fails to build when it tries to type check the ESM it just output:
The @hexagon/base64 package includes its own .d.ts file, though, that has all the type declarations:
It doesn't seem possible to get dnt to see these types. My project currently gets TypeScript to see these types by including
"./node_modules/@types"
in tsconfig.json'stypeRoots
(which, I know, doesn't really make sense since @hexagon/base64's types aren't actually in node_modules/@types/ but it works 🤷♂️), buttypeRoots
isn't a valid value for dnt'scompilerOptions
:I tried adding
/// <reference types="https://deno.land/x/b64@1.1.27/types/base64.d.ts" />
above my deno.land import in the source file, but it just gets stripped out by dnt so that doesn't seem to be an option either.Any idea how I can get ESM type checking to see this package's types?
The text was updated successfully, but these errors were encountered: