Skip to content

fix: update alert method signature to accept string type #2006

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 1 commit into from
Apr 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28395,7 +28395,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */
readonly window: Window & typeof globalThis;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/alert) */
alert(message?: any): void;
alert(message?: string): void;
/**
* @deprecated
*
Expand Down Expand Up @@ -30048,7 +30048,7 @@ declare var visualViewport: VisualViewport | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */
declare var window: Window & typeof globalThis;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/alert) */
declare function alert(message?: any): void;
declare function alert(message?: string): void;
/**
* @deprecated
*
Expand Down
4 changes: 2 additions & 2 deletions baselines/ts5.5/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28373,7 +28373,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */
readonly window: Window & typeof globalThis;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/alert) */
alert(message?: any): void;
alert(message?: string): void;
/**
* @deprecated
*
Expand Down Expand Up @@ -30026,7 +30026,7 @@ declare var visualViewport: VisualViewport | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */
declare var window: Window & typeof globalThis;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/alert) */
declare function alert(message?: any): void;
declare function alert(message?: string): void;
/**
* @deprecated
*
Expand Down
4 changes: 2 additions & 2 deletions baselines/ts5.6/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28395,7 +28395,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */
readonly window: Window & typeof globalThis;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/alert) */
alert(message?: any): void;
alert(message?: string): void;
/**
* @deprecated
*
Expand Down Expand Up @@ -30048,7 +30048,7 @@ declare var visualViewport: VisualViewport | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/window) */
declare var window: Window & typeof globalThis;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/alert) */
declare function alert(message?: any): void;
declare function alert(message?: string): void;
/**
* @deprecated
*
Expand Down
2 changes: 1 addition & 1 deletion inputfiles/overridingTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@
"method": {
"alert": {
"overrideSignatures": [
"alert(message?: any): void"
"alert(message?: string): void"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case we can just remove this whole method. But have you checked why this is added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked it, and the message is required by default. But the alert works even if it isn't required.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? It seems it has been like that forever without a documented reason though. c9dcdfd

Anyway, please remove the whole method overridding and it'll become string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Err, actually the spec makes it multiple overloads instead of using an optional param. For now let's just do this.

]
},
"postMessage": {
Expand Down