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

bug: Unknown compiler option 'useUnknownInCatchVariables'. #3170

Closed
3 tasks done
zardoy opened this issue Dec 5, 2021 · 4 comments
Closed
3 tasks done

bug: Unknown compiler option 'useUnknownInCatchVariables'. #3170

zardoy opened this issue Dec 5, 2021 · 4 comments
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@zardoy
Copy link

zardoy commented Dec 5, 2021

Prerequisites

Stencil Version

v2.11.0

Current Behavior

Fails to start with this option present in tsconfig.

Expected Behavior

Not fail.

Steps to Reproduce

  1. Grab https://github.com/ionic-team/stencil-component-starter.
  2. Add this to compilerOptions of tsconfig:
"useUnknownInCatchVariables": true,

Code Reproduction URL

https://github.com/ionic-team/stencil-component-starter

Additional Information

For context: I can't really just remove this flag, since its in my shared tsconfig (I'm extending from it).
I don't really understand how the compiler works without installing typescript as dependency. I can only see you have locked TS version in package.json, but why?

@ionitron-bot ionitron-bot bot added the triage label Dec 5, 2021
@zardoy zardoy changed the title bug: Unknown compiler option 'useUnknownInCatchVariables'. bug: Unknown compiler option 'useUnknownInCatchVariables'. Dec 5, 2021
@rwaskiewicz
Copy link
Member

Hey @zardoy 👋

The reason this is occurring is that Stencil bundles the TypeScript compiler version for its users. The reason for this is that we need to make certain guarantees around typings, how TypeScript defines internal data structures when we compile web components and more. Because we have such strong guarantees that we need to meet, we internally pin the TypeScript version to a specific version. Currently, we pin TypeScript to v4.3

It looks like useUnknownInCatchVariables was introduced in v4.4, which explains the issue you've explained here. At this time, it doesn't look like there's an easy way to suppress that message. We're going to moving Stencil to v4.4 in the next few months. In the mean time, I would suggest not using the shared tsconfig you mentioned if at all possible. I know that can be tough for a few reasons, but unfortunately that's the best workaround I can offer at this time. Once Stencil has been released using v4.4 of TypeScript, this issue should be resolved

@rwaskiewicz rwaskiewicz added Bug: Validated This PR or Issue is verified to be a bug within Stencil Feature: Compiler and removed triage labels Dec 6, 2021
@zardoy
Copy link
Author

zardoy commented Dec 7, 2021

I personally think it is a typescript failure as it doesn't provide a way to reset compilerOptions in tsconfig.
However, is there a way to make Stencil print a warning instead of crashing at startup? If there is no easy way of achieving that, I'll just wait for the next release.

@rwaskiewicz
Copy link
Member

Not at this time, there isn't a way to configure Stencil from an end user side to print a warning in this scenario

@rwaskiewicz
Copy link
Member

This issue has been fixed in Stencil v2.14.0 which is now available. Thanks again for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
Development

No branches or pull requests

2 participants