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

Type mismatch #8590

Closed
plantain-00 opened this issue May 13, 2016 · 2 comments
Closed

Type mismatch #8590

plantain-00 opened this issue May 13, 2016 · 2 comments

Comments

@plantain-00
Copy link
Contributor

TypeScript Version:

1.8.10

Code

function f(a: { b?: string; c?: number; }){
    // something else
}
f({b: ""}); //  no error as intended
f({b: 1}); //  error as intended
f(1); // expected: error, actually: no error
f(""); // expected: error, actually: no error

Expected behavior:
see comments in the code.
Actual behavior:
see comments in the code.

@malibuzios
Copy link

TypeScript currently treats all-optional types similarly to {} types (which are almost as weak as any in practice):

There have been past attempts to address this:

@plantain-00
Copy link
Contributor Author

Seems duplicate.
I searched as a key word "Type mismatch", but didn't find those.
I will close this issue, and focus on #7485.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants