2016-11-09 100 views

回答

1

不,因为TEST尚未定义。
例如,如果你试试这个:

const TEST = { 
    "a1": "world", 
    "a2": "hello", 
    "a3": TEST["a3"] 
}; 

您将获得:

Error: Block-scoped variable 'TEST' used before its declaration

你可以这样做:

const TEST = { 
    "a1": "world", 
    "a2": "hello" 
} as { a1: string, a2: string, a3: string }; 

TEST.a3 = TEST.a1; 

code in playground

+0

非常感谢为您的回应! – takeradi