-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
Description
Describe the bug
part
is a global HTML attribute with wide (but not total) browser support. Using it in a svelte component with typescript in VS code with the language-tools extension gives an error that
Argument of type '{ part: string; }' is not assignable to parameter of type 'HTMLProps<"div", HTMLAttributes<any>>'.
Object literal may only specify known properties, and '"part"' does not exist in type 'HTMLProps<"div", HTMLAttributes<any>>'.ts(2345)
The actual behavior seems to work correctly and there are no complaints by svelte-check.
The language-tools docs suggest opening an issue here to add part
to the HTML typings.
Reproduction
<script lang="ts">
export function shadow(node: HTMLDivElement) {
const shadowRoot = node.attachShadow({ mode: "open" });
const children = Array.from(node.children);
children.forEach((child) => shadowRoot.appendChild(child));
}
</script>
<div use:shadow>
<div part="house" />
</div>
<style>
div::part(house) {
height: 8em;
width: 8em;
}
</style>
This throws the error in Visual Code v1.74.2 with the Svelte for VS Code v107.0.0 extension.
Logs
No response
System Info
System:
OS: macOS 12.6.2
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 5.27 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
Browsers:
Chrome: 108.0.5359.124
Safari: 16.2
npmPackages:
rollup: ^2.3.4 => 2.42.1
svelte: ^3.0.0 => 3.55.0
Severity
annoyance