Skip to content

Commit be0ce7b

Browse files
harlan-zwTogeticclaude
authored
fix(registry): don't declare the global Window via extends (1.x backport) (#880)
Co-authored-by: Togetic <31132515+Togetic@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 9acc5bf commit be0ce7b

21 files changed

Lines changed: 286 additions & 20 deletions

‎packages/script/src/runtime/registry/ahrefs-analytics.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ export interface AhrefsAnalyticsApi {
2929
}
3030

3131
declare global {
32-
interface Window extends AhrefsAnalyticsApi {}
32+
// Declared inline rather than via `extends`: an `extends` clause on the global `Window`
33+
// surfaces as an unsuppressable TS2430 in consumer code when another package declares it (#852).
34+
interface Window {
35+
AhrefsAnalytics: AhrefsAnalyticsApi['AhrefsAnalytics']
36+
}
3337
}
3438

3539
/**

‎packages/script/src/runtime/registry/calendly.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ export interface CalendlyApi {
7676
}
7777

7878
declare global {
79-
interface Window extends CalendlyApi {}
79+
// Declared inline rather than via `extends`: an `extends` clause on the global `Window`
80+
// surfaces as an unsuppressable TS2430 in consumer code when another package declares it (#852).
81+
interface Window {
82+
Calendly: CalendlyApi['Calendly']
83+
}
8084
}
8185

8286
const CALENDLY_CSS_KEY = 'nuxt-scripts-calendly-css'

‎packages/script/src/runtime/registry/clarity.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ export interface ClarityApi {
2525
}
2626

2727
declare global {
28-
interface Window extends ClarityApi {}
28+
// Declared inline rather than via `extends`: an `extends` clause on the global `Window`
29+
// surfaces as an unsuppressable TS2430 in consumer code when another package declares it (#852).
30+
interface Window {
31+
clarity: ClarityApi['clarity']
32+
}
2933
}
3034

3135
export type ClarityInput = RegistryScriptInput<typeof ClarityOptions>

‎packages/script/src/runtime/registry/cloudflare-web-analytics.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ export interface CloudflareWebAnalyticsApi {
2020
}
2121

2222
declare global {
23-
interface Window extends CloudflareWebAnalyticsApi {}
23+
// Declared inline rather than via `extends`: an `extends` clause on the global `Window`
24+
// surfaces as an unsuppressable TS2430 in consumer code when another package declares it (#852).
25+
interface Window {
26+
__cfBeacon: CloudflareWebAnalyticsApi['__cfBeacon']
27+
}
2428
}
2529

2630
export type CloudflareWebAnalyticsInput = RegistryScriptInput<typeof CloudflareWebAnalyticsOptions>

‎packages/script/src/runtime/registry/google-adsense.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ export interface GoogleAdsenseApi {
1515
}
1616

1717
declare global {
18-
interface Window extends GoogleAdsenseApi {}
18+
// Declared inline rather than via `extends`: an `extends` clause on the global `Window`
19+
// surfaces as an unsuppressable TS2430 in consumer code when another package declares it (#852).
20+
interface Window {
21+
adsbygoogle: GoogleAdsenseApi['adsbygoogle']
22+
}
1923
}
2024

2125
/**

‎packages/script/src/runtime/registry/google-recaptcha.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ export interface GoogleRecaptchaApi {
1919
}
2020

2121
declare global {
22-
interface Window extends GoogleRecaptchaApi {}
22+
// Declared inline rather than via `extends`: an `extends` clause on the global `Window`
23+
// surfaces as an unsuppressable TS2430 in consumer code when another package declares it (#852).
24+
interface Window {
25+
grecaptcha: GoogleRecaptchaApi['grecaptcha']
26+
}
2327
}
2428

2529
export function useScriptGoogleRecaptcha<T extends GoogleRecaptchaApi>(_options?: GoogleRecaptchaInput) {

‎packages/script/src/runtime/registry/google-tag-manager.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ export interface GoogleTagManagerApi {
8282
* instead, which is also the only access path that respects a custom dataLayer name.
8383
*/
8484
declare global {
85-
interface Window extends Pick<GoogleTagManagerApi, 'google_tag_manager'> {}
85+
// Declared inline rather than via `extends`: an `extends` clause on the global `Window`
86+
// surfaces as an unsuppressable TS2430 in consumer code when another package declares it (#852).
87+
interface Window {
88+
google_tag_manager: GoogleTagManagerApi['google_tag_manager']
89+
}
8690
}
8791

8892
export { GoogleTagManagerOptions }

‎packages/script/src/runtime/registry/hotjar.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ export interface HotjarApi {
1111
}
1212

1313
declare global {
14-
interface Window extends HotjarApi {
14+
// Declared inline rather than via `extends`: an `extends` clause on the global `Window`
15+
// surfaces as an unsuppressable TS2430 in consumer code when another package declares it (#852).
16+
interface Window {
17+
hj: HotjarApi['hj']
1518
_hjSettings: { hjid: number, hjsv?: number }
1619
}
1720
}

‎packages/script/src/runtime/registry/intercom.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ export interface IntercomApi {
3434
}
3535

3636
declare global {
37-
interface Window extends IntercomApi {
37+
// Declared inline rather than via `extends`: an `extends` clause on the global `Window`
38+
// surfaces as an unsuppressable TS2430 in consumer code when another package declares it (#852).
39+
interface Window {
40+
Intercom: IntercomApi['Intercom']
3841
intercomSettings?: any
3942
}
4043
}

‎packages/script/src/runtime/registry/linkedin-insight.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export interface LinkedInInsightApi {
2929
}
3030

3131
declare global {
32-
interface Window extends LinkedInInsightApi {
32+
// Declared inline rather than via `extends`: an `extends` clause on the global `Window`
33+
// surfaces as an unsuppressable TS2430 in consumer code when another package declares it (#852).
34+
interface Window {
35+
lintrk: LinkedInInsightApi['lintrk']
3336
_linkedin_partner_id?: string
3437
_linkedin_data_partner_ids?: string[]
3538
_linkedin_event_id?: string

0 commit comments

Comments
 (0)