Skip to content

Commit 0d05731

Browse files
authored
Merge pull request #3288 from futsuuu/fix-buffer-ann
fix(annotation): allow all types for encode/decode in string.buffer
2 parents 703bdbb + dd0715e commit 0d05731

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* `FIX` Typed `@field` (eg `---@field [string] boolean`) should not override other defined field [#2171](https://github.com/LuaLS/lua-language-server/issues/2171), [#2711](https://github.com/LuaLS/lua-language-server/issues/2711)
1414
* `FIX` don't return empty hover doc when luals failed to find definition
1515
* `FIX` Prevent stack overflow when attempting to resolve function return values. [#3246](https://github.com/LuaLS/lua-language-server/issues/3246)
16+
* `FIX` Fix type annotations for `string.buffer` module
1617

1718
## 3.15.0
1819
`2025-6-25`

meta/template/string.buffer.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function buf:ref() end
262262
--- Serializes (encodes) the Lua object to the buffer
263263
---
264264
--- This function may throw an error when attempting to serialize unsupported object types, circular references or deeply nested tables.
265-
---@param obj string.buffer.data
265+
---@param obj any
266266
---@return string.buffer
267267
function buf:encode(obj) end
268268

@@ -277,14 +277,14 @@ function buf:encode(obj) end
277277
---
278278
--- Attempting to de-serialize an FFI type will throw an error, if the FFI library is not built-in or has not been loaded, yet.
279279
---
280-
---@return string.buffer.data|nil obj
280+
---@return any obj
281281
function buf:decode() end
282282

283283

284284
--- Serializes (encodes) the Lua object obj
285285
---
286286
--- This function may throw an error when attempting to serialize unsupported object types, circular references or deeply nested tables.
287-
---@param obj string.buffer.data
287+
---@param obj any
288288
---@return string
289289
function buffer.encode(obj) end
290290

@@ -298,7 +298,7 @@ function buffer.encode(obj) end
298298
--- Attempting to de-serialize an FFI type will throw an error, if the FFI library is not built-in or has not been loaded, yet.
299299
---
300300
---@param str string
301-
---@return string.buffer.data|nil obj
301+
---@return any obj
302302
function buffer.decode(str) end
303303

304304

0 commit comments

Comments
 (0)