Skip to content

Commit

Permalink
chore(start): Avoid duplication for envOnly functions. (#2957)
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 authored Dec 8, 2024
1 parent ad3f277 commit 2663b94
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions packages/start/src/client/envOnly.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
type EnvOnlyFn = <TFn extends (...args: Array<any>) => any>(fn: TFn) => TFn

// A function that will only be available in the server build
// If called on the client, it will throw an error

export function serverOnly<TFn extends (...args: Array<any>) => any>(
fn: TFn,
): TFn {
return fn
}
export const serverOnly: EnvOnlyFn = (fn) => fn

// A function that will only be available in the client build
// If called on the server, it will throw an error

export function clientOnly<TFn extends (...args: Array<any>) => any>(
fn: TFn,
): TFn {
return fn
}
export const clientOnly: EnvOnlyFn = (fn) => fn

0 comments on commit 2663b94

Please sign in to comment.