Skip to content
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
1 change: 0 additions & 1 deletion src/tpc/google-analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default function googleAnalitycsRegistry() {
},
tpcKey: 'gtag',
tpcTypeImport: 'GoogleAnalyticsApi',
augmentWindowTypes: true,
})
},
filename: 'nuxt-scripts/tpc/google-analytics.ts',
Expand Down
1 change: 0 additions & 1 deletion src/tpc/google-tag-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default function googleTagManagerRegistry() {
},
tpcKey: 'gtm',
tpcTypeImport: 'GoogleTagManagerApi',
augmentWindowTypes: true,
})
},
filename: 'nuxt-scripts/tpc/google-tag-manager.ts',
Expand Down
5 changes: 1 addition & 4 deletions src/tpc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export interface ScriptContentOpts {
data: Output
scriptFunctionName: string
tpcTypeImport: string
augmentWindowTypes?: boolean
tpcKey: string
/**
* This will be stringified. The function must be pure.
Expand Down Expand Up @@ -56,12 +55,10 @@ export function getTpcScriptContent(input: ScriptContentOpts) {
chunks.push(`const OptionSchema = object({${mainScript.params?.map(p => `${p}: any()`)}})`)
}

if (input.augmentWindowTypes) {
chunks.push(`
chunks.push(`
declare global {
interface Window extends ${input.tpcTypeImport} {}
}`)
}

const clientInitCode: string[] = []

Expand Down
3 changes: 0 additions & 3 deletions test/unit/tpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ describe.each([
},
tpcKey: 'google-analytics',
tpcTypeImport: 'GoogleAnalyticsInput',
augmentWindowTypes: true,
scriptFunctionName: 'useScriptGoogleAnalytics',
use: () => { },
stub: () => { },
Expand All @@ -60,7 +59,6 @@ describe.each([
},
tpcKey: 'google-analytics',
tpcTypeImport: 'GoogleAnalyticsInput',
augmentWindowTypes: true,
scriptFunctionName: 'useScriptGoogleAnalytics',
use: () => {
return { dataLayer: window.dataLayer, gtag: window.gtag }
Expand Down Expand Up @@ -141,7 +139,6 @@ describe('script content generation with head positioning', () => {
},
tpcKey: 'google-analytics',
tpcTypeImport: 'GoogleAnalyticsInput',
augmentWindowTypes: true,
scriptFunctionName: 'useScriptGoogleAnalytics',
use: () => { },
stub: () => { },
Expand Down