-
Notifications
You must be signed in to change notification settings - Fork 12.8k
False positive error report for interface type missing index signature, thus not assignable to object type with unknown
values.
#32263
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
Comments
I believe this is working as intended: object literal types have implicit index signatures, while interfaces do not. See the implementation here: #7029 |
Thanks @jack-williams , I didn't know about this specific assignability rule. Do you know if there is a comprehensive list of type assignability rules out there? I tried to search for one but couldn't find. |
Not really - If you want to know the absolute truth you need to go here: The spec is pretty good, although incomplete: And something to keep an eye on: |
I hate that |
The reason intellisense for TypeScript is so performant is because the TypeScript team want to have auto-completion while editing [1] I made that up |
I need to add this to the interfaces vs type aliases section.
I feel seen. Also we should make the binder incremental. |
TypeScript Version: 3.6.0-dev.20190704 (
3.4.3
doesn't have this bug)Search Terms:
index signature, unknown, assignable, interface
Code
Expected behavior:
No error expected, interface C extends A correctly.
Actual behavior:
Error because interface C does not extend interface A
Playground Link:
http://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgILIN4ChnIA5QD2e0YwEAzgPwBcmyA2gNIQCedFYUoA5gLp0AriADWIQgHcQyAL4BuLDKxYwrEsgBCcKMgC8mHMhFtayAEQA3OABtBEMwvnLQkWIhRaAXgdzHWpyxs7B0VncGh4JE1kCAAPSBAAEwo0egB6NORCEUMCYlJyajotKEcw10iUAGEY+IgklPQMZAyYqCIoYrhvYBTxMGQ4CgpgHhA4ACNrFDBCemY2Di5eAWRhMUlpGWQAWgA+ZABJJLjkEbG4MEEoFF7kAFtekZAeXKISKDJKUy8yoA
Related Issues:
#30977 (this one is specifically for
enums
)The text was updated successfully, but these errors were encountered: