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
Related Issues:
I think this is a duplicate of #28839, which is marked as fixed. I asked for reopen in #28839 (comment) but got no rely. I'm assuming that closed issues are not on your radar so opening a new issue.
The text was updated successfully, but these errors were encountered:
This is working as intended. In your example, a type argument for T can be a subtype of Partial<Record<K, V[]>>, so properties of T might actually be subtypes of V[] (e.g. a specialized array with additional properties). The type safe way to write your example is:
TypeScript Version: 3.4.0-dev.20190202
Search Terms:
Record, Partial
Code
Expected behavior:
No errors.
Actual behavior:
index.ts:6:3 - error TS2322: Type 'V[]' is not assignable to type 'T[K]'.
Playground Link:
https://www.typescriptlang.org/play/#src=function%20f%3CK%20extends%20string%2C%20V%2C%20T%20extends%20Partial%3CRecord%3CK%2C%20V%5B%5D%3E%3E%3E(%0D%0A%20%20%20%20object%3A%20T%2C%0D%0A%20%20%20%20key%3A%20K%2C%0D%0A%20%20%20%20value%3A%20V%5B%5D%2C%0D%0A)%20%7B%0D%0A%20%20object%5Bkey%5D%20%3D%20value%3B%0D%0A%7D
Enabling all strictness flags still gives me the same error.
Related Issues:
I think this is a duplicate of #28839, which is marked as fixed. I asked for reopen in #28839 (comment) but got no rely. I'm assuming that closed issues are not on your radar so opening a new issue.
The text was updated successfully, but these errors were encountered: