Importing Namespaces with Dynamic Imports
Is anyone aware of any way to import namespaces with dynamic imports?
E.g. this is invalid:
But this is fine:
E.g. this is invalid:
const Brand = await import("effect/Brand")
type Int = number & Brand.Brand<"Int">
const Int = Brand.refined<Int>(
(n) => Number.isInteger(n),
(n) => Brand.error(`Expected ${n} to be an integer`)
)
assert.strictEqual(Int(1), 1)
assert.throws(() => Int(1.1)) const Brand = await import("effect/Brand")
type Int = number & Brand.Brand<"Int">
const Int = Brand.refined<Int>(
(n) => Number.isInteger(n),
(n) => Brand.error(`Expected ${n} to be an integer`)
)
assert.strictEqual(Int(1), 1)
assert.throws(() => Int(1.1))But this is fine:
import * as Brand from "effect/Brand"
type Int = number & Brand.Brand<"Int">
const Int = Brand.refined<Int>(
(n) => Number.isInteger(n),
(n) => Brand.error(`Expected ${n} to be an integer`)
)
assert.strictEqual(Int(1), 1)
assert.throws(() => Int(1.1)) import * as Brand from "effect/Brand"
type Int = number & Brand.Brand<"Int">
const Int = Brand.refined<Int>(
(n) => Number.isInteger(n),
(n) => Brand.error(`Expected ${n} to be an integer`)
)
assert.strictEqual(Int(1), 1)
assert.throws(() => Int(1.1))