Object.assign({}) seems to always return a type any #29348
Labels
Bug
A bug in TypeScript
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Milestone
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 3.3.0-dev.20190110
Search Terms: Object.assign
Code
Interestingly the code:
does report the expected error
Expected behavior: TypeScript should report an error because the type returned by
return Object.assign({});
does not mach{foo: string}
but instead the type any is assumed.Actual behavior: No error is shown
Playground Link: https://www.typescriptlang.org/play/index.html#src=function%20foo()%3A%20%7Bfoo%3A%20string%7D%20%7B%0D%0A%20%20%20%20return%20Object.assign(%7B%7D)%3B%0D%0A%7D%0D%0A
Related Issues: no
The text was updated successfully, but these errors were encountered: