Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6928aac

Browse filesBrowse files
authored
feat: enable TS autocomplete for Svelte HTML element definitions (#15972)
Covers #15971. adds autocomplete support to SvelteHTMLElements while preserving its functionality that key can be any string using string & {} TS trick.
1 parent 08346b5 commit 6928aac
Copy full SHA for 6928aac

File tree

Expand file treeCollapse file tree

2 files changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-3
lines changed

‎packages/svelte/elements.d.ts

Copy file name to clipboardExpand all lines: packages/svelte/elements.d.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ export interface SvelteHTMLElements {
20662066
failed?: import('svelte').Snippet<[error: unknown, reset: () => void]>;
20672067
};
20682068

2069-
[name: string]: { [name: string]: any };
2069+
[name: string & {}]: { [name: string]: any };
20702070
}
20712071

20722072
export type ClassValue = string | import('clsx').ClassArray | import('clsx').ClassDictionary;

‎packages/svelte/svelte-html.d.ts

Copy file name to clipboardExpand all lines: packages/svelte/svelte-html.d.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as svelteElements from './elements.js';
88
/**
99
* @internal do not use
1010
*/
11-
type HTMLProps<Property extends string, Override> = Omit<
11+
type HTMLProps<Property extends keyof svelteElements.SvelteHTMLElements, Override> = Omit<
1212
import('./elements.js').SvelteHTMLElements[Property],
1313
keyof Override
1414
> &
@@ -250,7 +250,7 @@ declare global {
250250
};
251251
// don't type svelte:options, it would override the types in svelte/elements and it isn't extendable anyway
252252

253-
[name: string]: { [name: string]: any };
253+
[name: string & {}]: { [name: string]: any };
254254
}
255255
}
256256
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.