如何在 Flow 中的原始类型上向原型链添加函数?
How do I add a function to the prototype chain on a primitive type in Flow?
例证:向 string
类型添加新的 split
函数。在文档中找不到任何内容。我正在使用 vanilla JS 并想声明一个新类型 string
,它 添加 我的新 split
函数。类似于 type mystring = string + function ...
。也许交叉类型会起作用?
string & {mySplit: Function}
工作正常。
例证:向 string
类型添加新的 split
函数。在文档中找不到任何内容。我正在使用 vanilla JS 并想声明一个新类型 string
,它 添加 我的新 split
函数。类似于 type mystring = string + function ...
。也许交叉类型会起作用?
string & {mySplit: Function}
工作正常。