I’m trying to get typechecking to work for the __call metamethod.
example code:
local callTest = require(script.Parent.callTest)
local myObject = callTest.new()
print(myObject:__call("this string got added"))
print(myObject("this string got added"))
Both of these print statements output the same thing:
“print this string!this string got added”
The only difference is that the second one has no typechecking.
callTest module code:
type test = {
testvalue: string,
__call: (addString: string) -> string
}
local testModule = {}
testModule.__index = testModule
function testModule.new(): test
local self = setmetatable({}, testModule)
self.printValue = "print this string!"
return self
end
function testModule:__call(addString: string): string
return self.printValue .. addString
end
return testModule
Screenshots of the issue:

