Skip to content

Commit 8a5302a

Browse files
authored
refactor: use enum instead of const enum (#28052)
Const enums prevent enabling the `isolatedModules` check which is needed for fast TS compilation based on transpileModule API.
1 parent 99b62ba commit 8a5302a

File tree

44 files changed

+59
-53
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+59
-53
lines changed

src/cdk-experimental/popover-edit/edit-event-dispatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const FOCUS_DELAY = 0;
3535
* FOCUSABLE - Rendered in the dom and styled for its contents to be focusable but invisible.
3636
* ON - Rendered and fully visible.
3737
*/
38-
export const enum HoverContentState {
38+
export enum HoverContentState {
3939
OFF = 0,
4040
FOCUSABLE,
4141
ON,

src/cdk-experimental/popover-edit/focus-escape-notifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {FocusTrap, InteractivityChecker} from '@angular/cdk/a11y';
1212
import {Observable, Subject} from 'rxjs';
1313

1414
/** Value indicating whether focus left the target area before or after the enclosed elements. */
15-
export const enum FocusEscapeNotifierDirection {
15+
export enum FocusEscapeNotifierDirection {
1616
START,
1717
END,
1818
}

src/cdk/a11y/focus-monitor/focus-monitor.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export interface FocusOptions {
4343
}
4444

4545
/** Detection mode used for attributing the origin of a focus event. */
46-
export const enum FocusMonitorDetectionMode {
46+
export enum FocusMonitorDetectionMode {
4747
/**
4848
* Any mousedown, keydown, or touchstart event that happened in the previous
4949
* tick or the current tick will be used to assign a focus event's origin (to
@@ -623,7 +623,10 @@ export class CdkMonitorFocus implements AfterViewInit, OnDestroy {
623623

624624
@Output() readonly cdkFocusChange = new EventEmitter<FocusOrigin>();
625625

626-
constructor(private _elementRef: ElementRef<HTMLElement>, private _focusMonitor: FocusMonitor) {}
626+
constructor(
627+
private _elementRef: ElementRef<HTMLElement>,
628+
private _focusMonitor: FocusMonitor,
629+
) {}
627630

628631
get focusOrigin(): FocusOrigin {
629632
return this._focusOrigin;

src/cdk/a11y/high-contrast-mode/high-contrast-mode-detector.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {DOCUMENT} from '@angular/common';
1313
import {Subscription} from 'rxjs';
1414

1515
/** Set of possible high-contrast mode backgrounds. */
16-
export const enum HighContrastMode {
16+
export enum HighContrastMode {
1717
NONE,
1818
BLACK_ON_WHITE,
1919
WHITE_ON_BLACK,
@@ -49,7 +49,10 @@ export class HighContrastModeDetector implements OnDestroy {
4949
private _document: Document;
5050
private _breakpointSubscription: Subscription;
5151

52-
constructor(private _platform: Platform, @Inject(DOCUMENT) document: any) {
52+
constructor(
53+
private _platform: Platform,
54+
@Inject(DOCUMENT) document: any,
55+
) {
5356
this._document = document;
5457

5558
this._breakpointSubscription = inject(BreakpointObserver)

src/cdk/collections/view-repeater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export type _ViewRepeaterItemContextFactory<T, R, C extends _ViewRepeaterItemCon
5858
export type _ViewRepeaterItemValueResolver<T, R> = (record: IterableChangeRecord<R>) => T;
5959

6060
/** Indicates how a view was changed by a {@link _ViewRepeater}. */
61-
export const enum _ViewRepeaterOperation {
61+
export enum _ViewRepeaterOperation {
6262
/** The content of an existing view was replaced with another item. */
6363
REPLACED,
6464
/** A new view was created with `createEmbeddedView`. */

src/cdk/drag-drop/drop-list-ref.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ const DROP_PROXIMITY_THRESHOLD = 0.05;
3434
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
3535

3636
/** Vertical direction in which we can auto-scroll. */
37-
const enum AutoScrollVerticalDirection {
37+
enum AutoScrollVerticalDirection {
3838
NONE,
3939
UP,
4040
DOWN,
4141
}
4242

4343
/** Horizontal direction in which we can auto-scroll. */
44-
const enum AutoScrollHorizontalDirection {
44+
enum AutoScrollHorizontalDirection {
4545
NONE,
4646
LEFT,
4747
RIGHT,

src/cdk/menu/menu-stack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {Observable, Subject} from 'rxjs';
1111
import {debounceTime, distinctUntilChanged, startWith} from 'rxjs/operators';
1212

1313
/** The relative item in the inline menu to focus after closing all popup menus. */
14-
export const enum FocusNext {
14+
export enum FocusNext {
1515
nextItem,
1616
previousItem,
1717
currentItem,

src/cdk/platform/features/scrolling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
/** The possible ways the browser may handle the horizontal scroll axis in RTL languages. */
10-
export const enum RtlScrollAxisType {
10+
export enum RtlScrollAxisType {
1111
/**
1212
* scrollLeft is 0 when scrolled all the way left and (scrollWidth - clientWidth) when scrolled
1313
* all the way right.

src/cdk/schematics/update-tool/target-version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
/** Possible versions that can be automatically migrated by `ng update`. */
10-
// Used in an `Object.keys` call below so it can't be `const enum`.
10+
1111
// tslint:disable-next-line:prefer-const-enum
1212
export enum TargetVersion {
1313
V17 = 'version 17',

src/material/card/testing/card-harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import {CardHarnessFilters} from './card-harness-filters';
1515

1616
/** Selectors for different sections of the mat-card that can container user content. */
17-
export const enum MatCardSection {
17+
export enum MatCardSection {
1818
HEADER = '.mat-mdc-card-header',
1919
CONTENT = '.mat-mdc-card-content',
2020
ACTIONS = '.mat-mdc-card-actions',

0 commit comments

Comments
 (0)