给定打字稿中的接口,我可以自动从其中模拟出一个带有伪值的新对象,而不是手动编写对象吗?
让我们以下面的interface
为例:
interface SquareConfig {
color: string;
width: number;
}
我想有一个实现接口属性的模拟对象,例如:
const mockConfig = jest.mock<SquareConfig>();
console.log(mockConfig.color); //should print some auto-generated dummy string value
有可能吗?