Skip to content

Commit

Permalink
feat: review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
akashrpo committed Feb 16, 2024
1 parent 9b194be commit 3ca8c08
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/generators/javascript/templates/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ export const defaultValidationErrorHandler: ViolationHandler = (message, violati
{{/unless}}
console.warn(msg)
}
{{/if}}

{{#if isDevelopment}}
let onViolation = defaultValidationErrorHandler
{{/if}}

Expand Down Expand Up @@ -276,13 +274,18 @@ const clientAPI = {
{{/each}}
}

export const Analytics = new Proxy<typeof clientAPI>(clientAPI, {
export const RudderTyperAnalytics = new Proxy<typeof clientAPI>(clientAPI, {
get(target, method) {
if (typeof method === 'string' && Object.keys(target).includes(method)) {
return target[method as keyof typeof clientAPI]
}

return () => {
{{#if isDevelopment}}
console.warn(`⚠️ You made an analytics call (${String(method)}) that can't be found. Either:
a) Re-generate your ruddertyper client: \`npx rudder-typer\`
b) Add it to your Tracking Plan: {{trackingPlanURL}}`)
{{/if}}
const a = analytics()
if (a) {
{{#if isBrowser}}
Expand Down

0 comments on commit 3ca8c08

Please sign in to comment.