type Settings = { siteSpecificCloseReasons : Array < { siteSpecificCloseReasonId : number ; longReasonText : string ; reasonText : string ; } > ; downvoteCondition : string ; raisedCloseFlags : Array < number > ; } ; export const getSettings = ( ) => ( JSON . parse ( localStorage . cpUserscriptOneClickVTCSettings as string ) as Settings ) ; export const saveNewSettings = ( siteSpecificCloseReasons ) => { localStorage . cpUserscriptOneClickVTCSettings = JSON . stringify ( { siteSpecificCloseReasons , downvoteCondition : 'Non-dupes only' , raisedCloseFlags : [ ] , } ) ; } ; export const saveSettings = ( partialNewSettings ) => { const oldSettings = getSettings ( ) ; const newSettings = Object . assign ( { } , oldSettings , partialNewSettings ) ; localStorage . cpUserscriptOneClickVTCSettings = JSON . stringify ( newSettings ) ; } ;