Unhelpful error "Two different types with this name exist, but they are unrelated."
See original GitHub issueTypeScript 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:
- Created 6 years ago
- Reactions:1
- Comments:9 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I really, really need this error message to point at the files containing the two conflicting definitions!
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.