ts-belt icon indicating copy to clipboard operation
ts-belt copied to clipboard

Library reexport

Open ivan-kleshnin opened this issue 1 year ago • 0 comments

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
// ...

ivan-kleshnin avatar May 15 '23 10:05 ivan-kleshnin