From ea77555fe33163470d7d1890a699f01396ec3255 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Thu, 11 Nov 2021 13:32:18 +0000 Subject: [PATCH] authz: restrict type of PermissionCondition params We need a guarantee that we'll be able to spread permission condition params when applying the condition via the `apply` or `toQuery` methods on the corresponding rule. As such, we need to enforce that the TParams type parameter is an array. This commit also supplies a default value of unknown[] for this type param to make it a bit more convenient to use the type in situations where the type of the params is not important. Signed-off-by: Mike Lewis --- packages/permission-common/api-report.md | 2 +- packages/permission-common/src/types/api.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/permission-common/api-report.md b/packages/permission-common/api-report.md index c859b71465..766fec220c 100644 --- a/packages/permission-common/api-report.md +++ b/packages/permission-common/api-report.md @@ -70,7 +70,7 @@ export class PermissionClient { } // @public -export type PermissionCondition = { +export type PermissionCondition = { rule: string; params: TParams; }; diff --git a/packages/permission-common/src/types/api.ts b/packages/permission-common/src/types/api.ts index be6267775a..6a8e7ab836 100644 --- a/packages/permission-common/src/types/api.ts +++ b/packages/permission-common/src/types/api.ts @@ -54,7 +54,7 @@ export type AuthorizeRequest = { * claims from a identity token. * @public */ -export type PermissionCondition = { +export type PermissionCondition = { rule: string; params: TParams; };