Skip to content

fix: generate typescript types for healthcheck pkg #8846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 3, 2023

Conversation

coadler
Copy link
Contributor

@coadler coadler commented Aug 1, 2023

No description provided.

@coadler coadler self-assigned this Aug 1, 2023
@coadler coadler force-pushed the colin/healthcheck-ts-types branch from 6e6dea2 to 6d967c0 Compare August 1, 2023 19:03
@coadler coadler changed the title fix: generate typescript types for healthcheck fix: generate typescript types for healthcheck pkg Aug 1, 2023
@coadler coadler requested a review from Emyrk August 1, 2023 19:50
Copy link
Member

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have wondered if we would ever branch out from the codersdk package.

I am not opposed to doing this, but I wonder if we should just concat these in the same file. Keeping them together helps with cross references, but if there are none, maybe we just run this twice. Once on each file and have 2 typesGenerated.ts files or something.

I won't block merging them though if we add proper dividers.


My main objection is these generated types have a lot of any types. Those types in Go don't have json tags. So is generating these structs actually helpful to the UI?

readonly healthy: boolean
// Named type "tailscale.com/tailcfg.DERPRegion" unknown, using "any"
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- External type
readonly region?: any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these json fields uppercase? I don't see json tags on the tailcfg struct.

So should these be in our api? I assume these apis are user faceing?

Copy link
Contributor Author

@coadler coadler Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah they are, but they're mostly just for human consumption in the debug menu. I might fix these in the future if the frontend needs them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these at all in the typesgenerated then? Is the debug menu in the FE? And does it access any of these fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bruno is writing a page in the FE for the healthcheck, and would like to be able to parse some of the output. The Tailscale internal stuff isn't too important currently.

readonly regions: Record<number, HealthcheckDERPRegionReport>
// Named type "tailscale.com/net/netcheck.Report" unknown, using "any"
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- External type
readonly netcheck?: any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also doesn't have json tags?

@coadler coadler requested a review from Emyrk August 1, 2023 20:53
@coadler coadler requested a review from Emyrk August 2, 2023 19:36
@coadler coadler merged commit 8ee500c into main Aug 3, 2023
@coadler coadler deleted the colin/healthcheck-ts-types branch August 3, 2023 21:20
@github-actions github-actions bot locked and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants