1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
=== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts ===
// Basic uses of optional properties
var a: {
>a : Symbol(a, Decl(objectTypesWithOptionalProperties.ts, 2, 3))
x?: number; // ok
>x : Symbol(x, Decl(objectTypesWithOptionalProperties.ts, 2, 8))
}
interface I {
>I : Symbol(I, Decl(objectTypesWithOptionalProperties.ts, 4, 1))
x?: number; // ok
>x : Symbol(I.x, Decl(objectTypesWithOptionalProperties.ts, 6, 13))
}
class C {
>C : Symbol(C, Decl(objectTypesWithOptionalProperties.ts, 8, 1))
x?: number; // ok
>x : Symbol(C.x, Decl(objectTypesWithOptionalProperties.ts, 10, 9))
}
interface I2<T> {
>I2 : Symbol(I2, Decl(objectTypesWithOptionalProperties.ts, 12, 1))
>T : Symbol(T, Decl(objectTypesWithOptionalProperties.ts, 14, 13))
x?: T; // ok
>x : Symbol(I2.x, Decl(objectTypesWithOptionalProperties.ts, 14, 17))
>T : Symbol(T, Decl(objectTypesWithOptionalProperties.ts, 14, 13))
}
class C2<T> {
>C2 : Symbol(C2, Decl(objectTypesWithOptionalProperties.ts, 16, 1))
>T : Symbol(T, Decl(objectTypesWithOptionalProperties.ts, 18, 9))
x?: T; // ok
>x : Symbol(C2.x, Decl(objectTypesWithOptionalProperties.ts, 18, 13))
>T : Symbol(T, Decl(objectTypesWithOptionalProperties.ts, 18, 9))
}
var b = {
>b : Symbol(b, Decl(objectTypesWithOptionalProperties.ts, 22, 3))
x?: 1 // error
>x : Symbol(x, Decl(objectTypesWithOptionalProperties.ts, 22, 9))
}
|