How do I add types for a submodule of a node module? For example, say I install a module called foo
, which has a submodule bar
, which is imported like this:
import Bar from "foo/bar";
I tried the following, but it didn't appear to work (in types/styled-components/primitives.d.ts
):
declare module "foo/bar" {
// types
}
If it helps, the specific module I am trying to work with is styled-components/primitives
, so if there are already types available somewhere I'm happy to pull those instead of defining them myself. @types/styled-components
did not appear to include them.