You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import type { Flag, MagicRegExp, MagicRegExpMatchArray } from 'magic-regexp'
function getMatchedResult<R extends MagicRegExp<string, string, (string | undefined)[], Exclude<Flag, 'g'>>>(regexp: R, str: string): MagicRegExpMatchArray | null
function getMatchedResult<R extends MagicRegExp<string, string, (string | undefined)[], 'g'>>(regexp: R, str: string): string[] | null
function getMatchedResult(regexp: RegExp, str: string): RegExpMatchArray | null
function getMatchedResult<R extends MagicRegExp<string, string, (string | undefined)[], string> | RegExp>(regexp: R, str: string) {
return str.match(regexp) as any
}
Thats fine! But if force users to download package
I want to make it optional and this is so hard... Because this project uses Symbols i cant implement MagicRegExpLike...
📚 Is your documentation request related to a problem?
How to create typed function with RegExp or MagicRegExp input?
I write something like
it doesn't matter Magic Regexp or just Regexp you place the function
ReturnType
isRegExpMatchArray | null
And is it possible not to use magic regexp as a dependency but to support it? (for example maybe implement compability types)
I am the maintainer of the Telegram Bot API framework - GramIO
And if i add support magic-regexp it would be amazing
I need to allow magic (with type-safety) and not regexp
🔍 Where should you find it?
No response
ℹ️ Additional context
No response
The text was updated successfully, but these errors were encountered: