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

upgrading to TS4 #588

Closed
joaomilho opened this issue Oct 20, 2020 · 5 comments
Closed

upgrading to TS4 #588

joaomilho opened this issue Oct 20, 2020 · 5 comments

Comments

@joaomilho
Copy link

joaomilho commented Oct 20, 2020

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?

@joaomilho joaomilho changed the title updating to TS4 upgrading to TS4 Oct 20, 2020
@nvie
Copy link
Owner

nvie commented Oct 26, 2020

I cannot replicate this behavior. I ran the following steps:

  1. Create a new, empty, directory
  2. yarn add typescript decoders
  3. yarn run tsc --init
  4. Create a test.ts file with the following content
  5. Run yarn run tsc

This doesn't give any type errors for me.

@nvie
Copy link
Owner

nvie commented Oct 26, 2020

Is there any additional information you can share?

@joaomilho
Copy link
Author

Let me try.

@joaomilho
Copy link
Author

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!

@nvie nvie mentioned this issue Feb 26, 2021
@joaomilho
Copy link
Author

joaomilho commented Jul 7, 2021

It's the strict option.

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

2 participants