The NexusT
Denoβ€’3y agoβ€’
3 replies
The Nexus

How use namespace on Deno

i am trying to use the same namespace in multiple modules but what used to work in node, doesn't work in deno:
/* test1.ts */

/// <reference path="./test2.ts" />

namespace Test {
    export const a = 3;
}

/* test2.ts */

/// <reference path="./test1.ts" />

export namespace Test {
    export const b = 5;
        // If i try to use "a", doesn't work
}

/* test3.ts */
/// <reference path="./test1.ts" />
/// <reference path="./test2.ts" />

console.log(Test.a); // "Cannot find name 'Test'."
Was this page helpful?