Closed johncowen closed 1 week ago
Name | Link |
---|---|
Latest commit | 7c92fdfbbb3a059e0dd613d3729a1a7428d728f7 |
Latest deploy log | https://app.netlify.com/sites/kuma-gui/deploys/673635a87ca3580008143b06 |
Deploy Preview | https://deploy-preview-3185--kuma-gui.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
I realized I needed to amend slightly, and I added more info to the description because of this for "future us" if we ever come back to read this.
Ideally we wouldn't have to set srcData to
unknown
here and we'd continue to useTypeOf<T>
which is the type returned by the src from thesources.ts
file, whatever that is.Thing is our upgrade to vue 3.5 is breaking in this area (https://github.com/kumahq/kuma-gui/pull/3062).
I was kinda holding off with the hope that it would be sorted upstream, and I wanted to avoid using a
@ts-ignore
in order to upgrade. It's also worth noting that srcError uses the exact same construct, but doesn't cause TS issues, which I think is due to it not using a generic type.Then I had another idea. Seeing as we mostly cast
srcData
back to aNonNullable<TypeOf<T>>
in most places anyway, and we don't need to refer to it within the component at all, we may as well treat it asunknown
, which is kinda better than using@ts-ignore
. If we useunknown
if you do try to usesrcData
within the component you will have to infer it some other way.I gave this a whirl against https://github.com/kumahq/kuma-gui/pull/3062 and it seems to work fine 🎉 so I decided to PR it separately so we can then rebase the Vue upgrade and move forwards with that.
edit: I made one more amend here post approval which was to be more careful with the type we use for the exported
data
, for example in#loadable
data
can beundefined
until the DataLoader has loaded, so we don't want to useNonNullable
there