ngneat / falso

All the Fake Data for All Your Real Needs 🙂

Home Page:https://ngneat.github.io/falso/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`rand` Should Likely Support `readonly` Arrays/Tuples

joealden opened this issue · comments

Is this a regression?

No

Description

Take the following example:

import { rand } from "@ngneat/falso";

const values = ["a", "b", "c"] as const;
const randomValue = rand(values);

Typescript returns the following type error at the rand callsite:

The type 'readonly ["a", "b", "c"]' is 'readonly' and cannot be assigned to the mutable type 'unknown[]'.

I believe that this should be supported, as I don't think this library relies on the array being mutable.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

@shaharkazaz is about to create a PR that solves this issue.