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

Supports typing generation for multiple targets #9816

Open
ocavue opened this issue Jun 20, 2024 · 0 comments
Open

Supports typing generation for multiple targets #9816

ocavue opened this issue Jun 20, 2024 · 0 comments

Comments

@ocavue
Copy link

ocavue commented Jun 20, 2024

🙋 feature request

I'd love to generate multiple .d.ts files for multiple targets.

🤔 Expected Behavior

A library could have multiple entry points, like my-pkg/client and my-pkg/server. In such case, it should have multiple type declaration files, like dist/client.d.ts and dist/server.d.ts.

😯 Current Behavior

parcel only supports generate one .d.ts file from the types field in package.json according to the docs.

When building a library, Parcel can extract the types from your entry point and generate a .d.ts file. Use the types field in package.json alongside a target such as main or module to enable this.

{
  "source": "src/index.ts",
  "module": "dist/index.js",
  "types": "dist/index.d.ts"
}

💁 Possible Solution

Maybe we can add types to targets

{
  "targets": {
    "server": {
+     "types": "./dist/server.d.ts",
      "source": "./src/server.ts"
    },
    "client": {
+     "types": "./dist/client.d.ts",
      "source": "./src/client.ts"
    }
  },
}

🔦 Context

N/A

💻 Examples

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants