lib/types: add 'checkDefsForError' utility for checking defs with a given check

This commit is contained in:
Johannes Kirschbauer
2025-08-13 15:09:20 +02:00
parent 8fa33000a3
commit 648dbed1d6
+7
View File
@@ -100,6 +100,13 @@ let
}is accessed, use `${lib.optionalString (loc != null) "type."}nestedTypes.elemType` instead.
'' payload.elemType;
checkDefsForError =
check: loc: defs:
let
invalidDefs = filter (def: !check def.value) defs;
in
if invalidDefs != [ ] then "Definition values: ${showDefs invalidDefs}" else null;
outer_types = rec {
isType = type: x: (x._type or "") == type;