Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

repl param of string.gsub seems to be incorrect #52

Open
appgurueu opened this issue Feb 12, 2022 · 0 comments
Open

repl param of string.gsub seems to be incorrect #52

appgurueu opened this issue Feb 12, 2022 · 0 comments

Comments

@appgurueu
Copy link

The types say: repl: string | Record<string, string> | ((...matches: string[]) => string),, whereas the above docstring says: "otherwise, if it is false or nil, then there is no replacement" - therefore, this should be an optional string, as it may be nil.

Furthermore, I believe a () capture group will return an index, so the matches aren't even necessarily a string[], but may be either number or string. gmatch etc might have similar issues.

You should maybe declare a match type which may be either a number or a string.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant