Skip to content

Duplicate diagnosticsΒ #58207

@gabritto

Description

@gabritto

πŸ”Ž Search Terms

duplicate diagnostics, duplicate errors

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play?ts=5.5.0-dev.20240415#code/JYOwLgpgTgZghgYwgAgMIHsC2AHANsBOSAEwBUBPbCAITgGcUBvAKGTeQG06AuZOsKKADmAXV4BBWgwDczAL7NQkWIhQYc+QiQpUAItGAA3CMWQt2nHnwHCxycfsHHishUujwk9qU1bs4vPyCIEKuiuAeqvaORiZmfmwARoE2IWEIuPR0yD7xFjDo6ACEvOp4BEQmOjT0EOnoIPzIAB7IALzIGVnIMc7IEM2QIMTZuebsBcWlWOVaVZQQvSZhuBBgyOiJAFa8jMgAzCnBQshy7WYHvABEYAAWUBAQV6eym1sczSLSQA

πŸ’» Code

interface ComplicatedTypeBase {
    [s: string]: ABase;
}
interface ComplicatedTypeDerived {
    [s: string]: ADerived;
}
interface ABase {
    a: string;
}
interface ADerived {
    b: string;
}
class Base {
    foo!: ComplicatedTypeBase;
}
const x = class Derived extends Base {
    foo!: ComplicatedTypeDerived;
}
let obj: { 3: string } = { 3: "three" };
obj[x];

πŸ™ Actual behavior

Two instances of the same error on line foo!: ComplicatedTypeDerived;:

  • Property 'foo' in type 'Derived' is not assignable to the same property in base type 'Base'. Type 'ComplicatedTypeDerived' is not assignable to type 'ComplicatedTypeBase'.(2416)
  • Property 'foo' in type 'Derived' is not assignable to the same property in base type 'Base'. Type 'ComplicatedTypeDerived' is not assignable to type 'ComplicatedTypeBase'. 'string' index signatures are incompatible. Property 'a' is missing in type 'ADerived' but required in type 'ABase'.(2416)

πŸ™‚ Expected behavior

A single instance of the error

Additional information about the issue

No response

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions