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

Expect type go to optional to be unoptional... #55007

Closed
hpachy opened this issue Jul 13, 2023 · 2 comments
Closed

Expect type go to optional to be unoptional... #55007

hpachy opened this issue Jul 13, 2023 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@hpachy
Copy link

hpachy commented Jul 13, 2023

Bug Report

🔎 Search Terms

-Make some properties optional in a TypeScript type
-typescript pick optional

🕗 Version & Regression Information

currrent version : "typescript": "^5.1.6"
Don t know if that bug existed before, just got the issue right now

⏯ Playground Link

Bug on the typescript playground

💻 Code

Code inside the playground

🙁 Actual behavior

Even if I condition the type I still got an error raise by typescript which is Type 'string | undefined' is not assignable to type 'string'

🙂 Expected behavior

I expect type go to optional to be unoptional

@MartinJohns
Copy link
Contributor

Duplicate of #42384 and many others.

It would be a fairly unsafe operation as well. fnTest could store a reference to the object to be used later, but meanwhile undefined could be assigned to the objects property.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jul 13, 2023
@typescript-bot
Copy link
Collaborator

This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants