I am wondering if we have a way to declare a typed function as @deprecated.
For example:
@[deprecated { use = "Moderation.banUserAsync(userId, reason, duration)"}]
local banUser: (userId: number, reason :string) -> boolean
Currently, to declare a normal function as @deprecated you’d do the following:
@[deprecated { use = "Moderation.banUserAsync(userId, reason, duration)"}]
local function banUser(userId: number, reason :string): boolean
return true
end
I’m trying to build type definitions for my SDK I am working on, and would love to avoid having to create “fake” functions for it to work.
type a = typeof(@deprecated function(a: number, b: string): boolean end)
local a: a
a()
local b: typeof(@deprecated function(a: number, b: string): boolean end)
b()
type test_1 = typeof((function()
@deprecated
local function _(a: number, b: string)
end
return _
end)())
local test_1: test_1 = nil :: any
test_1(1, "")
type test_2 = typeof((function()
@deprecated function _(a: number, b: string)
end
return _
end)())
local test_2: test_2 = nil :: any
test_2(1, "")
Also --!strict seems to prioritize argument count versus --!nonstrict where it always give deprecated API