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

feat!(app-vite): auto generate base tsconfig and types #17549

Open
wants to merge 28 commits into
base: dev
Choose a base branch
from

Conversation

yusufkandemir
Copy link
Member

@yusufkandemir yusufkandemir commented Sep 30, 2024

What kind of change does this PR introduce?

  • Feature
  • Documentation

Does this PR introduce a breaking change?

  • Yes

tsconfig-preset(from v1) and stricter-tsconfig-preset(from older v2 beta) has been removed:

- "extends": "@quasar/app-vite/tsconfig-preset"
+ "extends": "./.quasar/tsconfig.json"

For more info, please check the documentation changes in this PR.

The PR fulfills these requirements:

  • It's submitted to the dev branch (or v[X] branch)

Other information:
Initially discussed in #17493 (reply in thread)

  • It's now possible to dynamically update the tsconfig on the fly
  • The used tsconfig options have been improved
  • Aliases(quasar.config file > build > alias) will now be automatically recognized by TS. No need to add them manually to tsconfig.json, or to use some Vite plugins that extract from tsconfig.json.
  • Capacitor deps are properly linked to TS. No more need to install Capacitor deps in both /src-capacitor and in the root. Just installing into /src-capacitor will now be enough.
  • Types feature flag files (e.g. pwa-flag.d.ts), src/quasar.d.ts, and src/shims-vue.d.ts will be generated into .quasar, hiding some complexity from the users and making updates easier

Will be ported to app-webpack in a separate PR.

@yusufkandemir
Copy link
Member Author

The project creation tests use the latest version from the npm registry and not the local version. So, having failed tests is normal as the new template is not compatible with the latest app-vite release.

the Vite aliases were already there, thanks to this, TypeScript won't
complain about using Capacitor deps inside src/ anymore
enforce TS >=5.4 to use module: 'preserve'
forceConsistentCasingInFileNames defaults to true since TS 5.0
verbatimModuleSyntax will require user to update their codes
jsx: preserve is no longer needed for Vue Language Tools

strict: true and some of the other strict options will be added through a flag
compared to previous regular preset:
noUnusedLocals is turned off as it produces extra noise when using ESLint, where the behavior is better as it's configurable

compared to previous stricter config:
noPropertyAccessFromIndexSignature is removed as it doesn't even allow process.env.DEV unless it's augmented explicitly, which we don't do at the moment. It enforces process.env['DEV'] instead, which is annoying and confusing to use. We can't augment the env variables as Node types enforce string, but our own types are actual boolean values.

noImplicitReturns reduces the DX and is not that beneficial in app code compared to its use in library code. It still has it's uses, but it doesn't belong the usual strictness.
they were throwing errors, now we skip them for an even slimmer result
when .quasar/tsconfig.json is missing prior to generation
now it will re-generate the types if build.typescript or build.alias gets updated
to generate tsconfig and types
as feature flags are handled into .quasar now
@yusufkandemir yusufkandemir force-pushed the feat-auto-generate-base-tsconfig-and-types branch from 4185c31 to 4cbf57d Compare November 12, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant