Bug Report
No error:
typeCustomType={name: string};interfaceMyFunc{(arg: string): CustomType;}constmyFunc: MyFunc=(arg)=>{return{name: arg,extraKey: 1234};};No error:
typeCustomType={name: string}typeMyFunc=(arg: string)=>CustomType;constmyFunc: MyFunc=(arg)=>{return{name: arg,extraKey: 1234};};Errors:
typeCustomType={name: string}constmyFunc=(arg: string): CustomType=>{return{name: arg,extraKey: 1234};};// error: Type '{ name: string; extraKey: number; }' is not assignable to type 'CustomType'.// Object literal may only specify known properties, and 'extraKey' does not exist in type 'CustomType'.🔎 Search Terms
Function types not erroring when using type or interface.
🕗 Version & Regression Information
Version 4.2.3
Tested from version 3.3.3 to 4.2.3
⏯ Playground Link
N/A
Playground link with relevant code
💻 Code
See above
🙁 Actual behavior
Only the last example fails.
🙂 Expected behavior
All examples above should error. The function returns an object with incorrect keys.
Bug Report
No error:
No error:
Errors:
🔎 Search Terms
Function types not erroring when using
typeorinterface.🕗 Version & Regression Information
Version 4.2.3
Tested from version 3.3.3 to 4.2.3
⏯ Playground Link
N/A
Playground link with relevant code
💻 Code
See above
🙁 Actual behavior
Only the last example fails.
🙂 Expected behavior
All examples above should error. The function returns an object with incorrect keys.