Description
The module resolution logic in the handbook doesn't mention how nested modules are supported from a single npm package. There is an old issue discussing this that has been closed: #5804
Neither the solution here or simply trying to refer to modules beneath the root dir referred to by the typings or main path seems to work. Is there a documented best practice? The documentation says that ambient modules should not be used in the typings field in package.json.
Just to be clear, I want to write this in a consuming app:
import {stuff} from "my-npm-lib/submodule"
Where the package.json file in my-npm-lib has:
"main": "lib/index.js",
"typings": "lib/index.d.ts",
And the file structure in the my-npm-lib:
my-npm-lib\
index.js
index.d.ts
submodule.js
submodule.d.ts
Currently this complains with a module not found error. But this works, but shouldn't:
import {stuff} from "my-npm-lib/lib/submodule"
This is all with the module resolution setting set to node.