feat: Add return typing strategies and implement sqrt with them #26
2 changed files with 3 additions and 1 deletions
|
@ -51,6 +51,7 @@ describe('complex type operations', () => {
|
||||||
assert(math.equal(ccis(Math.PI), cplx(-1)))
|
assert(math.equal(ccis(Math.PI), cplx(-1)))
|
||||||
math.config.returnTyping = ReturnTyping.free
|
math.config.returnTyping = ReturnTyping.free
|
||||||
assert.strictEqual(math.cis.resolve(NumberT), cis)
|
assert.strictEqual(math.cis.resolve(NumberT), cis)
|
||||||
|
assert.strictEqual(math.cis.resolve(NumberT, ReturnTyping.full), ccis)
|
||||||
assert.strictEqual(math.cis(2*Math.PI), 1)
|
assert.strictEqual(math.cis(2*Math.PI), 1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -155,7 +155,8 @@ export class TypeDispatcher {
|
||||||
const types = args.map(thisTypeOf)
|
const types = args.map(thisTypeOf)
|
||||||
return this.resolve(key, types)(...args)
|
return this.resolve(key, types)(...args)
|
||||||
}
|
}
|
||||||
standard.resolve = (types) => this.resolve(key, types)
|
standard.resolve =
|
||||||
|
(types, strategy) => this.resolve(key, types, strategy)
|
||||||
standard.isDispatcher = true
|
standard.isDispatcher = true
|
||||||
Object.defineProperty(this, key, {
|
Object.defineProperty(this, key, {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue