我正在将React项目从jsx转换为tsx文件。
我需要一个常量类型的完整预览:
const canvasProps = {
setPorts,
setBoxes,
setLines,
selected,
setSelected,
actionState,
setActionState,
... // and more
};
悬停在canvasProps
上,我得到了预览:
const canvasProps: {
setPorts: React.Dispatch<React.SetStateAction<{
shape: string;
id: string;
name: string;
port: portType;
ref: any;
}[]>>;
setBoxes: React.Dispatch<React.SetStateAction<BoxType[]>>;
... 13 more ...;
toggleFlowVisibility: (flow: any) => void;
}
我需要获取此常量的完整类型定义,这意味着请参阅其他13种类型。
(为什么要这样做?我需要声明React.Context的属性,这取决于尚未声明的函数(在函数组件内部))
所以我不用努力就能得到完整的类型定义吗?
答案 0 :(得分:0)
将"noErrorTruncation": true
添加到tsconfig.json
具有从VSCode中的类型预览扩展... n more ...
的副作用。