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

Partial<T> accepts arbitrary Function #13132

Closed
anvish opened this issue Dec 22, 2016 · 3 comments
Closed

Partial<T> accepts arbitrary Function #13132

anvish opened this issue Dec 22, 2016 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@anvish
Copy link

anvish commented Dec 22, 2016

TypeScript Version: 2.1.4

Code

interface State {
    num: number
}

function setState(state: Partial<State>) { }

setState((a, b) => ({ x: 7 })) // no errors

Expected behavior:
Does not compile.
Actual behavior:
Compiles without errors.

@mhegazy
Copy link
Contributor

mhegazy commented Dec 22, 2016

Duplicate of #12936

@mhegazy mhegazy added the Duplicate An existing issue was already created label Dec 22, 2016
@mhegazy mhegazy closed this as completed Dec 22, 2016
@anvish
Copy link
Author

anvish commented Feb 18, 2017

Not sure if this is really a duplicate of exact type proposal, because this code is checked correctly:

setState({ a: 1 }) //   Object literal may only specify known properties, and 'a' does not exist in type 'Partial<State>'.

@mhegazy
Copy link
Contributor

mhegazy commented May 26, 2017

U are correct sort about that. This is a duplicate of #7485 and should be fixed by #16047

@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
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants