Skip to content

Commit d63d6fd

Browse files
authored
refactor(tpc): remove augmentWindowTypes (#119)
1 parent d2a3bbb commit d63d6fd

File tree

4 files changed

+1
-9
lines changed

4 files changed

+1
-9
lines changed

src/tpc/google-analytics.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export default function googleAnalitycsRegistry() {
2020
},
2121
tpcKey: 'gtag',
2222
tpcTypeImport: 'GoogleAnalyticsApi',
23-
augmentWindowTypes: true,
2423
})
2524
},
2625
filename: 'nuxt-scripts/tpc/google-analytics.ts',

src/tpc/google-tag-manager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export default function googleTagManagerRegistry() {
2121
},
2222
tpcKey: 'gtm',
2323
tpcTypeImport: 'GoogleTagManagerApi',
24-
augmentWindowTypes: true,
2524
})
2625
},
2726
filename: 'nuxt-scripts/tpc/google-tag-manager.ts',

src/tpc/utils.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export interface ScriptContentOpts {
77
data: Output
88
scriptFunctionName: string
99
tpcTypeImport: string
10-
augmentWindowTypes?: boolean
1110
tpcKey: string
1211
/**
1312
* This will be stringified. The function must be pure.
@@ -56,12 +55,10 @@ export function getTpcScriptContent(input: ScriptContentOpts) {
5655
chunks.push(`const OptionSchema = object({${mainScript.params?.map(p => `${p}: any()`)}})`)
5756
}
5857

59-
if (input.augmentWindowTypes) {
60-
chunks.push(`
58+
chunks.push(`
6159
declare global {
6260
interface Window extends ${input.tpcTypeImport} {}
6361
}`)
64-
}
6562

6663
const clientInitCode: string[] = []
6764

test/unit/tpc.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ describe.each([
3535
},
3636
tpcKey: 'google-analytics',
3737
tpcTypeImport: 'GoogleAnalyticsInput',
38-
augmentWindowTypes: true,
3938
scriptFunctionName: 'useScriptGoogleAnalytics',
4039
use: () => { },
4140
stub: () => { },
@@ -60,7 +59,6 @@ describe.each([
6059
},
6160
tpcKey: 'google-analytics',
6261
tpcTypeImport: 'GoogleAnalyticsInput',
63-
augmentWindowTypes: true,
6462
scriptFunctionName: 'useScriptGoogleAnalytics',
6563
use: () => {
6664
return { dataLayer: window.dataLayer, gtag: window.gtag }
@@ -141,7 +139,6 @@ describe('script content generation with head positioning', () => {
141139
},
142140
tpcKey: 'google-analytics',
143141
tpcTypeImport: 'GoogleAnalyticsInput',
144-
augmentWindowTypes: true,
145142
scriptFunctionName: 'useScriptGoogleAnalytics',
146143
use: () => { },
147144
stub: () => { },

0 commit comments

Comments
 (0)