如何解决与手动Typescript声明文件一起使用时,VS Code intellisense不会自动建议
例如给出以下代码:
static_assert(sizeof(float) == 4 && sizeof(double) == 8);
static_assert(num::check_ieee754<float>(),"does not match ieee754");
static_assert(num::check_ieee754<double>(),"does not match ieee754");
上面的代码工作正常。但是,当我将相同的内容传输到// src/index.ts
export function hello(props: {
type: 'boolean';
params: {
bool: boolean;
}
}): void;
export function hello(props: {
type: 'string';
params: {
str: string;
num: number;
}
}): void;
export function hello(props: {
type?: any;
params?: any;
}): void {
console.log(props);
}
// index.ts
import { hello } from './src';
hello({
type: 'string',/* autosuggests 'string' and 'boolean' */
params: {
/* autosuggests `str` and `num` (not `bool`) as property options,which is correct and expected */
}
})
文件和.js
文件中时,相同的声明不再起作用:
.d.ts
有人能指出我正确的方向吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。