microsoft / microsoft/TypeScript
False positive error report for interface type missing index signature, thus not assignable to object type with `unknown` values.
Open
@RyanCavanaugh is already working on this.
Since Jul 8, 2019.
Docs
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.6.0-dev.20190704 (3.4.3 doesn't have this bug)
Search Terms:
index signature, unknown, assignable, interface
Code
interface A {
properties?: { [Key: string]: unknown };
}
type Bar = {
key?: "value";
};
interface Baz {
key?: "value";
}
interface B extends A { // ok
properties?: Bar;
}
interface C extends A { // error: Baz is not assignable to { [Key: string]: unknown } -> Index signature is missing
properties?: Baz;
}
Expected behavior:
No error expected, interface C extends A correctly.
Actual behavior:
Error because interface C does not extend interface A
Related Issues:
#30977 (this one is specifically for enums)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.