Skip to content

Commit

Permalink
fix: make param matcher generated type import with a .js extension (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
eltigerchino authored Jan 8, 2025
1 parent 450ec48 commit d09bc03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/slimy-cows-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: make param matchers generated type import end with `.js`
2 changes: 1 addition & 1 deletion packages/kit/src/core/sync/write_types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ function replace_ext_with_js(file_path) {
function generate_params_type(params, outdir, config) {
/** @param {string} matcher */
const path_to_matcher = (matcher) =>
posixify(path.relative(outdir, path.join(config.kit.files.params, matcher)));
posixify(path.relative(outdir, path.join(config.kit.files.params, matcher + '.js')));

return `{ ${params
.map(
Expand Down

0 comments on commit d09bc03

Please sign in to comment.