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

Parcel 2: Problem with emitted TypeScript typing file #4250

Open
AKPWebDesign opened this issue Mar 1, 2020 · 2 comments
Open

Parcel 2: Problem with emitted TypeScript typing file #4250

AKPWebDesign opened this issue Mar 1, 2020 · 2 comments

Comments

@AKPWebDesign
Copy link

🐛 bug report

When using Parcel to build a TypeScript project and including the types field in package.json, a typing file is created, but is incomplete and unable to be used.

🎛 Configuration (.babelrc, package.json, cli command)

See my repro repo at https://github.com/AKPWebDesign/typing-problem

🤔 Expected Behavior

A types file or files containing everything necessary to provide type hinting and checking should be output when including the types field in package.json. For example, this is what tsc --emitDeclarationOnly yields:

import React from 'react';
interface Props {
    value: string;
}
declare const Component: React.FC<Props>;
export default Component;

😯 Current Behavior

A broken types file is generated, which doesn't contain any type information:

export default Component;

//# sourceMappingURL=index.d.ts.map

🔦 Context

The context here is that I have a Typescript React component library that I'm trying to build and publish for use in another Typescript React project.

💻 Code Sample

https://github.com/AKPWebDesign/typing-problem

🌍 Your Environment

Software Version(s)
Parcel ^2.0.0-nightly.130
Node v12.x
npm/Yarn yarn 1.22.0
Operating System WSL 4.4.0-18362-Microsoft / macOS Catalina (10.15.3)
@wdoug
Copy link

wdoug commented Oct 7, 2020

I wonder if this could be related to #4936

@nguyenthetoan
Copy link

nguyenthetoan commented Feb 8, 2022

I'm now also facing this issue, does anyone have any solutions yet?

updates:
I fixed it by changing my export in index.ts

import Component from './Component';

// export { Component }; <= this didnt work
export default Component;

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

4 participants