-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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/transformer-typescript-types does not work #5911
Comments
I've tried this:
// index.ts
export * from './components';
// components.ts
export type Foo = string; but it builds fine. Looks like some code in |
My |
I have exactly the same issue as @ranisalt when trying to export an |
Confirmed I ran in to this issue and it goes away if I comment out my usage of |
I run into this issue as well whenever using |
Confirmed the same problems with Also, the type declarations are bundled into one file incorrectly. |
I found this PR, might be it helps to sort things out. |
I tested, and #7315 doesn't address this issue, unfortunately (although it does fix #7306). I can confirm the repro - parcel/packages/transformers/typescript-types/src/collect.js Lines 58 to 60 in 1069398
But if you look at the relevant typescript API types, "exportsClause" could be a ExportDeclaration (code) export interface ExportDeclaration extends DeclarationStatement, JSDocContainer {
// ...
/** Will not be assigned in the case of `export * from "foo";` */
readonly exportClause?: NamedExportBindings;
// ...
} NamedExportBindings (code) export type NamedExportBindings =
| NamespaceExport
| NamedExports
; NamespaceExport (code) export interface NamespaceExport extends NamedDeclaration {
readonly kind: SyntaxKind.NamespaceExport;
readonly parent: ExportDeclaration;
readonly name: Identifier
} So the issue is that we don't handle this case, probably because it was released after the initial implementation of |
a reasonable workaround
|
Still an issue with |
Still an issue with "@parcel/transformer-typescript-types": "^2.4.0" |
Any updates about this issue? Same error with |
We need to allow fine-grained imports, and parcel has several bugs that block doing this in the normal way: parcel-bundler/parcel#7622 parcel-bundler/parcel#5911 This PR also enables validation and progress apis.
We need to allow fine-grained imports, and parcel has several bugs that block doing this in the normal way: parcel-bundler/parcel#7622 parcel-bundler/parcel#5911 This PR also enables validation and progress apis.
Same error with "@parcel/transformer-typescript-types": "^2.5.0" |
@yuuk have you found some way to solve the issue? |
didn't yet |
Same issue here. |
You can get it working by doing this:
|
Preliminary results show that changing the line |
As bizarre as it can sound, I was getting exact the same error because of the name of my file, in the project I have some utils, and one of them is called
|
Oh ok, seems like my issue was already reported #7669 👌 |
After adding tsconfig.json everything works |
@camdub I closed that for the following reason: #8532 (comment) |
Ah, I missed that comment, thanks! So at this point this is still an open issue? |
Yep. |
I'm a bit stumped this issue is still open. I'm essentially forced to either switch to another bundler (maybe Rollup) or remove the use of |
I confirm this is still an issue, using : It seems to happen when exporting types : // MyTypes.ts
export interface Car { }
export interface Bus{ } // index.ts
export * as Vehicles from './MyTypes.ts' This raises the error If anyone is interested, here's my workaround. It's far from great but it works in my case : // index.ts
import type { Car, Bus } from './MyTypes.ts'
export type Vehicles= {
Bus: Bus
Car: Car
} You can then use it like this : const myCar: Vehicles["Car"] = { }
const myBike: Vehicles["Bike"] = { } // TS Error I'd be still very interested in a fix, as I don't like this solution so much 🙏 |
It seems to me that Parcel being a library bundler isn't a high priority feature. For libraries I've resorted to using |
🐛 bug report
🎛 Configuration (.babelrc, package.json, cli command)
package.json:
src/index.ts
CLI:
parcel build index.ts
🤔 Expected Behavior
It should build.
😯 Current Behavior
💁 Possible Solution
🔦 Context
I just want to build this with types.
💻 Code Sample
🌍 Your Environment
The text was updated successfully, but these errors were encountered: