20 lines
813 B
Plaintext
20 lines
813 B
Plaintext
tests/cases/compiler/memberOverride.ts(4,5): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/compiler/memberOverride.ts(5,5): error TS2300: Duplicate identifier 'a'.
|
|
tests/cases/compiler/memberOverride.ts(8,5): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
|
|
|
|
==== tests/cases/compiler/memberOverride.ts (3 errors) ====
|
|
// An object initialiser accepts the first definition for the same property with a different type signature
|
|
// Should compile, since the second declaration of a overrides the first
|
|
var x = {
|
|
a: "",
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
a: 5
|
|
~
|
|
!!! error TS2300: Duplicate identifier 'a'.
|
|
}
|
|
|
|
var n: number = x.a;
|
|
~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'. |