diff --git a/packages/core/src/util/closure.ts b/packages/core/src/util/closure.ts index de36d31b0d..19368bc807 100644 --- a/packages/core/src/util/closure.ts +++ b/packages/core/src/util/closure.ts @@ -15,6 +15,6 @@ * to something which is retained otherwise the call to `noSideEffects` will be removed by closure * compiler. */ -export function noSideEffects(fn: () => void): string { - return '' + {toString: fn}; -} \ No newline at end of file +export function noSideEffects(fn: () => T): T { + return {toString: fn}.toString() as unknown as T; +}