Update adapter entrypoint typings to be NodeNext/ESNext-compatible. #5111
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.
As discussed in #5110, the entry
index.d.ts
files of the adapters all use a node-resolution-compatible export syntax like this:However, all of these packages use ESM (instead of CommonJS) so they can instead use:
Making this change resolves a Typescript 4.7+ error where
import adapter from '@sveltejs/adapter-auto';
throws a compiler error when thetsconfig.json
is configured withmoduleResolution
set toNodeNext
orESNext
.To make this change, all of the
index.js
files that import these types have to have their JSDoc import statements changed to explicitly grab thedefault
export. E.g./** @type {import('.')} **/
➡️/** @type {import('.').default} **/
.Since these packages are already modules these typings are more technically correct, though it's possible that this change will result in new Typescript errors for some compiler configurations. With Typescript 4.8 (dev), I can confirm that this change results in no errors with either of the following
tsconfig
configurations:Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0