Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to assert rgb union array type? #1448

Closed
daimalou opened this issue Dec 29, 2024 · 2 comments
Closed

[Question] How to assert rgb union array type? #1448

daimalou opened this issue Dec 29, 2024 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@daimalou
Copy link

Question

I have a rgb data type like [[128, 128, 128], [0, 0, 0]], how to assert using typia.

I get stuck in [number, number, number][].

@samchon samchon self-assigned this Dec 29, 2024
@samchon samchon added the question Further information is requested label Dec 29, 2024
@samchon
Copy link
Owner

samchon commented Dec 29, 2024

Define like below.

import typia, { tags } from "typia";

type RgbValue = number & tags.Type<"uint32"> & tags.Maximum<256>;
type RgbTuple = [RgbValue, RgbValue, RgbValue];

typia.createIs<Array<RgbTuple>>();

https://typia.io/playground/?script=JYWwDg9gTgLgBDAnmYBDANHA3g1BzAZzgF84AzKCEOAIiRVRoG4AoF+gUzgCU8AjAGqoANgFcuAXjgA7USD4cocAGS5CAOgAqyDgB4ao4NJgBmAEw0AfCrUF1AWVQAPUHN1mArADZLrTj35NUTBhSTgAbV5BEXFMKKExDjj+BPEAXVZ2ZDR1AGMoDlQYDgBJAl0AQSgoVERdKKCQjktLAAoASiYgA

@daimalou
Copy link
Author

@samchon Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants