Comparing version 3.2.10 to 3.2.11
@@ -15,2 +15,7 @@ # Changelog | ||
# 3.2.11 | ||
- **Bug Fix** | ||
- allow declare'd unions with custom dispatch, fix #242 (@gcanti) | ||
# 3.2.10 | ||
@@ -17,0 +22,0 @@ |
@@ -7,2 +7,3 @@ var assert = require('./assert'); | ||
var getTypeName = require('./getTypeName'); | ||
var isUnion = require('./isUnion'); | ||
@@ -23,2 +24,5 @@ // All the .declare-d types should be clearly different from each other thus they should have | ||
assert(!isNil(type), function () { return 'Type declared but not defined, don\'t forget to call .define on every declared type'; }); | ||
if (isUnion(type)) { | ||
assert(type.dispatch === Declare.dispatch, function () { return 'Please define the custom ' + name + '.dispatch function before calling ' + name + '.define()'; }); | ||
} | ||
} | ||
@@ -35,2 +39,5 @@ return type(value, path); | ||
if (isUnion(spec) && Declare.hasOwnProperty('dispatch')) { | ||
spec.dispatch = Declare.dispatch; | ||
} | ||
type = spec; | ||
@@ -37,0 +44,0 @@ mixin(Declare, type, true); // true because it overwrites Declare.displayName |
{ | ||
"name": "tcomb", | ||
"version": "3.2.10", | ||
"version": "3.2.11", | ||
"description": "Type checking and DDD for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89551
1936