Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Remote component subverts type checking #1798

Closed
geigerzaehler opened this issue Apr 16, 2021 · 0 comments
Closed

Remote component subverts type checking #1798

geigerzaehler opened this issue Apr 16, 2021 · 0 comments

Comments

@geigerzaehler
Copy link
Contributor

At the moment it is not possible to have type generic components in svelte (sveltejs/language-tools#442). This means that the Remote component has to use the any type for data passed to its slots. As a result, slots are not type-checked.

Consider the following code

<script lang="typescript">
  import * as remote from "ui/src/remote"
  type Foo = { foo: boolean }
  export let store: remote.Store<Foo>
</script>

<Remote {store} let:data>
  {data.bar}
</Remote>

This will compile although Foo does not have a bar property.

To address this I would suggest to avoid the Remote component and implement it by hand every time is used. In the example above this would result in

{#if $store.status === remote.Status.Success}
  {$store.data.bar}
{/if}

This will fail to type check.

The Remote component is quite slim and in most cases only a small part of the Remote functionality is used. I think it’s justifiable to replace it with hand-written code.

geigerzaehler pushed a commit that referenced this issue Apr 28, 2021
The API now provides the branch a commit belongs to. This partially
reverts #1717.

The issue was not discovered because of disabled type checking due
to #1798. We address this by not using the `Remote` component

The motivation for #1717 was to gracefully handle commits without
branches and not panic. We accomplish this by returning the (possibly
empty) list of all branches and only showing the first branch (if
present) in the UI.

Fixes #1793

Signed-off-by: Thomas Scholtes <[email protected]>
geigerzaehler added a commit that referenced this issue Oct 6, 2021
geigerzaehler added a commit that referenced this issue Oct 6, 2021
rudolfs pushed a commit that referenced this issue Oct 7, 2021
@rudolfs rudolfs added the next-up label Oct 7, 2021
@Kaihuang724 Kaihuang724 added bug Something isn't working tech-debt and removed bug Something isn't working labels Mar 28, 2022
@rudolfs rudolfs closed this as completed Aug 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants