question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhelpful error "Two different types with this name exist, but they are unrelated."

See original GitHub issue

TypeScript Version: 2.6.0-dev.201xxxxx

Code

interface I {
    m(
        a: number,
        b: number,
        c: number,
        d: number,
        e: number,
        f: number,
        g: number,
        h: number,
        i: number,
    ): number;
}

const x: I = {
    m(a, b, c, d, e, f, g, h, i) { x; }
};

Expected behavior:

A less confusing error message.

Actual behavior:

src/a.ts(15,7): error TS2322: Type '{ m(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: nu...' is not assignable to type 'I'.
  Types of property 'm' are incompatible.
    Type '(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: numbe...' is not assignable to type '(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: numbe...'. Two different types with this name exist, but they are unrelated.
      Type 'void' is not assignable to type 'number'.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

45reactions
estaubcommented, Feb 26, 2018

I really, really need this error message to point at the files containing the two conflicting definitions!

0reactions
mhegazycommented, Nov 13, 2017

Sorry i miss understood your question… yes the issue here is caused by truncation. the comparison of the strings should not happen on a truncated one, so the error should not be disabled regardless if --noErrorTruncation is on or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Two different types with this name exist, but they are ... - GitHub
Expected behavior: It should compile without any error. Everything is in the same namespace, so it should be the same type. Actual behavior:...
Read more >
Build error: Two different types with this name exist, but they ...
Two different types with this name exist, but they are unrelated. [ERROR] Property 'source' is protected but type 'Observable<T>' is not a class ......
Read more >
Built-in Exceptions — Python 3.11.1 documentation
Two exception classes that are not related via subclassing are never equivalent, even if they have the same name. The built-in exceptions listed...
Read more >
15 Typescript Mistakes To Avoid - SoftwareMill Tech Blog
Typescript took the Javascript world by storm. If you are a frontend developer, you should check those 15 common Typescript mistakes.
Read more >
C++ Core Guidelines - GitHub Pages
However, when there are two ways of expressing an idea and one has shown itself a common source of errors and the other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found