Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Some number parameters/properties get truncated #28

Description

@mihe

Due to JavaScript/TypeScript not really having a notion of an integer (outside of the recently added BigInt) it becomes a problem when you have functions like UKismetMathLibrary::Clamp, which only clamps int32.

This then shows up in the typings as:

static clamp(value: number, min: number, max: number): number;

... which looks harmless but will in fact truncate any decimals that gets sent into it. Outside of looking at the actual C++ declaration of the target function there is no way of knowing if something will truncate or not.

I'm not sure how to fix this, but one alternative would be to at least emit some kind of documentation, like:

/**
 * @param value Warning: Integer parameter, will truncate
 * @param min Warning: Integer parameter, will truncate
 * @param max Warning: Integer parameter, will truncate
 */
 static clamp(value: number, min: number, max: number): number;

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions