With version 0.3.0, the string warning is valid with the next code:
const {parsedTypeParse} = require('levn')
const {parseType} = require('type-check')
const entry = '(String | Number, Undefined | {...})'
const ruleTypeDesc = `${entry} | [${entry}] | {...}`
const ruleType = parseType(ruleTypeDesc)
if(typeof rules === 'string') rules = parsedTypeParse(ruleType, rules)
After upgrading to 0.4.1, I get the next error:
Value "warning" does not type check against [{"structure":"tuple","of":[[{"type":"String"},{"type":"Number"}],[{"type":"Undefined"},{"structure":"fields","of":{},"subset":true}]]},{"structure":"array","of":[{"structure":"tuple","of":[[{"type":"String"},{"type":"Number"}],[{"type":"Undefined"},{"structure":"fields","of":{},"subset":true}]]}]},{"structure":"fields","of":{},"subset":true}].
What I was trying to do, is that the warning string gets parsed and converted as one-tuple with a warning string as its first and only value (or two-tuple of string-undefined, that's the same for this use case).
With version 0.3.0, the string
warningis valid with the next code:After upgrading to 0.4.1, I get the next error:
What I was trying to do, is that the
warningstring gets parsed and converted as one-tuple with awarningstring as its first and only value (or two-tuple of string-undefined, that's the same for this use case).