-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
breaking: overhaul tsconfig #16458
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
Merged
Merged
breaking: overhaul tsconfig #16458
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
30ae1c7
breaking: overhaul tsconfig
Rich-Harris 7226b17
WIP
Rich-Harris 7562c03
fix
Rich-Harris 7beb8f1
fix
Rich-Harris 8ec3b4b
fix
Rich-Harris 6af0b20
fix
Rich-Harris 7e05269
fix
Rich-Harris 200a1b4
fix
Rich-Harris 8125a01
add $app/service-worker and $app/tsconfig/service-worker
Rich-Harris 864eba3
fix
Rich-Harris 5448b91
pacify eslint
Rich-Harris d20ced2
WIP
Rich-Harris 52a091b
WIP
Rich-Harris 9bde5cc
validation
Rich-Harris 34785ce
WIP
Rich-Harris 8e697bd
move
Rich-Harris e30e570
update tests
Rich-Harris 42b5552
WIP
Rich-Harris 3df2c0f
merge version-3
Rich-Harris 456ef07
tweak
Rich-Harris c6be788
lint
Rich-Harris e77b8d5
some docs
Rich-Harris fc36e34
docs
Rich-Harris b07be7c
fixes
Rich-Harris a0da6b2
fucking windows
Rich-Harris 1b80adb
deprecate typescript.config option
Rich-Harris 5661343
Fix: Leftover WIP code in `$app/service-worker` registers an empty no…
vercel[bot] 822e3e3
changesets
Rich-Harris 7cbc234
Merge branch 'rethink-tsconfig' of https://github.com/sveltejs/kit in…
Rich-Harris 8a4b4c8
Update packages/kit/CHANGELOG.md
Rich-Harris 91e0785
fix
Rich-Harris a0b82d1
Merge branch 'rethink-tsconfig' of https://github.com/sveltejs/kit in…
Rich-Harris 9a0fb38
fix playground
Rich-Harris 831b534
add comments/descriptions
Rich-Harris b9a91ee
attempt to explain regexes
Rich-Harris 99fdc90
parent -> id
Rich-Harris e74bfb3
inline docs
Rich-Harris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sveltejs/kit': major | ||
| --- | ||
|
|
||
| breaking: write tsconfig to `node_modules/$app/tsconfig` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sveltejs/kit': minor | ||
| --- | ||
|
|
||
| feat: `$app/service-worker` module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sveltejs/kit': minor | ||
| --- | ||
|
|
||
| feat: better tsconfig validation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| title: $app/service-worker | ||
| --- | ||
|
|
||
| This module can only be imported in service workers. | ||
|
|
||
| > MODULE: $app/service-worker |
14 changes: 14 additions & 0 deletions
14
documentation/docs/98-reference/20-$app-tsconfig-service-worker.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| title: $app/tsconfig/service-worker | ||
| --- | ||
|
|
||
| This module contains TypeScript configuration tailored for your service worker: | ||
|
|
||
| ```json | ||
| /// file: src/service-worker/tsconfig.json | ||
| { | ||
| "extends": "$app/tsconfig/service-worker" | ||
| } | ||
| ``` | ||
|
|
||
| You can extend this configuration with your own `compilerOptions`, adhering to the same restrictions as [`$app/tsconfig`]($app-tsconfig). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| --- | ||
| title: $app/tsconfig | ||
| --- | ||
|
|
||
| This module contains TypeScript configuration tailored for your app. Your own config should extend it — a typical `tsconfig.json` looks like this: | ||
|
|
||
| ```json | ||
| /// file: tsconfig.json | ||
| { | ||
| "extends": "$app/tsconfig", | ||
| "includes": ["src", "test"], | ||
| "excludes": ["src/service-worker"] | ||
| } | ||
| ``` | ||
|
|
||
| You can extend this configuration with your own `compilerOptions`. Overriding the following properties may cause things to break — SvelteKit will warn you if this happens: | ||
|
|
||
| - `paths` — this is derived from the (deprecated) [`alias`](configuration#alias) config option, together with any [subpath imports](https://nodejs.org/api/packages.html#subpath-imports) specified in your `package.json`, to align behaviour between Vite and TypeScript. Ideally, configure subpath imports rather than using `paths` directly | ||
| - `types` — your app needs to be able to 'see' generated module declarations for things like [environment variables](environment-variables), and as such this array must include `"$app/types"` | ||
| - `isolatedModules` — must be `true`, as Vite compiles modules one at a time | ||
| - `verbatimModuleSyntax` — must be `true`, so that you can safely use type imports in `.svelte` files | ||
|
|
||
| Note that the example configuration above excludes `src/service-worker`, because service workers need to be in their own TypeScript project. If you are using a service worker, create a `src/service-worker/tsconfig.json` that extends [`$app/tsconfig/service-worker`]($app-tsconfig-service-worker). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "extends": "./.svelte-kit/tsconfig.json", | ||
| "extends": "$app/tsconfig", | ||
| "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "extends": "./.svelte-kit/tsconfig.json", | ||
| "extends": "$app/tsconfig", | ||
| "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte", "*.js", "test/*.js"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.