typed-regex
typed-regex copied to clipboard
fix: adds support for nested groups
WIP. Will need to re-write the parser to work better with nested groups without nesting the types to its limits
Can we merge this after review please? This is a very good addition .. This also closes both the issues as they seem to relate to what the author of this PR fixed.
Edit: I just see that you are actualy the author of this package ^^
Why is this PR not merged yet? Maybe issues that need to be resolved?
@codeit-ninja Unfortunately, this hits the limit of what typescript can handle in terms of nested types. Will need to look into flattening some of the structures there but it's a little complicated to get right.
@phenax It seems to work correctly in my project, I dont hit any limitations?
It correctly shows optional groups, in the picture id is marked as optional, in the typed result I correctly see id as string | undefined.

@codeit-ninja it works for some expressions but there are a lot of cases where ts errors out

@phenax Thats odd, I dont get this warning/error

What TS version are you using? I am on 4.5.4. Some people have this error appearently only on TS versions <4 see https://stackoverflow.com/questions/70545982/why-am-i-getting-type-instantiation-is-excessively-deep-and-possibly-infinite