I would like to define typing for a Javascript project. Let's consider a simplified version:
a
|
+ A.js
+ b
|
+ B.js
There is a folder 'a', and inside it there is folder 'b', and I would like to use it as:
import { A } from "a"
import { B } from "a/b"
The typing that I ideally would like to have looks like something like this:
declare namespace a {
interface A { }
namespace b {
interface B { }
}
}
declare module "a" {
export = a
}
declare module "a/b" {
export = a.b
}
However, this gives me the error Cannot use namespace 'a' as a value.
I noticed if I change interfaces to classes, the problem resolves. Can someone please shed some light why it is like that? Is there a way to get such definitions with interfaces?