Skip to content

Commit b72838b

Browse files
authored
fix(cdk/platform): preserve compatibility with angular versions less than 19.1 (#30401) (#30407)
Fixes that we were importing a symbol only available in Angular 19.1, even though our peer dependencies allow 19.0.x. Fixes #30388.
1 parent be49103 commit b72838b

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/cdk/platform/features/backwards-compatibility.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import {Renderer2, VERSION, ListenerOptions} from '@angular/core';
9+
import {Renderer2, VERSION} from '@angular/core';
10+
11+
// TODO(crisbeto): replace interface with the one from core when making breaking changes for v20.
12+
/** Options when binding events manually. */
13+
export interface _ListenerOptions {
14+
capture?: boolean;
15+
once?: boolean;
16+
passive?: boolean;
17+
}
1018

1119
// TODO(crisbeto): remove this function when making breaking changes for v20.
1220
/**
@@ -20,7 +28,7 @@ export function _bindEventWithOptions(
2028
target: EventTarget,
2129
eventName: string,
2230
callback: (event: any) => boolean | void,
23-
options: ListenerOptions,
31+
options: _ListenerOptions,
2432
): () => void {
2533
const major = parseInt(VERSION.major);
2634
const minor = parseInt(VERSION.minor);

tools/public_api_guard/cdk/platform.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
```ts
66

77
import * as i0 from '@angular/core';
8-
import { ListenerOptions } from '@angular/core';
98
import { Renderer2 } from '@angular/core';
109

1110
// @public
12-
export function _bindEventWithOptions(renderer: Renderer2, target: EventTarget, eventName: string, callback: (event: any) => boolean | void, options: ListenerOptions): () => void;
11+
export function _bindEventWithOptions(renderer: Renderer2, target: EventTarget, eventName: string, callback: (event: any) => boolean | void, options: _ListenerOptions): () => void;
1312

1413
// @public
1514
export function _getEventTarget<T extends EventTarget>(event: Event): T | null;
@@ -29,6 +28,16 @@ export function getSupportedInputTypes(): Set<string>;
2928
// @public
3029
export function _isTestEnvironment(): boolean;
3130

31+
// @public
32+
export interface _ListenerOptions {
33+
// (undocumented)
34+
capture?: boolean;
35+
// (undocumented)
36+
once?: boolean;
37+
// (undocumented)
38+
passive?: boolean;
39+
}
40+
3241
// @public
3342
export function normalizePassiveListenerOptions(options: AddEventListenerOptions): AddEventListenerOptions | boolean;
3443

0 commit comments

Comments
 (0)