© 2026 Hedgehog Software, LLC
const [hej, do] = myFunc()
const obj = myFunc() // obj.hej and obj.do exist
export const trytm = async <T>( promise: Promise<T>, ): Promise<TryResult<T>> => { const getResult = (data: T | null, error: Error | null) => ({ data, error, [Symbol.iterator]: function* () { yield this.data; yield this.error; } }) try { const data = await promise; return getResult(data, null); } catch (throwable) { if (throwable instanceof Error) { return getResult(null, throwable); } throw throwable; } };
Symbol