TehShrike / deepmerge

A library for deep (recursive) merging of Javascript objects
MIT License
2.76k stars 216 forks source link

Typings #193

Closed ghepesdoru closed 4 years ago

ghepesdoru commented 4 years ago

Allow deepmerge package to be packaged using @rollup with @rollup/plugin-typescript.

At current state the package is exporting it's type declaration as index.d.ts inside the project root. This breaks typescript project builds with @rollup when using the compilerOptions.typeRoots typescript configuration.

A better approach would be to isolate the typings information inside a types folder and forward tools such as @rollup using the package.json typings property to the corrent types/index.d.ts path.

This modification allows deepmerge to act as a type module, fixing issues related to bundling the package using @rollup/plugin-typescript.

ghepesdoru commented 4 years ago

As better described in here, there are 3 manners of inclusion, explicit specifying a typings or types (equivalent fields) in package.json being encouraged but not required if an index.d.ts is pressent at root directory level.

Based on above referenced documentation, the repository already has a valid definition file and this issue alongside it's pull request can be safely ignored as build tools should also respect conventions, not only libraries.

TehShrike commented 4 years ago

So it's a @rollup/plugin-typescript issue?

ghepesdoru commented 4 years ago

In a PnP context with transpiled build files.

I haven't rised an issue to either @yarnpkg or @rollup and closed the issue here (alongside PR) as it's an edge case that can be worked around by interested parties (when you choise to go with PnP in it's current state you can't quite complain).