ionic-team / stencil-component-starter

Minimal starter project for building shareable web components with Stencil
https://github.com/ionic-team/stencil
MIT License
278 stars 128 forks source link

Should TypeScript be part of the devDependencies? #115

Open iliocatallo opened 1 year ago

iliocatallo commented 1 year ago

Hi,

I usually instruct VSCode to use the TypeScript installation in node_modules/, but I just noticed that – when asked to bootstrap a new component, npm init stencil generates a package.json that does not list typescript as a dev dependency. Is this intentional?

Thank you, Ilio.

rwaskiewicz commented 1 year ago

Hi @iliocatallo 👋

Great question! This is intentional - @stencil/core contains a recent version of the TypeScript compiler. The reason for this is there is a high need for the APIs of the TypeScript compiler to match what Stencil expects to be using. As a result, a separate installation of TypeScript isn't required. For more information, please see https://stenciljs.com/docs/support-policy#typescript-support. Thanks!

iliocatallo commented 1 year ago

Hi @rwaskiewicz!

Thank you for the explanation. Question: would it make sense to require typescript (at the exact required version) as a peer dependency of @stencil/core?

If not instructed otherwise, VSCode defaults to its own version of TypeScript, which could in principle be different from the version that @stencil/core internally uses.

Ciao! Ilio.

rwaskiewicz commented 1 year ago

Question: would it make sense to require typescript (at the exact required version) as a peer dependency of @stencil/core?

Potentially in the future, it may! However at the moment such a change would require some pretty significant changes to Stencil.

If not instructed otherwise, VSCode defaults to its own version of TypeScript, which could in principle be different from the version that @stencil/core internally uses.

That's a valid point. I wonder if there's some way Stencil can tell VSCode what version of TypeScript it contains 🤔 If not, it's something we could probably add to our documentation.

mfsbo commented 1 year ago

https://github.com/Microsoft/vscode/issues/42243#issuecomment-534432789 this might be relevant to choosing typescript version via Settings.