javascript - 按类型获取类 PropertyInfo
问题描述
考虑到我有休闲班
export class myClass{
test?:number;
test2?:string;
test3:boolean;
constructor(){
this.test3=true;
}
}
我想获取类中包含的属性及其类型的列表
我想要.GetProperties<myClass>()
回来的东西[{name:"test", "type":"number"},etc]
打字稿可以吗?
解决方案
推荐阅读
- vue.js - 对象上的 Vuex 状态更改不会触发重新渲染
- python - 无法将数据框列的数据类型更改为 int
- google-colaboratory - Google colab 错误 - 笔记本加载错误:
- sql - SQL:在选择中使用 Lag/Lead 结果两次
- scala - slick 可以从模型中自动在数据库中创建表(生成 SQL 并执行)吗?
- c# - UDPClient收到多条消息后失去连接
- tensorflow - 使用时间分布式包装器重塑数据以拟合多元 LSTM 时间序列模型
- html - 如何保持元素的位置:调整大小时绝对在同一位置
- kotlin - 类型检查数据类的任何变量
- reactjs - How to correctly implement function wrapper in TypeScript?