write correct type name in error
This commit is contained in:
parent
2715ca401b
commit
4a9ea3604c
@ -88,18 +88,21 @@ export class GamelibAdapter {
|
||||
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
const expectedType = typeAliases[expectedTypes[i]] ?? expectedTypes[i];
|
||||
let expectedTypeName = typeAliases[expectedTypes[i]] ? expectedTypes[i] : null;
|
||||
|
||||
if (typeof expectedType === "string" && typeof args[i] !== expectedType) {
|
||||
expectedTypeName ??= expectedType;
|
||||
|
||||
this.#error(
|
||||
`Expected parameter #${
|
||||
i + 1
|
||||
} to be of type ${expectedType}, got ${typeof args[i]}`,
|
||||
} to be of type ${expectedTypeName}, got ${typeof args[i]}`,
|
||||
func,
|
||||
);
|
||||
}
|
||||
|
||||
if (expectedType instanceof Object && !(args[i] instanceof expectedType)) {
|
||||
const expectedTypeName = expectedType.prototype.constructor.name;
|
||||
expectedTypeName ??= expectedType.prototype.constructor.name;
|
||||
|
||||
this.#error(
|
||||
`Expected parameter #${
|
||||
|
Loading…
x
Reference in New Issue
Block a user