67 lines
No EOL
2.2 KiB
Text
67 lines
No EOL
2.2 KiB
Text
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/constructSignatureWithAccessibilityModifiersOnParameters2.ts (15 errors) ====
|
|
// Parameter properties are not valid in overloads of constructors
|
|
|
|
class C {
|
|
constructor(public x, private y);
|
|
~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
~~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
constructor(public x, private y) { }
|
|
~
|
|
!!! Duplicate identifier 'x'.
|
|
~
|
|
!!! Duplicate identifier 'y'.
|
|
}
|
|
|
|
class C2 {
|
|
constructor(private x);
|
|
~~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
constructor(public x) { }
|
|
~
|
|
!!! Duplicate identifier 'x'.
|
|
}
|
|
|
|
class C3 {
|
|
constructor(private x);
|
|
~~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
constructor(private y) { }
|
|
}
|
|
|
|
interface I {
|
|
new (public x);
|
|
~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
new (public x);
|
|
~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
}
|
|
|
|
interface I2 {
|
|
new (private x);
|
|
~~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
new (private x);
|
|
~~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
}
|
|
|
|
var a: {
|
|
new (public x);
|
|
~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
new (public y);
|
|
~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
}
|
|
|
|
var b: {
|
|
new (private x);
|
|
~~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
new (private y);
|
|
~~~~~~~~~
|
|
!!! A parameter property is only allowed in a constructor implementation.
|
|
} |