-
Notifications
You must be signed in to change notification settings - Fork 245
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
Unknown error: Cannot read property 'declarations' of undefined #2349
Comments
I see - the code does not compile, so I think what is happening is the type checker inserts an "error type" which does not have an associated symbol (intentionally); which then causes this check to fail. In such cases, we cannot rescue the failure anyway, and double-reporting it is no use... So I'll just make that code more defensive to the missing symbol. It's also fairly tricky to reproduce because this will mostly materialise when working under |
When the source code does not compile due to type checking errors, the TypeScript program model may include "error type" placeholders, to allow the compiler to provide feedback on subsequent code. The placeholder types do not have a symbol (quite intentionally!), and will hence cause a failure in the `Assembler.validateHeritageClauses` method. This change makes the code more defensive so it does not crash on this symptom, and does not report an additional error either (the TypeScript compiler will have done this for us already). The bug is more likely to hit users operating under `--watch`, as the type checker is more likely to be able to insert placeholder types in this case, as a previous version of the program might be used as a crutch to understand the error's context... This makes this bug difficult to reproduce in lab conditions, and is why this change does not include a corresponding unit test. Fixes #2349
When the source code does not compile due to type checking errors, the TypeScript program model may include "error type" placeholders, to allow the compiler to provide feedback on subsequent code. The placeholder types do not have a symbol (quite intentionally!), and will hence cause a failure in the `Assembler.validateHeritageClauses` method. This change makes the code more defensive so it does not crash on this symptom, and does not report an additional error either (the TypeScript compiler will have done this for us already). The bug is more likely to hit users operating under `--watch`, as the type checker is more likely to be able to insert placeholder types in this case, as a previous version of the program might be used as a crutch to understand the error's context... This makes this bug difficult to reproduce in lab conditions, and is why this change does not include a corresponding unit test. Fixes #2349 --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
|
🐛 Bug Report
Affected Languages
TypeScript
orJavascript
General Information
What is the problem?
I am not 100% sure about the circumstances of this error, but the compiler throws this error (usually when there are actual compilation issues).
Verbose Log
Repro
I've uploaded a zip file with the repo to here. To see the issue, run
yarn build
frompackages/@aws-cdk/aws-secretsmanager
.The text was updated successfully, but these errors were encountered: