-
-
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
Module declarations must use "export declare" instead of "declare export". #8085
Conversation
... instead of "declare export". This fixes parcel-bundler#8079
The tests are here: /~https://github.com/parcel-bundler/parcel/blob/v2/packages/core/integration-tests/test/ts-types.js So I'd add example for module/namespace export to the |
You need to reformat shake.js with prettier (to make the lint CI job happy). |
Lets hope that makes it happy:) |
But the test case you added probably doesn't cover that issue? |
True, hang on. |
@mischnic I have been unable to reproduce the bug when I run it as an integration test, but here is a minimal example that produces it. PS C:\Source\unshift-issue> npm run build
> build
> parcel build . ./augmenter
🚨 Build failed.
@parcel/transformer-typescript-types: Cannot read properties of undefined (reading 'unshift')
TypeError: Cannot read properties of undefined (reading 'unshift')
at visit (C:\Source\unshift-issue\node_modules\@parcel\transformer-typescript-types\lib\shake.js:60:24)
at visitNodes (C:\Source\unshift-issue\node_modules\typescript\lib\typescript.js:87646:48)
at Object.visitEachChild (C:\Source\unshift-issue\node_modules\typescript\lib\typescript.js:88126:56)
at visit (C:\Source\unshift-issue\node_modules\@parcel\transformer-typescript-types\lib\shake.js:215:34)
at visitNode (C:\Source\unshift-issue\node_modules\typescript\lib\typescript.js:87593:23)
at Object.visitEachChild (C:\Source\unshift-issue\node_modules\typescript\lib\typescript.js:88123:222)
at visit (C:\Source\unshift-issue\node_modules\@parcel\transformer-typescript-types\lib\shake.js:68:46)
at visitNodes (C:\Source\unshift-issue\node_modules\typescript\lib\typescript.js:87646:48)
at visitLexicalEnvironment (C:\Source\unshift-issue\node_modules\typescript\lib\typescript.js:87686:22)
at Object.visitEachChild (C:\Source\unshift-issue\node_modules\typescript\lib\typescript.js:88234:55 It seems to be very similar to the test in /~https://github.com/parcel-bundler/parcel/tree/v2/packages/core/integration-tests/test/integration/ts-types/augmentation |
The test will work once you bump typescript in the monorepo. So remove the Shouldn't the fix rather be if(node.modifiers == null) node.modifiers = [];
node.modifiers.splice(...) because currently the output is module "original" {
interface Person {
name(): string;
}
} which I think is wrong? Then you can also drop the |
@mischnic I think you are right. I modified the linke so that modifiers is assigned with an empty array if it is undefined. |
And please commit this change as well:
|
Sorry about that. Tbh I did not know what you meant, but I think I found out:) |
↪️ Pull Request
This fixes #8079
💻 Examples
🚨 Test instructions
I am completely new to parcel and I have not found a good place to write a test for this. Some help would be appreciated.
✔️ PR Todo