mobily / ts-belt

🔧 Fast, modern, and practical utility library for FP in TypeScript.
https://mobily.github.io/ts-belt
MIT License
1.08k stars 30 forks source link

Library reexport #79

Open ivan-kleshnin opened 1 year ago

ivan-kleshnin commented 1 year ago

Hi Marcin! How hard would it be to update the build pipeline to make namespaces extendable? I mean this:

lib/string.ts (reexport + extra helpers)

export * from "@mobily/ts-belt/String"
// TS2307: Cannot find module '@mobily/ts-belt/String' or its corresponding type declarations.

export function capitalize(str: string): string {
  return str.charAt(0).toUpperCase() + str.slice(1)
}

index.ts (import original + custom helpers under the same namespace)

import * as S from "./lib/string"

console.log(S.trim) // original method
console.log(S.capitalize) // custom method

Would be a great feature, more ergonomic than exporting extra custom hepers under A2, D2, S2 prefixes 😨 Or manual reexport via enumerating every original function:

// ...
export const isNotEmpty = S.isNotEmpty
export const split = S.split
export const trim = S.trim
// ...