upgrading to TS4
joaomilho opened this issue · 5 comments
joaomilho commented
The following code works fine on TS 3.4.5:
type Example = {
eg: string;
};
const exampleDecoder: Decoder<Example> = object({
eg: string,
});
In TS 4.0.3 however, I got this message:
Type 'Decoder<{ eg?: string; }, unknown>' is not assignable to type 'Decoder<Example, unknown>'.
Type '{ eg?: string; }' is not assignable to type 'Example'.
Property 'eg' is optional in type '{ eg?: string; }' but required in type 'Example'.ts(2322)
Any ideas?
nvie commented
I cannot replicate this behavior. I ran the following steps:
- Create a new, empty, directory
yarn add typescript decoders
yarn run tsc --init
- Create a
test.ts
file with the following content - Run
yarn run tsc
This doesn't give any type errors for me.
nvie commented
Is there any additional information you can share?
joaomilho commented
Let me try.
joaomilho commented
Yeah, on an empty project it works fine here too. I'll take a look again and if I find anything I'll raise a new one. I guess we can close this one for now. Thanks for taking the time!
joaomilho commented
It's the strict
option.