Skip to content

Commit d09bc03

Browse files
authored
fix: make param matcher generated type import with a .js extension (#13286)
fixes #13280 Similar to #5907 we need to import the param matchers file ending with .js so that when the moduleResolution is set to something strict such as NodeNext (the default for libraries) the type inference isn't lost when it can't resolve the param matcher file due to the lack of a file extension.
1 parent 450ec48 commit d09bc03

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/slimy-cows-listen.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
fix: make param matchers generated type import end with `.js`

packages/kit/src/core/sync/write_types/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ function replace_ext_with_js(file_path) {
585585
function generate_params_type(params, outdir, config) {
586586
/** @param {string} matcher */
587587
const path_to_matcher = (matcher) =>
588-
posixify(path.relative(outdir, path.join(config.kit.files.params, matcher)));
588+
posixify(path.relative(outdir, path.join(config.kit.files.params, matcher + '.js')));
589589

590590
return `{ ${params
591591
.map(

0 commit comments

Comments
 (0)