Typescript 里的这种写法是什么意思?
資深大佬 : tsuih 7
在看源码的时候发现下面这种写法,不明白是什么意思,请教一下各位:
const temp: ToughCookieFileStore = { [domain]: { [path]: { [name]: { key: name, value: etcCookie.value, expires, domain, path, secure: etcCookie.secure, httpOnly: etcCookie.httpOnly, hostOnly: etcCookie.hostOnly, }, }, }, };
下面是接口的声明
export interface ToughCookieFileStore { [site: string]: TCFSPaths; } export interface TCFSPaths { [site: string]: TCFSCookies; } export interface TCFSCookies { [cookieName: string]: TCFSCookieAttributes; } export interface TCFSCookieAttributes { key: string; value: string; expires?: string; maxAge?: number; domain: string; path: string; secure?: boolean; httpOnly?: boolean; extensions?: string[]; hostOnly: boolean; creation?: string; lastAccessed?: string; }
大佬有話說 (5)