Files
react-native-devtools-frontend/front_end/models/issues_manager/IssuesManagerEvents.ts
T
Tony Ross e4f74639df Remove circular dependency between IssuesManager and SourceFrameIssuesManager
This change extracts the IssuesManager Events enum into a separate file
to break the circular dependency of values between IssuesManager.ts and
SourceFrameIssuesManager.ts. This helps reduce existing circular
dependencies, in theory moving us slightly closer to being able to
warn about such cycles at build-time to avoid unexpected errors.

This particular cycle recently led to a runtime error when attempting to
subclass IssuesManager to introduce additional functionality. This
subclass was included in the cycle as SourceFrameIssuesManager was
updated to import the subclass instead of IssuesManager. At the time
the Events enum for IssuesManager was non-const, causing the circular
dependency to exist post-build. The error occurred because the extends
relationship of the subclass was evaluated during module initialization.

Since then the Events enum has been converted to const which eliminates
the runtime error. However, eliminating even this cycle is still
beneficial. The compile-time only relationship is not obvious and
cannot otherwise be communicated explicitly until values from const enums
can be used with `import type` per
https://github.com/microsoft/TypeScript/issues/40344.

Bug: 1229328
Change-Id: I033080c77f22584aa0527bcd0559698341d200f5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3040178
Commit-Queue: Tony Ross <tross@microsoft.com>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-07-21 16:12:29 +00:00

10 lines
314 B
TypeScript

// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
export const enum Events {
IssuesCountUpdated = 'IssuesCountUpdated',
IssueAdded = 'IssueAdded',
FullUpdateRequired = 'FullUpdateRequired',
}