Typescript 类型脚本类型:字符串匹配模式
我正在查询一个系统API(Linux'Typescript 类型脚本类型:字符串匹配模式,typescript,Typescript,我正在查询一个系统API(Linux'DBusAPI),它需要3个strings: 服务 路径 name 因此,我可以编写调用接口的TypeScript方法的签名,如下所示: getInterface(service: string, path: string, name: string): DBusInterface; 但我知道,服务、路径和名称都遵循特定的字符串模式: 服务=/^org\.bluez/ 路径=/(\/[a-zA-Z]*)+/ name=/([a-zA-Z]+\)+/
DBus
API),它需要3个string
s:
服务
路径
name
getInterface(service: string, path: string, name: string): DBusInterface;
但我知道,服务
、路径
和名称
都遵循特定的字符串模式:
=服务
/^org\.bluez/
- 路径=
/(\/[a-zA-Z]*)+/
=name
/([a-zA-Z]+\)+/
type ServiceName: /^org\.bluez/
目前截至2019年11月,这是不可能的,现在有一个公开的建议,您可以在这里跟踪
您可以阅读评论,也许会发现一些有用的东西谢谢您!你能把这个作为一个答案,然后我可以接受这个解决了!