【发布时间】:2020-07-29 09:31:46
【问题描述】:
假设我有一个文件,class.ts
//I tried implementing interface, but it won't help, with or without the interface
interface FooInterface {
bar: Function
}
class Foo implements FooInterface {
bar() {
console.log('Hello world!');
}
}
export = new Foo();
在我的另一个文件 index.js 中,我希望 VS Code 能够读取 Foo 类中的内容并自动完成,但事实并非如此。
const Foo = require('./class');
///Expecting the .bar() suggestion after typing Foo., but it didn't happen
Foo.bar();
我错过了什么吗?我应该怎么做才能让 VS Code 识别类中可用的方法/属性?很多第三方库都可以做到这一点。
【问题讨论】:
标签: typescript class visual-studio-code import export