Skip to content

Commit

Permalink
make SvelteComponentDev typings more forgiving (#5937)
Browse files Browse the repository at this point in the history
Add `$$events_def` and `$$slot_def` so that users can do
```
let el: SvelteComponent;
<SomeComponent bind:this={el} />
```
without type errors.
  • Loading branch information
dummdidumm committed Jan 29, 2021
1 parent 842a0b1 commit 0f3264e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Throw a parser error for `class:` directives with an empty class name ([#5858](https://github.com/sveltejs/svelte/issues/5858))
* Fix type inference for derived stores ([#5935](https://github.com/sveltejs/svelte/pull/5935))
* Make parameters of built-in animations and transitions optional ([#5936](https://github.com/sveltejs/svelte/pull/5936))
* Make `SvelteComponentDev` typings more forgiving ([#5937](https://github.com/sveltejs/svelte/pull/5937))

## 3.32.0

Expand Down
14 changes: 14 additions & 0 deletions src/runtime/internal/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,20 @@ export class SvelteComponentDev extends SvelteComponent {
* ### DO NOT USE!
*/
$$prop_def: Props;
/**
* @private
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*/
$$events_def: any;
/**
* @private
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*/
$$slot_def: any;

constructor(options: {
target: Element;
Expand Down

0 comments on commit 0f3264e

Please sign in to comment.