Skip to content

Correct AuthorizationError field declarations for ES 2022 #24405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 22, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/loader/driver-utils/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,16 @@ export class AuthorizationError
implements IAuthorizationError, IFluidErrorBase
{
readonly errorType = DriverErrorTypes.authorizationError;
readonly claims?: string;
readonly tenantId?: string;

// These properties are not assigned in this class, but instead assigned in the super constructor.
// When targeting ES 2022 or later, TypeScript generates ES6 class fields for these properties.
// This override the own properties dynamically created by the super constructor.
// To prevent this undesired overriding,
// // these are declared using `declare` to indicate this definition is only for the TypeScript typing,
// and the actual fields come from elsewhere.
declare readonly claims?: string;
declare readonly tenantId?: string;

readonly canRetry = false;

constructor(
Expand Down
Loading