You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interfaceA{apple: number;banana: number;}typePicked=Pick<A,'banana'>;functioncheck(args: Picked){}// --------------------------------------------------constv={banana: 1,apple: 1};check({banana: 1,apple: 1})// Works as intendedcheck(v)// should give an error like above// --------------------------------------------------// Works as intendedconsta: Picked={apple: 'bla',orange: 8,}
🙁 Actual behavior
check(v) do not raise an error
🙂 Expected behavior
check(v) should raise an error
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
There’s a reason the error message specifies “Object literal can only specify known properties”; v is not an object literal. You’d need #12936 to enforce this across the board.
Using Pick on a function argument and then giving it a defined variable with excess properties do not give error like if I write it inline.
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?ssl=22&ssc=1&pln=1&pc=1#code/FASwdgLgpgTgZgQwMZQAQEFUG9itQgBwIBsoAuVMAVwFsAjWAbl1ToTHYQuvqeAF9gwCAE8CaAAogkAaygATVAF5UU2QB50AGlQByNhw66AfM2BwqYJBBAB7MKiQALKLIAUCGAHMAzhTVy8gCU2ILAAPThqAC0sXHxCYlJySkJwEj2PhCoAG7K2KycHBQAjDqEJOSoJaj8zM6uMm5YhYZc1eVEpKW1IZGoAOq2MDI++GPg0GDyCuku7jkhqP0+TrZUxIpeIDlo7KiwMMOoxCBy+HS2uxFRqXf3D-FC-UMjYwgTkFDTsxlgWfh-NJAvkcHgKt09HRiAhdFoWMN2F4qgAOeFhFgsIA
💻 Code
🙁 Actual behavior
check(v) do not raise an error
🙂 Expected behavior
check(v) should raise an error
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: