_Pear
`declare module` doesn’t work
I think this is the relevant documentation? https://docs.deno.com/runtime/manual/advanced/typescript/types#using-ambient-or-global-types
Using ambient or global types Overall it is better to use module/UMD type definitions with Deno, where a module expressly imports the types it depends upon. Modular type definitions can express augmentation of the global scope via the declare global in the type definition. For example:
This would make AGlobalString available in the global namespace when importing the type definition.
In some cases though, when leveraging other existing type libraries, it may not be possible to leverage modular type definitions. Therefore there are ways to include arbitrary type definitions when type checking programmes.
35 replies
`declare module` doesn’t work
Hi, i had similar confusion with the d.ts file and opened an issue but I didnt get much response. My issue was with namespaces. In the docs somewhere (ill try to find and link) it says that .d.ts files are treated somewhat differently than in envs we are used to. Idk why this is the case.
Did you try adding a TypeScript config with the types field pointing to the d.ts file? might help but idk!
35 replies
Help with TypeScript namespaces - is this pattern supported?
When using namespaces in a .d.ts file, the deno linter does not complain. When using it in a .ts file, it will warn you to use ESmodules instead of namespaces.
Could the linter be enhanced to give the same warning in d.ts files?
6 replies
Is there a way to bundle multiple files into one file using `esbuild_deno_loader` and `esbuild`?
tsup
is a wrapper aroundn esbuild
and rollup
and it can output to a single file, might be what you're after? https://tsup.egoist.dev/#bundle-files20 replies