26 lines
No EOL
1.1 KiB
Text
26 lines
No EOL
1.1 KiB
Text
tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(4,6): error TS1112: A class member cannot be declared optional.
|
|
tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(5,6): error TS1112: A class member cannot be declared optional.
|
|
tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(9,6): error TS1112: A class member cannot be declared optional.
|
|
tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(10,6): error TS1112: A class member cannot be declared optional.
|
|
|
|
|
|
==== tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts (4 errors) ====
|
|
// classes do not permit optional parameters, these are errors
|
|
|
|
class C {
|
|
x?: string;
|
|
~
|
|
!!! error TS1112: A class member cannot be declared optional.
|
|
f?() {}
|
|
~
|
|
!!! error TS1112: A class member cannot be declared optional.
|
|
}
|
|
|
|
class C2<T> {
|
|
x?: T;
|
|
~
|
|
!!! error TS1112: A class member cannot be declared optional.
|
|
f?(x: T) {}
|
|
~
|
|
!!! error TS1112: A class member cannot be declared optional.
|
|
} |