Skip to content

Commit

Permalink
fix: types for loading script module
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Mar 21, 2024
1 parent 8112a5c commit 69f2a16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/analytics-js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export { type PluginName } from '@rudderstack/analytics-js-common/types/PluginsM
export { type IdentifyTraits } from '@rudderstack/analytics-js-common/types/traits';
export { RudderAnalytics } from './app/RudderAnalytics';
export { type IRudderStackGlobals } from './app/IRudderStackGlobals';
export { type RudderAnalyticsPreloader } from './components/preloadBuffer/types';
export {
type RudderAnalyticsPreloader,
type PreloadedEventCall,
} from './components/preloadBuffer/types';

declare global {
interface Window {
Expand Down
4 changes: 2 additions & 2 deletions packages/loading-scripts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const sdkName = 'rsa.min.js';
const asyncScript = true;
window.rudderAnalyticsBuildType = 'legacy';

window.rudderanalytics = [];
(window.rudderanalytics as unknown as PreloadedEventCall[]) = [];
const methods: string[] = [
'setDefaultInstanceKey',
'load',
Expand All @@ -39,7 +39,7 @@ for (let i = 0; i < methods.length; i++) {
const method = methods[i] as string;
(window.rudderanalytics as unknown as RudderAnalyticsPreloader)[method] = (methodName =>
function () {
(window.rudderanalytics as PreloadedEventCall[]).push(
(window.rudderanalytics as unknown as PreloadedEventCall[]).push(
[methodName].concat(Array.prototype.slice.call(arguments) as PreloadedEventCall),
);
})(method);
Expand Down

0 comments on commit 69f2a16

Please sign in to comment.