问题遇到的现象和发生背景
我 TS 里 有一个函数的参数使用了枚举做变量类型
问题相关代码,请勿粘贴截图
enum queryMethod {
GET = "GET",
POST = "POST"
}
function send(url: string, method: queryMethod, data?: object, headers?: Record<string, string> | undefined){}
运行结果及报错内容
'queryMethod' refers to a value, but is being used as a type here. Did you mean 'typeof queryMethod'?
我的解答思路和尝试过的方法
改文件后缀为tsx
我想要达到的结果
没有报错