import type * as ts from 'typescript' ; import { ArrayHelper } from '../../array/array' ; export interface DeclarationListCacheElement { declarations : ts . Declaration [ ] ; key : string ; } export class DeclarationListCache { private _cache : DeclarationListCacheElement [ ] ; constructor ( ) { this . _cache = [ ] ; } public set ( declarations , key ) { this . _cache . push ( { declarations , key , } ) ; } public get ( declarations ) { return this . _find ( declarations ) ?. key ; } public has ( declarations ) { return ! ! this . _find ( declarations ) ; } private _find ( declarations ) { return this . _cache . find ( ( intersection ) => ArrayHelper . AreEqual ( declarations , intersection . declarations ) ) ; } }