mirror of
https://github.com/strapi/strapi.git
synced 2025-10-29 17:04:13 +00:00
enhancement: allow to configure AttributeUtils.GetValue guard
This commit is contained in:
parent
64d75d007f
commit
336b8c7c3e
@ -53,7 +53,10 @@ export type GetValues<TSchemaUID extends Common.UID.Schema> = {
|
||||
*
|
||||
* Fallback to unknown if never is found
|
||||
*/
|
||||
export type GetValue<TAttribute extends Attribute.Attribute> = Utils.Expression.If<
|
||||
export type GetValue<
|
||||
TAttribute extends Attribute.Attribute,
|
||||
TGuard = unknown
|
||||
> = Utils.Expression.If<
|
||||
Utils.Expression.IsNotNever<TAttribute>,
|
||||
Utils.Expression.MatchFirst<
|
||||
[
|
||||
@ -112,7 +115,7 @@ export type GetValue<TAttribute extends Attribute.Attribute> = Utils.Expression.
|
||||
],
|
||||
// Fallback
|
||||
// If none of the above attribute type, fallback to the original Attribute.GetValue (while making sure it's an attribute)
|
||||
[Utils.Expression.True, Attribute.GetValue<TAttribute, unknown>]
|
||||
[Utils.Expression.True, Attribute.GetValue<TAttribute, TGuard>]
|
||||
],
|
||||
unknown
|
||||
>,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user