| 371 | declare public readonly runAsyncUnsafe: () => Promise<ExtractDefaultTerminateType<E> | R>; |
| 372 | |
| 373 | private constructor(fn: () => Iterator<E, R, unknown>, magicWords?: string) { |
| 374 | if (magicWords !== "Yes, I’m sure I want to call the constructor of Effected directly.") |
| 375 | logger.warn( |
| 376 | "You should not call the constructor of `Effected` directly. Use `effected` instead.", |
| 377 | ); |
| 378 | |
| 379 | this[Symbol.iterator] = fn; |
| 380 | |
| 381 | this.runSync = (() => runSync(this as never)) as never; |
| 382 | this.runAsync = (() => runAsync(this as never)) as never; |
| 383 | this.runSyncUnsafe = () => runSync(this as never); |
| 384 | this.runAsyncUnsafe = () => runAsync(this as never); |
| 385 | } |
| 386 | |
| 387 | /** |
| 388 | * Create an {@link Effected} instance that just returns the value. |