Skip to content

Commit

Permalink
Fix optional parameter types (#797)
Browse files Browse the repository at this point in the history
* Fix optional parameter types

* fix: ensure generated types match eslint and prettier

* refactor: instead of formatting generated types, ignore them in eslint

---------

Co-authored-by: dominikg <[email protected]>
  • Loading branch information
bluwy and dominikg authored Nov 17, 2023
1 parent cf1ef58 commit 158a6d5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-dryers-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/vite-plugin-svelte': patch
---

Fix optional parameter types
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,6 @@ module.exports = {
'no-unused-vars': 'off'
}
}
]
],
ignorePatterns: ['packages/*/types/index.d.ts', 'packages/*/types/index.d.ts.map']
};
2 changes: 1 addition & 1 deletion packages/vite-plugin-svelte/src/preprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const supportedScriptLangs = ['ts'];
export const lang_sep = '.vite-preprocess';

/**
* @param {import('./public.d.ts').VitePreprocessOptions} opts
* @param {import('./public.d.ts').VitePreprocessOptions} [opts]
* @returns {import('svelte/compiler').PreprocessorGroup}
*/
export function vitePreprocess(opts) {
Expand Down
4 changes: 2 additions & 2 deletions packages/vite-plugin-svelte/src/utils/load-svelte-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ async function dynamicImportDefault(filePath, timestamp) {
}

/**
* @param {import('vite').UserConfig} viteConfig
* @param {Partial<import('../public.d.ts').Options>} inlineOptions
* @param {import('vite').UserConfig} [viteConfig]
* @param {Partial<import('../public.d.ts').Options>} [inlineOptions]
* @returns {Promise<Partial<import('../public.d.ts').SvelteConfig> | undefined>}
*/
export async function loadSvelteConfig(viteConfig, inlineOptions) {
Expand Down
4 changes: 2 additions & 2 deletions packages/vite-plugin-svelte/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ declare module '@sveltejs/vite-plugin-svelte' {
style?: boolean | InlineConfig | ResolvedConfig;
}
export function svelte(inlineOptions?: Partial<Options> | undefined): import('vite').Plugin[];
export function vitePreprocess(opts: VitePreprocessOptions): import('svelte/compiler').PreprocessorGroup;
export function loadSvelteConfig(viteConfig: import('vite').UserConfig, inlineOptions: Partial<Options>): Promise<Partial<SvelteConfig> | undefined>;
export function vitePreprocess(opts?: VitePreprocessOptions | undefined): import('svelte/compiler').PreprocessorGroup;
export function loadSvelteConfig(viteConfig?: import("vite").UserConfig | undefined, inlineOptions?: Partial<Options> | undefined): Promise<Partial<SvelteConfig> | undefined>;
}

//# sourceMappingURL=index.d.ts.map

0 comments on commit 158a6d5

Please sign in to comment.