Skip to content

TS error: _randomBoolean Expected 0 arguments, but got 1. #1661

@nathanbowang

Description

@nathanbowang

Bug Report

The same error did occurs in the @next version.

📝 Summary

Template:

import typia from 'typia'

type A = boolean
export const randomA = typia.createRandom<A>()

Generated:

import * as __typia_transform__randomBoolean from "typia/lib/internal/_randomBoolean.js";
import { Training } from "./pruneTypes/payload-types.js";
import typia from 'typia';
type A = boolean;
export const randomA = (() => { let _generator: Partial<import("typia").IRandomGenerator> | undefined; return (generator?: Partial<import("typia").IRandomGenerator>): import("typia").Resolved<A> => {
    _generator = generator;
    return (_generator?.boolean ?? __typia_transform__randomBoolean._randomBoolean)({
        type: "boolean"
    });
}; })();

And the generated code got a TS error: _randomBoolean Expected 0 arguments, but got 1.

  • Typia Version: 9.7.1
  • Expected behavior:
return (_generator?.boolean ?? __typia_transform__randomBoolean._randomBoolean)();
  • Actual behavior: the generated code have an extra argument.
return (_generator?.boolean ?? __typia_transform__randomBoolean._randomBoolean)({
    type: "boolean"
});

⏯ Playground Link

Example Link

Thanks

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions