Closed
Description
Consider the following:
module ts {
export interface Node {
kind: SyntaxKind;
pos: number;
end: number;
}
}
function f(n: Node) {
ts.forEachChild(n, () => { /* ... */ });
}
The subtlety is that the user meant to declare ts.Node
as the type of n
.
Here you'll get the error on n
within the forEachChild
call, with the message
TS2345 Argument of type 'Node' is not assignable to parameter of type 'Node'.
which is unhelpful because it makes the user feel like they've completely lost their mind.
We should use a qualified name in such cases.
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
NoelAbrahams commentedon Dec 10, 2014
true 😃
DanielRosenwasser commentedon Dec 10, 2014
It reminds me of this Steve Yegge post from way back.
You might note the irony of the section that appears in. 😄
chrisbubernak commentedon Dec 29, 2014
Did anyone ever end up working on this? I took a look at it this morning and it doesn't seem too bad. I'll send out a PR when I get a chance to finish it up & test.
DickvdBrink commentedon Dec 30, 2014
@chrisbubernak, I worked on this a few weeks back, was a pretty minor change but it ended up breaking some other things (when I looked at the baselines, I believe it was something with the require paths now gone from the baseline), and I never had the time to actually look at it more. :(
NoelAbrahams commentedon Jan 23, 2015
@DanielRosenwasser /@chrisbubernak,
I ran into this gem today using 1.4:
I mean
Types of parameters 'other' and 'other' are incompatible
might be a candidate for the error messages hall of fame? 😄RyanCavanaugh commentedon Jan 23, 2015
That error looks like a bug. Do you have a repro? Or is it that there are two different
DomElement
s?NoelAbrahams commentedon Jan 23, 2015
@RyanCavanaugh, there's only one
DomElement
. While implementing the interface there was a parameter clash with a type inlib.d.ts
. Seems to be in the same ball park as this issue, but will take a look at producing a repro.3 remaining items