Background
Node has a package called path which has a type definitions file associated with it in the @types/node npm package. Someone made a client-side package called path-browserify which has the same api but has no types.
Question
Can I bolt on the @types/node types for path to use with path-browserify? Basically I want to use types in one place with a different name. I've tried this:
// types.d.ts
declare module 'path-browserify' {
export {default} from 'path'
}
// usage.ts
import * as path from 'path-browserify'
const joined = path.join('/', 'file');
// ^ COMPILE ERROR: join not found
const joined = path.default('/', 'file');
// ^ RUNTIME ERROR: default not found
But I'm unable to access the api correctly. Is there a better way to use these type definitions? preferably without copying the path api.