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 <mtlewis@users.noreply.github.com>
This commit is contained in:
@@ -70,7 +70,7 @@ export class PermissionClient {
|
||||
}
|
||||
|
||||
// @public
|
||||
export type PermissionCondition<TParams> = {
|
||||
export type PermissionCondition<TParams extends unknown[] = unknown[]> = {
|
||||
rule: string;
|
||||
params: TParams;
|
||||
};
|
||||
|
||||
@@ -54,7 +54,7 @@ export type AuthorizeRequest = {
|
||||
* claims from a identity token.
|
||||
* @public
|
||||
*/
|
||||
export type PermissionCondition<TParams> = {
|
||||
export type PermissionCondition<TParams extends unknown[] = unknown[]> = {
|
||||
rule: string;
|
||||
params: TParams;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user