Annotating returning 'self'? #1503
-
Hi, here's a description of my issue: ---@class Foo
Foo = {}
---@return Foo --<-- I want to annotate this that it returns 'self' so it propagates to inherited types
function Foo.new() end
---@class Bar : Foo
Bar = {}
local b = Bar.new() --<-- the definition of .new from Foo is used, which returns Foo
-- b is type Foo, not Bar Is this possible at the moment, I haven't seen anything in the docs or from a search? I see that I can: ---@type Foo
---@diagnostic disable-next-line: assign-type-mismatch
local b = Bar.new() ... and for removing the warning from the cast, I can make the change the return type of Cheers. |
Beta Was this translation helpful? Give feedback.
Answered by
sumneko
Aug 29, 2022
Replies: 1 comment 1 reply
-
Not supported now, please open an issue about it. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
paul-reilly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not supported now, please open an issue about it.