Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow importing a subpath with the default options being set #14

Open
BridgeAR opened this issue Jun 14, 2020 · 2 comments
Open

Allow importing a subpath with the default options being set #14

BridgeAR opened this issue Jun 14, 2020 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@BridgeAR
Copy link
Collaborator

It would be a great addition to add a subpath such as rfdc/default that exports a cloning function with the default options being set. That way there's no need to do e.g.:

// Instead of:
import rfdc from 'rfdc'
const clone = rfdc()

// Then possible:
import clone from 'rfdc/default'
@BridgeAR BridgeAR added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jun 14, 2020
BridgeAR pushed a commit that referenced this issue Jul 5, 2020
* Add import of default clone function

* Add test for default import #14

* Add documentation for default import #14
@vieirai
Copy link

vieirai commented Jul 9, 2020

@BridgeAR , @davidmarkclements is this being pushed to npm soon?
I see that the fix was merged 4 days ago, but the npm package hasn't been updated yet :)

@nicholaschiang
Copy link

Any updates on this? Also, @BridgeAR, you haven't updated the Typescript definition file in #15. You'll want to do something like:

// index.d.ts
declare module 'rfdc/default' {
  export default function rfdc<T>(obj: T) => T;
}

And then make sure that those changes are either:

  1. Reflected in the DefinitelyTyped package, OR;
  2. Included in the package itself (i.e. add a types field in your package.json and then include index.d.ts in your NPM package).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants