const pathsMap = { home : ( ) => '/' , addArticle : ( ) => '/add-article' , viewArticle : ( articleId ) => `/articles/${ articleId }` , editArticle : ( articleId ) => `/articles/${ articleId }/edit` , } ; type PathsMap = typeof pathsMap ; export const getPath = < TRoute extends keyof PathsMap > ( route , ... params ) => { const pathCb = pathsMap [ route ] ; return pathCb ( ... params ) ; } ;