首页 > 解决方案 > 如何获取对象实例的类型

问题描述

我正在尝试在 Typescript 中获取对象实例的类型,到目前为止我得到了这个(下)。有什么办法可以写成一行吗?令人惊讶的是,我在 web/google 中找不到任何关于它的信息

const inst = new Matrix4();
type Matrix4 = typeof inst;

标签: typescript

解决方案


推荐阅读