Skip to content

Commit 5caa2c4

Browse files
Rationale: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#ts-ignore-or-ts-expect-error There were a few unnecessary @ts-ignore which this change pointed out (which is why the diff has more removals than insertions).
1 parent f360a9f commit 5caa2c4

File tree

22 files changed

+54
-57
lines changed

22 files changed

+54
-57
lines changed

packages/kit/src/core/adapt/test/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ suite('copy files', () => {
3030
/** @type {import('types/config').ValidatedConfig} */
3131
const config = {
3232
kit: {
33-
// @ts-ignore
33+
// @ts-expect-error
3434
files: {
3535
assets: join(__dirname, 'fixtures/basic/static')
3636
},
@@ -76,13 +76,13 @@ suite('prerender', async () => {
7676
const config = {
7777
extensions: ['.svelte'],
7878
kit: {
79-
// @ts-ignore
79+
// @ts-expect-error
8080
files: {
8181
assets: join(__dirname, 'fixtures/prerender/static'),
8282
routes: join(__dirname, 'fixtures/prerender/src/routes')
8383
},
8484
appDir: '_app',
85-
// @ts-ignore
85+
// @ts-expect-error
8686
prerender: {
8787
pages: ['*'],
8888
enabled: true

packages/kit/src/core/build/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ async function build_server(
468468
// this API is marked as @alpha https://github.com/vitejs/vite/blob/27785f7fcc5b45987b5f0bf308137ddbdd9f79ea/packages/vite/src/node/config.ts#L129
469469
// it's not exposed in the typescript definitions as a result
470470
// so we need to ignore the fact that it's missing
471-
// @ts-ignore
472471
ssr: {
473472
// note to self: this _might_ need to be ['svelte', '@sveltejs/kit', ...get_no_external()]
474473
// but I'm honestly not sure. roll with this for now and see if it's ok

packages/kit/src/core/config/index.spec.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { deep_merge, validate_config } from './index.js';
55
test('fills in defaults', () => {
66
const validated = validate_config({});
77

8-
// @ts-ignore
8+
// @ts-expect-error
99
delete validated.kit.vite;
1010

1111
assert.equal(validated, {
@@ -66,7 +66,7 @@ test('errors on invalid values', () => {
6666
assert.throws(() => {
6767
validate_config({
6868
kit: {
69-
// @ts-ignore
69+
// @ts-expect-error
7070
target: 42
7171
}
7272
});
@@ -78,7 +78,7 @@ test('errors on invalid nested values', () => {
7878
validate_config({
7979
kit: {
8080
files: {
81-
// @ts-ignore
81+
// @ts-expect-error
8282
potato: 'blah'
8383
}
8484
}
@@ -105,7 +105,7 @@ test('fills in partial blanks', () => {
105105

106106
assert.equal(validated.kit.vite(), {});
107107

108-
// @ts-ignore
108+
// @ts-expect-error
109109
delete validated.kit.vite;
110110

111111
assert.equal(validated, {
@@ -248,7 +248,6 @@ function validate_paths(name, input, output) {
248248
assert.equal(
249249
validate_config({
250250
kit: {
251-
// @ts-ignore
252251
paths: input
253252
}
254253
}).kit.paths,

packages/kit/src/core/config/test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function testLoadDefaultConfig(path) {
1515

1616
const config = await load_config({ cwd });
1717

18-
// @ts-ignore
18+
// @ts-expect-error
1919
delete config.kit.vite; // can't test equality of a function
2020

2121
assert.equal(config, {

packages/kit/src/core/create_manifest_data/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@ export default function create_manifest_data({ config, output, cwd = process.cwd
247247
type: 'page',
248248
pattern,
249249
params,
250-
// @ts-ignore
250+
// @ts-expect-error
251251
path,
252-
// @ts-ignore
252+
// @ts-expect-error
253253
a,
254-
// @ts-ignore
254+
// @ts-expect-error
255255
b
256256
});
257257
} else {

packages/kit/src/core/create_manifest_data/index.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const create = (dir, extensions = ['.svelte']) => {
1616
config: {
1717
extensions,
1818
kit: {
19-
// @ts-ignore
19+
// @ts-expect-error
2020
files: {
2121
assets: path.resolve(cwd, 'static'),
2222
routes: path.resolve(cwd, dir)

packages/kit/src/core/server/cert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @ts-ignore
1+
// @ts-expect-error
22
import { generate } from 'selfsigned';
33

44
/**

packages/kit/src/runtime/app/navigation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const prefetchRoutes = import.meta.env.SSR ? guard('prefetchRoutes') : pr
1919
* @type {import('$app/navigation').goto}
2020
*/
2121
async function goto_(href, opts) {
22-
// @ts-ignore
22+
// @ts-expect-error
2323
return router.goto(href, opts, []);
2424
}
2525

@@ -28,15 +28,15 @@ async function goto_(href, opts) {
2828
*/
2929
async function invalidate_(resource) {
3030
const { href } = new URL(resource, location.href);
31-
// @ts-ignore
31+
// @ts-expect-error
3232
return router.renderer.invalidate(href);
3333
}
3434

3535
/**
3636
* @type {import('$app/navigation').prefetch}
3737
*/
3838
function prefetch_(href) {
39-
// @ts-ignore
39+
// @ts-expect-error
4040
return router.prefetch(new URL(href, get_base_uri(document)));
4141
}
4242

@@ -45,14 +45,14 @@ function prefetch_(href) {
4545
*/
4646
async function prefetchRoutes_(pathnames) {
4747
const matching = pathnames
48-
? // @ts-ignore
48+
? // @ts-expect-error
4949
router.routes.filter((route) => pathnames.some((pathname) => route[0].test(pathname)))
50-
: // @ts-ignore
50+
: // @ts-expect-error
5151
router.routes;
5252

5353
const promises = matching
5454
.filter((r) => r && r.length > 1)
55-
// @ts-ignore
55+
// @ts-expect-error
5656
.map((r) => Promise.all(r[1].map((load) => load())));
5757

5858
await Promise.all(promises);

packages/kit/src/runtime/app/stores.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const getStores = () => {
2626
navigating: {
2727
subscribe: stores.navigating.subscribe
2828
},
29-
// @ts-ignore - deprecated, not part of type definitions, but still callable
29+
// @ts-expect-error - deprecated, not part of type definitions, but still callable
3030
get preloading() {
3131
console.error('stores.preloading is deprecated; use stores.navigating instead');
3232
return {

packages/kit/src/runtime/client/renderer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ export class Renderer {
8282

8383
/** @type {import('./types').NavigationState} */
8484
this.current = {
85-
// @ts-ignore
85+
// @ts-expect-error
8686
page: null,
87-
// @ts-ignore
87+
// @ts-expect-error
8888
session_id: null,
8989
branch: []
9090
};
@@ -198,7 +198,7 @@ export class Renderer {
198198
dispatchEvent(new CustomEvent('sveltekit:navigation-start'));
199199

200200
if (this.started) {
201-
// @ts-ignore
201+
// @ts-expect-error
202202
this.stores.navigating.set({
203203
from: {
204204
path: this.current.page.path,
@@ -327,7 +327,7 @@ export class Renderer {
327327
*/
328328
async _get_navigation_result(info, no_cache) {
329329
if (this.loading.id === info.id) {
330-
// @ts-ignore if the id is defined then the promise is too
330+
// @ts-expect-error if the id is defined then the promise is too
331331
return this.loading.promise;
332332
}
333333

@@ -544,7 +544,7 @@ export class Renderer {
544544
}
545545

546546
const [pattern, a, b, get_params] = route;
547-
// @ts-ignore - the pattern is for the route which we've already matched to this path
547+
// @ts-expect-error - the pattern is for the route which we've already matched to this path
548548
const params = get_params ? get_params(pattern.exec(path)) : {};
549549

550550
const changed = this.current.page && {

0 commit comments

Comments
 (0)