2016-09-29 6 views
0

にnullを変換しない私はAngular2アプリのデータストアの初期状態を設定された以下のコードを持っていますが、INIT_STATE.token"null"なくnullはなぜ型インタフェースの活字体の定数は、文字列「ヌル」

export interface IAuthState{ 
    authenticated: boolean, 
    token?: any 
} 

const INIT_STATE: IAuthState = { 
    authenticated: localStorage.getItem('id_token') ? true : false, 
    token: localStorage.getItem('id_token') ? localStorage.getItem('id_token') : null 
} 
です

答えて

0

私が投稿したらすぐに、実際に原因であった可能性のある愚かな問題を考えました。どのようにして"null"がアイテムを削除する代わりにlocalStorageに格納されましたか?