Introduce flattened error reporting for properties, call signatures, and construct signatures (#33473)

* Introduce flattened error reporting for properties, call signatures, and construct signatures

* Update message, specialize output for argument-less signatures

* Skip leading signature incompatability flattening

* Add return type specialized message
This commit is contained in:
Wesley Wigham
2019-09-23 16:08:44 -07:00
committed by GitHub
parent 6c2ae12559
commit 26caa3793e
62 changed files with 1023 additions and 735 deletions

View File

@@ -0,0 +1,15 @@
let x = { a: { b: { c: { d: { e: { f() { return { g: "hello" }; } } } } } } };
let y = { a: { b: { c: { d: { e: { f() { return { g: 12345 }; } } } } } } };
x = y;
class Ctor1 {
g = "ok"
}
class Ctor2 {
g = 12;
}
let x2 = { a: { b: { c: { d: { e: { f: Ctor1 } } } } } };
let y2 = { a: { b: { c: { d: { e: { f: Ctor2 } } } } } };
x2 = y2;

View File

@@ -0,0 +1,7 @@
// @strict: true
type Cb<T> = {noAlias: () => T}["noAlias"]; // `"noAlias"` here prevents an alias symbol from being made
// which means the comparison will definitely be structural, rather than by variance
declare const x: Cb<Cb<Cb<Cb<number>>>>; // one more layer of `Cb` adn we'd get a `true` from the deeply-nested symbol check
declare let y: Cb<Cb<Cb<Cb<string>>>>;
y = x;