gcanti / io-ts-types

A collection of codecs and combinators for use with io-ts
https://gcanti.github.io/io-ts-types/
MIT License
311 stars 40 forks source link

Make io-ts-types compatible with io-ts 1.4.0 #70

Closed mlegenhausen closed 6 years ago

mlegenhausen commented 6 years ago

The current npm version is not compatible with io-ts@1.4.0 cause it still uses mixed instead of unknown.

This pull request fixes this issue by upgrading to io-ts@1.4.0 and increase the minimum typescript version to 3.0.1. When now build the typings include the correct unknown type.

gcanti commented 6 years ago

@mlegenhausen ok for the typescript upgrade, but why "io-ts": "^1.4.0"? Could you please explain

The current npm version is not compatible with io-ts@1.4.0 cause it still uses mixed instead of unknown

t.mixed is unknown

mlegenhausen commented 6 years ago

If I don't upgrade io-ts I get the following error in combination with io-ts@1.4.0

// src/types.ts
createOptionFromNullable(t.string)

// src/types.ts(10,41): error TS2345: Argument of type 'StringType' is not assignable to parameter of type 'Type<string, any, mixed>'.

If I upgrade to io-ts@1.4.0 the mixed changed to the correct unknown type.

mlegenhausen commented 6 years ago

Ah ok the problem is that two version of io-ts get installed. io-ts@1.4.0 which I use directly and io-ts@1.1.4 which is defined by io-ts-types.

mlegenhausen commented 6 years ago

Ok solved the problem of the duplicate io-ts installation now everything works. Only the update to typescript@3.0.1 is necessary.