Skip to content

Commit cc19d18

Browse files
Updated Value handling
1 parent 84a3061 commit cc19d18

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cosmicmind/domainjs",
3-
"version": "0.0.1-rc-030725-4",
3+
"version": "0.0.1-rc-030725-4.1",
44
"description": "A domain-driven design framework for scalable systems.",
55
"keywords": [
66
"typescript",

src/Value.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ export const defineValue = <V extends Value<ValueTypeFor<V>>>(_class: ValueConst
129129
*/
130130
function createValueHandler<V extends Value<ValueTypeFor<V>>, T extends ValueTypeFor<V> = ValueTypeFor<V>>(handler: ValueLifecycle<V>): ProxyHandler<V> {
131131
return {
132-
set(target: V, key: 'value', value: T): boolean | never {
133-
if (false === handler.validator?.(value, target)) {
132+
set(target: V, key: string | symbol, value: T): boolean | never {
133+
if ('value' === key && false === handler.validator?.(value, target)) {
134134
throw new ValueError(`${String(key)} is invalid`)
135135
}
136136
return Reflect.set(target, key, value)

0 commit comments

Comments
 (0)