docs(eval): fix fn.strchar types #37737

Problem: The following strchar functions have incorrect types:

strcharlen() - Currently any. Always returns an integer, including on
error

strcharpart() - The skipcc annotation does not specify that 0 and 1 are
valid. These inputs are required for vimscript usage. The current
return type is any, even though the function returns an empty string
on error

strchars() - The skipcc annotation does not specify that 0 and 1 are
valid

Solution: Update the problem types.
This commit is contained in:
Mike J McGuirk
2026-02-08 08:07:49 -05:00
committed by GitHub
parent 6771b10b88
commit 6cb3254c2f
3 changed files with 12 additions and 10 deletions

View File

@@ -9573,7 +9573,7 @@ function vim.fn.str2nr(string, base) end
--- Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
---
--- @param string string
--- @return any
--- @return integer
function vim.fn.strcharlen(string) end
--- Like |strpart()| but using character index and length instead
@@ -9593,8 +9593,8 @@ function vim.fn.strcharlen(string) end
--- @param src string
--- @param start integer
--- @param len? integer
--- @param skipcc? boolean
--- @return any
--- @param skipcc? 0|1|boolean
--- @return string
function vim.fn.strcharpart(src, start, len, skipcc) end
--- The result is a Number, which is the number of characters
@@ -9626,7 +9626,7 @@ function vim.fn.strcharpart(src, start, len, skipcc) end
--- <
---
--- @param string string
--- @param skipcc? boolean
--- @param skipcc? 0|1|boolean
--- @return integer
function vim.fn.strchars(string, skipcc) end