Skip to content

Commit cdf40e9

Browse files
committed
fix: update types for CCUsage.FormatterContext
1 parent 20c886c commit cdf40e9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lua/ccusage/formatters/verbose.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ local function format_time(timestamp)
3232
if not timestamp or timestamp == 0 then
3333
return "Unknown"
3434
end
35-
return os.date("%Y-%m-%d %H:%M:%S", timestamp)
35+
return os.date("%Y-%m-%d %H:%M:%S", timestamp) ---@diagnostic disable-line: return-type-mismatch
3636
end
3737

3838
---Format detailed usage statistics for verbose display
@@ -43,8 +43,8 @@ M.format = function(context)
4343
return nil
4444
end
4545

46-
local blocks_data = context.data
47-
local stats = context.stats
46+
local blocks_data = context.data or {}
47+
local stats = context.stats or {}
4848

4949
-- Get the most recent block for additional details
5050
local last_block = blocks_data.blocks[#blocks_data.blocks]

lua/ccusage/types.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
---@field time_ratio number time progress ratio as float (0.0-1.0)
6767

6868
---@class CCUsage.FormatterContext
69-
---@field data CCUsage.Data -- Raw JSON data from ccusage command
70-
---@field stats CCUsage.Stats -- Pre-computed stats from data for convenience
69+
---@field data CCUsage.Data? -- Raw JSON data from ccusage command
70+
---@field stats CCUsage.Stats? -- Pre-computed stats from data for convenience
7171

7272
-- lua/ccusage/utils.lua -------------------------------------------------------
7373

0 commit comments

Comments
 (0)