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

Some number parameters/properties get truncated #28

Open
mihe opened this issue Mar 25, 2019 · 0 comments
Open

Some number parameters/properties get truncated #28

mihe opened this issue Mar 25, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@mihe
Copy link
Owner

mihe commented Mar 25, 2019

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;
@mihe mihe added the enhancement New feature or request label Mar 25, 2019
@mihe mihe self-assigned this Mar 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant