Help with TypeScript namespaces - is this pattern supported?

Hi! I am attempting to model some classes in a Namespace for organization purposes. I would expect this pattern to work, the linter doesn't complain at least, but when I run deno test it fails with the error in the README. Is this not supported in Deno? I tried using triple slash directives as well but no luck. Thanks! https://github.com/CobyPear/deno-namespace-reproduction
GitHub
GitHub - CobyPear/deno-namespace-reproduction
Contribute to CobyPear/deno-namespace-reproduction development by creating an account on GitHub.
DAH
Deno AI Helper27d ago
I apologize, but I wasn't able to find the answer to your question in the official Deno documentation. However, based on the information you've provided, I can offer some general advice regarding TypeScript namespaces. TypeScript namespaces are a legacy way to organize code and are not recommended for new projects. Instead, ES modules are the standard in Deno for code organization and module management. If you're using namespaces and encountering issues, it might be due to Deno's focus on ES modules, which could be causing compatibility issues with the namespace pattern. Without seeing the specific code and error message, it's difficult to provide a precise solution. However, if you're using triple-slash directives and they're not resolving the issue, it's possible that there's a mismatch between the way Deno handles modules and the way your code is structured with namespaces. Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of this advice. If you continue to experience issues, you might want to consider refactoring your code to use ES modules instead of namespaces for better compatibility with Deno.
P
_Pear26d ago
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?
R
ry26d ago
@_Pear it'd be helpful if you opened an issue in the deno repo, we can take a closer look
P
_Pear26d ago
sure, I'll open one this evening. I have a reproduction attached at the link in the OP if you're able to take a look in the meantime.
P
_Pear26d ago
GitHub
Linter does not warn about namespaces in .d.ts file · Issue #2310...
Version: Deno 1.40.3 The following lint warning appears in a .ts file when trying to use a namespace, but not a .d.ts file: TypeScript's module and namespace are discouraged to use Use ES2015 m...
More Posts
font regenerator for copying restriction purposes on DenoI am developing a web reader PWA primarily for reading CJK character text. If I do not want users examples of Deno+LlamacppAre there examples of Deno and Ollama/Llamacpp setups in typescript? Its should t be hard since itIs there a way to bundle multiple files into one file using `esbuild_deno_loader` and `esbuild`?I'm trying to bundle multiple files in a single folder into one JS file that needs to end up in the Deno.stdin raw map?Does anyone have a map to which key is what raw buffer gotten from `Deno.stdin`? Like i can just seaHave the Deno deploy templates disappeared?Good morning, I can't find https://dash.deno.com/new from the account dashboard panel. Are the templIPC (ZeroMQ)I want to create a service with Deno that should be callable by other (non-deno) processes running oRead child process I/OI want to write a simple Deno CLI script using `Deno.Command` or `dx` that can read output from a shCannot find name 'Deno'.ts(2304)Hello, I am using VS Code and Typescript and I have this error. I have downloaded the latest extenDeno Fresh: TypeError: 'import', and 'export' cannot be outside of moduleDeno Fresh: ```tsx // @deno-types="npm:@arcgis/core/interfaces.d.ts" import config from "npm:@arcgisEcosystem: @arcgis/corehttps://github.com/Esri/jsapi-resources/tree/main/esm-samples/jsapi-deno I've found an example imporKill Deno.CommandIs it possible to kill/end a `Deno.command`-instance? Example code: ```ts (async () => { let ffmBundle ts code to ts using deno emitWhen bundling code using https://deno.land/x/emit@0.38.2 it bundles into javascript but i want it to