Skip to content

expected table return value is not detecting missing fields #3383

Closed

Description

@ChillerDragon
-- meta file describing lua to C++ plugin api

---@class Position
---@field x integer
---@field y integer

---@class CxxAbi
---@field get_pos fun(): Position
abi = {}

-- example lua plugin

function abi.get_pos()
	if false then
		return ""
	end
	return {
		missing = "fields"
	}
end
Image

I am trying to provide type hints for the callbacks that my users can implement. It checks the returned type but it does not warn if fields are missing in the returned type.

Activity

  1. changed the title [-]expected table return value is not type checked[/-] [+]expected table return value is not detecting missing fields[/+] on Mar 18, 2026
  2. tomlau10 commented on Mar 19, 2026

    @tomlau10
    Contributor

    enable type.checkTableShape in .luarc.json of your project
    for more details please see: #2802 (comment)

  3. ChillerDragon commented on Mar 19, 2026

    @ChillerDragon
    Author

    amazing thanks

  4. added a commit that references this issue on Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions