util.jsonpointer: Silence Teal warning
authorKim Alvefur <zash@zash.se>
Fri, 30 Jun 2023 15:02:26 +0200
changeset 13175 e2c3582ab9fa
parent 13174 082c7d856e61
child 13176 9364f0b5ecae
util.jsonpointer: Silence Teal warning It seems to think 'table' never has array items, but we don't know that.
teal-src/prosody/util/jsonpointer.tl
--- a/teal-src/prosody/util/jsonpointer.tl	Thu Jun 29 15:36:13 2023 +0100
+++ b/teal-src/prosody/util/jsonpointer.tl	Fri Jun 30 15:02:26 2023 +0200
@@ -23,7 +23,7 @@
 			new_ref = ref[token]
 		elseif idx is integer then
 			local i = tonumber(token)
-			if token == "-" then i = #ref + 1 end
+			if token == "-" then i = #(ref as {any}) + 1 end
 			new_ref = ref[i+1]
 		else
 			return nil, "invalid-table"