lisonge / vite-plugin-monkey

A vite plugin server and build your.user.js for userscript engine like Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat
MIT License
1.33k stars 70 forks source link

是否可以在 vite-plugin-monkey/dist/client 中导出更多内部类型以便于 ts 开发 #13

Closed Tsuk1ko closed 2 years ago

Tsuk1ko commented 2 years ago

例如我需要获取 GM_xmlhttpRequest 参数中 responseType 的类型,目前只能这么写

Parameters<typeof GM_xmlhttpRequest>['0']['responseType']

但如果有导出类型 XhrRequest,就可以简化成

XhrRequest['responseType']
lisonge commented 2 years ago

很有道理,我一会发个版本

lisonge commented 2 years ago

fix: by v2.0.1/CHANGELOG.md#201-features

sample

import type { MonkeyWindow, XhrRequest } from '$';
type ScriptInfo = MonkeyWindow['GM_info']; // if you want