// !OPT_IN: kotlin.js.ExperimentalJsExport // FIR_IDENTICAL @file:JsExport interface Optional { @JsName("valueOrThrowException") fun valueOrThrow(exp: Throwable): T fun valueOrThrow(): T = valueOrThrow(NoSuchElementException("Optional has no value")) } abstract class None private constructor() : Optional { companion object : None() override fun valueOrThrow(exp: Throwable): Nothing = throw exp }