1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
=== tests/cases/compiler/nestedExcessPropertyChecking.ts ===
type A1 = { x: { a?: string } };
>A1 : Symbol(A1, Decl(nestedExcessPropertyChecking.ts, 0, 0))
>x : Symbol(x, Decl(nestedExcessPropertyChecking.ts, 0, 11))
>a : Symbol(a, Decl(nestedExcessPropertyChecking.ts, 0, 16))
type B1 = { x: { b?: string } };
>B1 : Symbol(B1, Decl(nestedExcessPropertyChecking.ts, 0, 32))
>x : Symbol(x, Decl(nestedExcessPropertyChecking.ts, 1, 11))
>b : Symbol(b, Decl(nestedExcessPropertyChecking.ts, 1, 16))
type C1 = { x: { c: string } };
>C1 : Symbol(C1, Decl(nestedExcessPropertyChecking.ts, 1, 32))
>x : Symbol(x, Decl(nestedExcessPropertyChecking.ts, 3, 11))
>c : Symbol(c, Decl(nestedExcessPropertyChecking.ts, 3, 16))
const ab1: A1 & B1 = {} as C1; // Error
>ab1 : Symbol(ab1, Decl(nestedExcessPropertyChecking.ts, 5, 5))
>A1 : Symbol(A1, Decl(nestedExcessPropertyChecking.ts, 0, 0))
>B1 : Symbol(B1, Decl(nestedExcessPropertyChecking.ts, 0, 32))
>C1 : Symbol(C1, Decl(nestedExcessPropertyChecking.ts, 1, 32))
type A2 = { a?: string };
>A2 : Symbol(A2, Decl(nestedExcessPropertyChecking.ts, 5, 30))
>a : Symbol(a, Decl(nestedExcessPropertyChecking.ts, 7, 11))
type B2 = { b?: string };
>B2 : Symbol(B2, Decl(nestedExcessPropertyChecking.ts, 7, 25))
>b : Symbol(b, Decl(nestedExcessPropertyChecking.ts, 8, 11))
type C2 = { c: string };
>C2 : Symbol(C2, Decl(nestedExcessPropertyChecking.ts, 8, 25))
>c : Symbol(c, Decl(nestedExcessPropertyChecking.ts, 10, 11))
const ab2: A2 & B2 = {} as C2; // Error
>ab2 : Symbol(ab2, Decl(nestedExcessPropertyChecking.ts, 12, 5))
>A2 : Symbol(A2, Decl(nestedExcessPropertyChecking.ts, 5, 30))
>B2 : Symbol(B2, Decl(nestedExcessPropertyChecking.ts, 7, 25))
>C2 : Symbol(C2, Decl(nestedExcessPropertyChecking.ts, 8, 25))
enum E { A = "A" }
>E : Symbol(E, Decl(nestedExcessPropertyChecking.ts, 12, 30))
>A : Symbol(E.A, Decl(nestedExcessPropertyChecking.ts, 14, 8))
let x: { nope?: any } = E.A; // Error
>x : Symbol(x, Decl(nestedExcessPropertyChecking.ts, 16, 3))
>nope : Symbol(nope, Decl(nestedExcessPropertyChecking.ts, 16, 8))
>E.A : Symbol(E.A, Decl(nestedExcessPropertyChecking.ts, 14, 8))
>E : Symbol(E, Decl(nestedExcessPropertyChecking.ts, 12, 30))
>A : Symbol(E.A, Decl(nestedExcessPropertyChecking.ts, 14, 8))
let y: { nope?: any } = "A"; // Error
>y : Symbol(y, Decl(nestedExcessPropertyChecking.ts, 17, 3))
>nope : Symbol(nope, Decl(nestedExcessPropertyChecking.ts, 17, 8))
// Repros from #51043
type OverridesInput = {
>OverridesInput : Symbol(OverridesInput, Decl(nestedExcessPropertyChecking.ts, 17, 28))
someProp?: 'A' | 'B'
>someProp : Symbol(someProp, Decl(nestedExcessPropertyChecking.ts, 21, 23))
}
const foo1: Partial<{ something: any }> & { variables: {
>foo1 : Symbol(foo1, Decl(nestedExcessPropertyChecking.ts, 25, 5))
>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --))
>something : Symbol(something, Decl(nestedExcessPropertyChecking.ts, 25, 21))
>variables : Symbol(variables, Decl(nestedExcessPropertyChecking.ts, 25, 43))
overrides?: OverridesInput;
>overrides : Symbol(overrides, Decl(nestedExcessPropertyChecking.ts, 25, 56))
>OverridesInput : Symbol(OverridesInput, Decl(nestedExcessPropertyChecking.ts, 17, 28))
} & Partial<{
>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --))
overrides?: OverridesInput;
>overrides : Symbol(overrides, Decl(nestedExcessPropertyChecking.ts, 27, 13))
>OverridesInput : Symbol(OverridesInput, Decl(nestedExcessPropertyChecking.ts, 17, 28))
}>} = { variables: { overrides: false } }; // Error
>variables : Symbol(variables, Decl(nestedExcessPropertyChecking.ts, 29, 7))
>overrides : Symbol(overrides, Decl(nestedExcessPropertyChecking.ts, 29, 20))
interface Unrelated { _?: any }
>Unrelated : Symbol(Unrelated, Decl(nestedExcessPropertyChecking.ts, 29, 42))
>_ : Symbol(Unrelated._, Decl(nestedExcessPropertyChecking.ts, 32, 21))
interface VariablesA { overrides?: OverridesInput; }
>VariablesA : Symbol(VariablesA, Decl(nestedExcessPropertyChecking.ts, 32, 31))
>overrides : Symbol(VariablesA.overrides, Decl(nestedExcessPropertyChecking.ts, 34, 22))
>OverridesInput : Symbol(OverridesInput, Decl(nestedExcessPropertyChecking.ts, 17, 28))
interface VariablesB { overrides?: OverridesInput; }
>VariablesB : Symbol(VariablesB, Decl(nestedExcessPropertyChecking.ts, 34, 52))
>overrides : Symbol(VariablesB.overrides, Decl(nestedExcessPropertyChecking.ts, 35, 22))
>OverridesInput : Symbol(OverridesInput, Decl(nestedExcessPropertyChecking.ts, 17, 28))
const foo2: Unrelated & { variables: VariablesA & VariablesB } = {
>foo2 : Symbol(foo2, Decl(nestedExcessPropertyChecking.ts, 37, 5))
>Unrelated : Symbol(Unrelated, Decl(nestedExcessPropertyChecking.ts, 29, 42))
>variables : Symbol(variables, Decl(nestedExcessPropertyChecking.ts, 37, 25))
>VariablesA : Symbol(VariablesA, Decl(nestedExcessPropertyChecking.ts, 32, 31))
>VariablesB : Symbol(VariablesB, Decl(nestedExcessPropertyChecking.ts, 34, 52))
variables: {
>variables : Symbol(variables, Decl(nestedExcessPropertyChecking.ts, 37, 66))
overrides: false // Error
>overrides : Symbol(overrides, Decl(nestedExcessPropertyChecking.ts, 38, 16))
}
};
// Simplified repro from #52252
type T1 = {
>T1 : Symbol(T1, Decl(nestedExcessPropertyChecking.ts, 41, 2))
primary: { __typename?: 'Feature' } & { colors: { light: number, dark: number } },
>primary : Symbol(primary, Decl(nestedExcessPropertyChecking.ts, 45, 11))
>__typename : Symbol(__typename, Decl(nestedExcessPropertyChecking.ts, 46, 14))
>colors : Symbol(colors, Decl(nestedExcessPropertyChecking.ts, 46, 43))
>light : Symbol(light, Decl(nestedExcessPropertyChecking.ts, 46, 53))
>dark : Symbol(dark, Decl(nestedExcessPropertyChecking.ts, 46, 68))
};
type T2 = {
>T2 : Symbol(T2, Decl(nestedExcessPropertyChecking.ts, 47, 2))
primary: { __typename?: 'Feature' } & { colors: { light: number } },
>primary : Symbol(primary, Decl(nestedExcessPropertyChecking.ts, 49, 11))
>__typename : Symbol(__typename, Decl(nestedExcessPropertyChecking.ts, 50, 14))
>colors : Symbol(colors, Decl(nestedExcessPropertyChecking.ts, 50, 43))
>light : Symbol(light, Decl(nestedExcessPropertyChecking.ts, 50, 53))
};
type Query = T1 & T2;
>Query : Symbol(Query, Decl(nestedExcessPropertyChecking.ts, 51, 2))
>T1 : Symbol(T1, Decl(nestedExcessPropertyChecking.ts, 41, 2))
>T2 : Symbol(T2, Decl(nestedExcessPropertyChecking.ts, 47, 2))
const response: Query = {
>response : Symbol(response, Decl(nestedExcessPropertyChecking.ts, 55, 5))
>Query : Symbol(Query, Decl(nestedExcessPropertyChecking.ts, 51, 2))
primary: {
>primary : Symbol(primary, Decl(nestedExcessPropertyChecking.ts, 55, 25))
colors: {
>colors : Symbol(colors, Decl(nestedExcessPropertyChecking.ts, 56, 14))
light: 1,
>light : Symbol(light, Decl(nestedExcessPropertyChecking.ts, 57, 17))
dark: 3,
>dark : Symbol(dark, Decl(nestedExcessPropertyChecking.ts, 58, 21))
},
},
};
|