37 lines
No EOL
1.2 KiB
Text
37 lines
No EOL
1.2 KiB
Text
tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(12,6): error TS1112: A class member cannot be declared optional.
|
|
tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(20,6): error TS1112: A class member cannot be declared optional.
|
|
tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1160: An object member cannot be declared optional.
|
|
|
|
|
|
==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (3 errors) ====
|
|
// Basic uses of optional properties
|
|
|
|
var a: {
|
|
x?: number; // ok
|
|
}
|
|
|
|
interface I {
|
|
x?: number; // ok
|
|
}
|
|
|
|
class C {
|
|
x?: number; // error
|
|
~
|
|
!!! error TS1112: A class member cannot be declared optional.
|
|
}
|
|
|
|
interface I2<T> {
|
|
x?: T; // ok
|
|
}
|
|
|
|
class C2<T> {
|
|
x?: T; // error
|
|
~
|
|
!!! error TS1112: A class member cannot be declared optional.
|
|
}
|
|
|
|
var b = {
|
|
x?: 1 // error
|
|
~
|
|
!!! error TS1160: An object member cannot be declared optional.
|
|
} |