Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in 0.4.0 #12

Open
piranna opened this issue May 1, 2020 · 3 comments
Open

Regression in 0.4.0 #12

piranna opened this issue May 1, 2020 · 3 comments

Comments

@piranna
Copy link

piranna commented May 1, 2020

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).

@piranna
Copy link
Author

piranna commented May 4, 2020

I've done a bisect and found the first commit where tests of my project are failling is at 6a2c33c

@piranna
Copy link
Author

piranna commented May 4, 2020

With the (String | Number, Undefined | {...}) | [(String | Number, Undefined | {...})] | {...} type, [("warning")] works, and the same for ["warning"], but it doesn't work for ("warning").

piranna added a commit to projectlint/projectlint that referenced this issue May 4, 2020
`type-check` has a regression, gkz/type-check#12
@piranna
Copy link
Author

piranna commented Aug 31, 2020

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant