Skip to content

Commit 965e790

Browse files
committed
fix: simplify invariant and make it consistent
1 parent b96f459 commit 965e790

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/utils/invariant.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
const isProduction: boolean = process.env.NODE_ENV === 'production';
2-
const prefix = 'Invariant failed';
3-
41
export function invariant(
52
condition: boolean,
63
message: string,
74
): asserts condition {
85
if (condition) return;
96

10-
if (isProduction) throw new Error(prefix);
11-
12-
throw new Error(message ? `${prefix}: ${message}` : prefix);
7+
throw new Error(message);
138
}

0 commit comments

Comments
 (0)