#How to import an interface from a exported module in a .d.ts file within an npm package

5 messages · Page 1 of 1 (latest)

inland widget
#

So I want to just import a specific interface in the @vscode/debugprotocol npm package that is part of a declare module DebugProtocol part of a .d.ts in the package. Right now I am doing:

import type { DebugProtocol } from "@vscode/debugprotocol"
{a: b} as DebugProtocol.DisconnectArguments

What I would like to do is simplify to something like this:

import type { DisconnectArguments } from "DebugProtocol"
{a: b} as DisconnectArguments

But I cannot figure out how to do it. I've tried tsconfig type roots, I've tried reference declarations, nothing allows me to get just the interface declaration.

It's a minor thing and my resultant output is the same of course, I'm just curious if this is possible to do.

Thanks in advance!

sleek sluice
#

I don't think so, because it is not exported directly

#

We are limited in what we can do, but what the package author exports

#

Can do this though

import type { DebugProtocol } from "@vscode/debugprotocol"
type DisconnectArguments = DebugProtocol.DebugProtocol
{a: b} as DisconnectArguments
inland widget
#

@sleek sluice that's pretty much what I expected, thanks!