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

Make strict mode the default when choosing Typescript #4395

Closed
dummdidumm opened this issue Mar 20, 2022 · 3 comments
Closed

Make strict mode the default when choosing Typescript #4395

dummdidumm opened this issue Mar 20, 2022 · 3 comments

Comments

@dummdidumm
Copy link
Member

Describe the problem

From a recent conversation I learned that nowadays almost every Typescript starter template of other frameworks (example: the vite templates) and the typescript cli itself default to turning on strict mode. This issue is intended to discuss turning strict mode on for create-svelte, too, and after that I'm happy to open PRs for the vite/rollup template doing the same.

Arguments in favor of strict mode:

  • way easier to have it turned on from the start than turning it on later and converting an existing code base
  • the TS ecosystem as a whole recommends turning it on by default
  • the strict null checks are very nice for catching nullpointer errors early
  • if it's off by default, people might be surprised about nullpointers not getting caught because they thought TS should catch these things, too

Arguments against it:

  • Potentially steeper learning curve for those new to it

Describe the proposed solution

Turn on strict mode in the starter templates

Alternatives considered

Only turn on a subset of it, for example only the strict null checks option which is arguably the most important one

Importance

would make my life easier

Additional Information

No response

@Conduitry
Copy link
Member

This sounds like a good idea to me.

@frederikhors
Copy link
Contributor

Just to laugh for a moment.

In a recent project (still very small, a few dozen files), activating the strict there are 724 errors with svelte-check. Wow!

Anyway I agree to enable it.

@Rich-Harris
Copy link
Member

closed via #4633, which adds "strict": true to the user-editable tsconfig that gets generated when you npm init svelte and choose TypeScript or type-checked JS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants