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

Required<...> doesn't work anymore when using --exactOptionalPropertyTypes #52494

Open
DerGernTod opened this issue Jan 30, 2023 · 0 comments
Open

Comments

@DerGernTod
Copy link

Bug Report

πŸ”Ž Search Terms

exactOptionalPropertyTypes, Required

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about exactOptionalPropertyTypes (didn't find any)

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

declare const someVal: Required<{
    fn?(key: string): string | null;
}>;
someVal.fn(""); // Cannot invoke an object which is possibly 'undefined'.(2722)

πŸ™ Actual behavior

TS shows the an error for the function call: Cannot invoke an object which is possibly 'undefined'.(2722)

πŸ™‚ Expected behavior

I expect no error because the type definition already makes clear that all functions in that type are required, none optional.

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