From 39fd4ef17ab4cb28c7b60562692c3dbbbb88dfc8 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 25 Feb 2026 13:23:55 -0500 Subject: [PATCH] fix(recur): resolve LuaLS type errors Problem: LuaLS reported undefined-field for `_raw` on RecurSpec and param-type-mismatch for `last_day.day` in `advance_date` because `osdate.day` infers as `string|integer`. Solution: Add `_raw` to the RecurSpec class annotation and cast `last_day.day` to integer in both `math.min` call sites. --- lua/pending/recur.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/pending/recur.lua b/lua/pending/recur.lua index 46a5dd2..c0a2091 100644 --- a/lua/pending/recur.lua +++ b/lua/pending/recur.lua @@ -3,6 +3,7 @@ ---@field interval integer ---@field byday? string[] ---@field from_completion boolean +---@field _raw? string ---@class pending.recur local M = {} @@ -101,12 +102,12 @@ local function advance_date(base_date, freq, interval) new_y = new_y + 1 end local last_day = os.date('*t', os.time({ year = new_y, month = new_m + 1, day = 0 })) --[[@as osdate]] - local clamped_d = math.min(dn, last_day.day) + local clamped_d = math.min(dn, last_day.day --[[@as integer]]) return os.date('%Y-%m-%d', os.time({ year = new_y, month = new_m, day = clamped_d })) --[[@as string]] elseif freq == 'yearly' then local new_y = yn + interval local last_day = os.date('*t', os.time({ year = new_y, month = mn + 1, day = 0 })) --[[@as osdate]] - local clamped_d = math.min(dn, last_day.day) + local clamped_d = math.min(dn, last_day.day --[[@as integer]]) return os.date('%Y-%m-%d', os.time({ year = new_y, month = mn, day = clamped_d })) --[[@as string]] end return base_date