We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e201f45 commit eec516eCopy full SHA for eec516e
packages/react/src/ReactPostpone.js
@@ -9,16 +9,15 @@
9
10
import {REACT_POSTPONE_TYPE} from 'shared/ReactSymbols';
11
12
-export type Postpone = {
13
- $$typeof: symbol,
14
- message: string,
15
- stack: string,
16
- ...
17
-};
+declare class Postpone extends Error {
+ $$typeof: symbol;
+}
+
+export type {Postpone};
18
19
export function postpone(reason: string): void {
20
// eslint-disable-next-line react-internal/prod-error-codes
21
- const error = new Error(reason);
22
- (error: any).$$typeof = REACT_POSTPONE_TYPE;
23
- throw error;
+ const postponeInstance: Postpone = (new Error(reason): any);
+ postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
+ throw postponeInstance;
24
}
0 commit comments