-
-
Notifications
You must be signed in to change notification settings - Fork 292
Open
Labels
questionFurther information is requestedFurther information is requested
Description
I've encountered a problem and wanted to get your opinion on it. I have the following simplified example:
const Schema = v.pipe(v.tuple([]), v.readonly());
const createTuple = () => [] as const;
type Input = v.InferInput<typeof Schema>;
const input: Input = createTuple();
// ^ The type 'readonly []' is 'readonly' and cannot be assigned to the mutable type '[]'I've set up a Stackblitz here so you can play around with it: https://stackblitz.com/edit/stackblitz-starters-qhcxx34a?file=index.ts (you may need to log in to see the type error)
One possible solution would be for InferInput to always return a type wrapped in ReadonlyDeep. In my opinion, this is correct, as parse does not mutate the input as far as I understand.
Is this correct, or are there side effects that I haven't considered yet?
dosubot
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested