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: Got unexpected undefined #6815
Comments
Minimal reproduction: // index.js
import { A, B } from "./types";
export function run(a: A): B {
return a;
}
// types.js
export * from "./a";
export type B = number;
// a.js
export type A = number; |
This issue seems to be fixed in #7424 👀 |
Yes, it works correctly with a recent nightly 👍 |
@mischnic Can you indicate which version of |
I just ran |
Thank you for the reply. I did not realize I needed to also add Now, I am getting an error similar to #6675. Will investigate further. |
Now some Parcel packages are installed multiple times in various versions |
So what would the recommended solution be then? |
The easiest solution is probably removing all parcel-related entries in your lockfile. |
Hmm, okay. I have deleted my @parcel/transformer-typescript-types: Got unexpected undefined
Error: Got unexpected undefined
at nullthrows (C:\Users\livet\WebstormProjects\unstated-next\node_modules\nullthrows\nullthrows.js:7:15)
at TSModuleGraph.propagate
(C:\Users\livet\WebstormProjects\unstated-next\node_modules\@parcel\transformer-typescript-types\lib\TSModuleGraph.js:267:48)
at shake (C:\Users\livet\WebstormProjects\unstated-next\node_modules\@parcel\transformer-typescript-types\lib\shake.js:42:35)
at C:\Users\livet\WebstormProjects\unstated-next\node_modules\@parcel\transformer-typescript-types\lib\TSTypesTransformer.js:138:33
at transformation (C:\Users\livet\WebstormProjects\unstated-next\node_modules\typescript\lib\typescript.js:107031:24)
at transformRoot (C:\Users\livet\WebstormProjects\unstated-next\node_modules\typescript\lib\typescript.js:107058:82)
at Object.transformNodes (C:\Users\livet\WebstormProjects\unstated-next\node_modules\typescript\lib\typescript.js:107042:78)
at emitDeclarationFileOrBundle (C:\Users\livet\WebstormProjects\unstated-next\node_modules\typescript\lib\typescript.js:107756:43)
at emitSourceFileOrBundle (C:\Users\livet\WebstormProjects\unstated-next\node_modules\typescript\lib\typescript.js:107659:13)
at forEachEmittedFile (C:\Users\livet\WebstormProjects\unstated-next\node_modules\typescript\lib\typescript.js:107385:30) With the following packages installed: {
"devDependencies": {
"@parcel/packager-ts": "^2.0.0-nightly.954",
"@parcel/transformer-typescript-types": "^2.0.0-nightly.954",
"parcel": "^2.0.0-nightly.952",
},
} |
After stepping through the code for resolveExport(module, name) {
for (let e of module.exports) {
if (e.name === name) {
return this.getExport(module, e);
} else if (e.specifier) {
return this.resolveExport((0, _nullthrows().default)(this.getModule(e.specifier)), name);
}
}
} I will inject the fix from #7424 manually and see if that resolves my issue. |
Manually editing resolveExport(module, name) {
for (let e of module.exports) {
if (e.name === name) {
return this.getExport(module, e);
} else if (e.specifier) {
const m = this.resolveExport((0, _nullthrows().default)(this.getModule(e.specifier)), name);
if (m) { return m; }
}
}
} I advise the parcel team to explicitly specify a version for these fixes for others who may run across this issue. |
I found another issue with generated types and have created another issue here: #7488 |
Hey @mischnic maybe you should re-open this issue? I'm experiencing the same thing trying to use percel. |
Have you tried the nightly version? #6815 (comment) |
I'm experiencing the issue with the latest nightly version:
|
I'm also experiencing the same issue with the current nightly.982 (and of course also the current stable 2.2.0) |
same issue here with these dependences:
|
I'm experiencing the same issue with these dependences:
Is there a solution to fix it? |
🐛 bug report
I have been following the "building a library" instructions in Parcel. When adding my
"types"
property inpackage.json
, I get an error message when runningparcel build
.🎛 Configuration (.babelrc, package.json, cli command)
package.json:
🤔 Expected Behavior
The
parcel build
command works with type definitions indist/types.d.ts
.😯 Current Behavior
An error is thrown instead:
💁 Possible Solution
When attaching a debugger to
parcel build
, I noticed the following exception being thrown:After creating an empty
.npmrc
file in my project, I ranparcel build
with the debugger again and received this exception:🌍 Your Environment
The text was updated successfully, but these errors were encountered: