microsoft / vscode-extension-vscode

The vscode NPM module. Deprecated in favor of @types/vscode and vscode-test.

Home Page:https://www.npmjs.com/package/vscode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prefer direct exports over "declare module"

andy-ms opened this issue · comments

Currently the type definitions are written like:

declare module 'vscode' {
	export const version: string;
	...
}

interface Thenable<T> { ... }

But they could be written like:

export const version: string;
...

declare global {
	interface Thenable<T> { ... }
}

The latter is the style we recommend on DefinitelyTyped. The difference is that it makes the file into an external module that is imported based on its path, rather than an ambient declaration that can be imported from anywhere.

@jrieken fyi not sure if this could be done from the vscode.d.ts we have in our repo in VSCode or we would have to massage the d.ts when downloading for this module.

I believe not, esp. because we have the vscode module declared in two files, vscode.d.ts and vscode.proposed.d.ts. @andy-ms Unsure if that's possible?

Yeah, if you have two different versions of the same thing I guess you'll have to use an ambient module in at least one of them.

I am closing this as I see no actionable item for the vscode module. Since the vscode.d.ts is coming from the VS Code repo, please report the issue there.