16 lines
541 B
Plaintext
16 lines
541 B
Plaintext
|
==== tests/cases/compiler/indexSignatureWithInitializer.ts (4 errors) ====
|
||
|
interface I {
|
||
|
[x = '']: string;
|
||
|
~
|
||
|
!!! An index signature parameter cannot have an initializer.
|
||
|
~~~~~~
|
||
|
!!! A parameter initializer is only allowed in a function or constructor implementation.
|
||
|
}
|
||
|
|
||
|
class C {
|
||
|
[x = 0]: string
|
||
|
~
|
||
|
!!! An index signature parameter cannot have an initializer.
|
||
|
~~~~~
|
||
|
!!! A parameter initializer is only allowed in a function or constructor implementation.
|
||
|
}
|