sanctuary-js / sanctuary-def

Run-time type system for JavaScript
MIT License
294 stars 23 forks source link

TypeError: Invalid value when using S.is and sanctuary-def #226

Closed cdbkr closed 5 years ago

cdbkr commented 5 years ago

I am playing around with these two packages:

and with a simple pipe:

S.pipe([
  S.parseJson(S.is($.String))
])
('true')

I am receiving this error: TypeError: Invalid value

is :: Type -> Any -> Boolean
      ^^^^
       1

1)  String ::

The value at position 1 is not a member of ‘Type’.

See https://github.com/sanctuary-js/sanctuary-def/tree/v0.18.1#Type for information about the Type type.

I am experiencing this with Replem, but also on Repl.it. Anything wrong with what I am doing or something in the used packages by sanctuary?

davidchambers commented 5 years ago

There's no guarantee that the latest versions of sanctuary and sanctuary-def are compatible. The prudent approach is to use the version of sanctuary-def upon which sanctuary itself depends.

https://github.com/sanctuary-js/sanctuary/blob/v0.15.1/package.json#L17:

    "sanctuary-def": "0.18.1",

Let me know whether depending on sanctuary-def@0.18.1 resolves the issue. :)

cdbkr commented 5 years ago

Thanks @davidchambers for the clarification :) Indeed with:

davidchambers commented 5 years ago

I'm pleased that things are working now. :)

Will next version of sanctuary be aligned to latest sanctuary-def ?

Yes, it will.