mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-23 01:10:18 -05:00
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:
@@ -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;
|
||||
7
tests/cases/compiler/nestedCallbackErrorNotFlattened.ts
Normal file
7
tests/cases/compiler/nestedCallbackErrorNotFlattened.ts
Normal 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;
|
||||
Reference in New Issue
Block a user