lib/types: simplify eitherRecursive by defining it only once

This commit is contained in:
Matt Sturgeon 2024-09-12 13:05:21 +01:00
parent a5152c2f8e
commit 27a0dd435d
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
3 changed files with 10 additions and 5 deletions

View file

@ -95,8 +95,15 @@ rec {
strLua = strLikeType "lua code string";
strLuaFn = strLikeType "lua function string";
# Overridden when building the documentation
eitherRecursive = types.either;
# When building the documentation `either` is extended to return the nestedType's sub-options
# This type can be used to avoid infinite recursion when evaluating the docs
# TODO: consider deprecating this in favor of using `config.isDocs` in option declarations
eitherRecursive =
t1: t2:
types.either t1 t2
// {
getSubOptions = _: { };
};
listOfLen =
elemType: len: