diff --git a/.changeset/strong-bikes-join.md b/.changeset/strong-bikes-join.md new file mode 100644 index 000000000000..9123faefac07 --- /dev/null +++ b/.changeset/strong-bikes-join.md @@ -0,0 +1,5 @@ +--- +'create-svelte': patch +--- + +fix: generate tsconfig/jsconfig correctly for library option diff --git a/packages/create-svelte/bin.js b/packages/create-svelte/bin.js index ce5251d6932e..274cfddca510 100755 --- a/packages/create-svelte/bin.js +++ b/packages/create-svelte/bin.js @@ -63,15 +63,14 @@ const options = await p.group( types: () => p.select({ message: 'Add type checking with TypeScript?', + initialValue: /** @type {'checkjs' | 'typescript' | null} */ ('checkjs'), options: [ { label: 'Yes, using JavaScript with JSDoc comments', - // @ts-expect-error :shrug: value: 'checkjs' }, { label: 'Yes, using TypeScript syntax', - // @ts-expect-error :shrug: value: 'typescript' }, { label: 'No', value: null } diff --git a/packages/create-svelte/shared/+libskeleton+checkjs/jsconfig.json b/packages/create-svelte/shared/+skeletonlib+checkjs/jsconfig.json similarity index 100% rename from packages/create-svelte/shared/+libskeleton+checkjs/jsconfig.json rename to packages/create-svelte/shared/+skeletonlib+checkjs/jsconfig.json diff --git a/packages/create-svelte/shared/+libskeleton+typescript/tsconfig.json b/packages/create-svelte/shared/+skeletonlib+typescript/tsconfig.json similarity index 100% rename from packages/create-svelte/shared/+libskeleton+typescript/tsconfig.json rename to packages/create-svelte/shared/+skeletonlib+typescript/tsconfig.json diff --git a/packages/create-svelte/shared/+libskeleton-typescript/jsconfig.json b/packages/create-svelte/shared/+skeletonlib-typescript/jsconfig.json similarity index 100% rename from packages/create-svelte/shared/+libskeleton-typescript/jsconfig.json rename to packages/create-svelte/shared/+skeletonlib-typescript/jsconfig.json diff --git a/packages/create-svelte/tsconfig.json b/packages/create-svelte/tsconfig.json index 83b0d9ea9f79..8b8e546b7866 100644 --- a/packages/create-svelte/tsconfig.json +++ b/packages/create-svelte/tsconfig.json @@ -3,11 +3,12 @@ "allowJs": true, "checkJs": true, "noEmit": true, - "noImplicitAny": true, "target": "esnext", "module": "esnext", "moduleResolution": "node", - "allowSyntheticDefaultImports": true + "allowSyntheticDefaultImports": true, + "strict": true, + "skipLibCheck": true }, "include": ["./scripts/**/*", "./index.js", "./bin.js", "./utils.js"] } diff --git a/packages/create-svelte/utils.js b/packages/create-svelte/utils.js index 2f97cddb5d14..82a9120017b6 100644 --- a/packages/create-svelte/utils.js +++ b/packages/create-svelte/utils.js @@ -7,7 +7,7 @@ export function mkdirp(dir) { try { fs.mkdirSync(dir, { recursive: true }); } catch (e) { - if (e.code === 'EEXIST') return; + if (/** @type {any} */ (e).code === 'EEXIST') return; throw e; } }