Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: updateDeleteWorkspaceOptions to pick properties correctly#13423

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Parkreiner merged 4 commits intomainfrommes/delete-type-fix
May 31, 2024

Conversation

Parkreiner
Copy link
Member

@ParkreinerParkreiner commentedMay 31, 2024
edited
Loading

Found this while writing the docs for the Backstage Coder SDK:

exporttypeDeleteWorkspaceOptions=Pick<TypesGen.CreateWorkspaceBuildRequest,"log_level"&"orphan">;

It's literally a single character difference, but the secondPick argument should be:

"log_level"|"orphan"

Changes made

  • Changed the& to a|
  • Updated one of the calls to the deletion method to fix a typo that was being allowed because of the incorrect type
  • Updated one the test files to use the correct property format

Explanation

With the&, you have an intersection instead of a union. Basically, that says "give me a type that is both the literal"log_level" and the literal"orphan" at the same time". It's impossible for a value to be two different things at the exact same time, so the resulting type isnever. When you picknever from an object, you pick nothing, so the ultimate resulting type is the type{} (which is equivalent toNonullable<unknown>).Nonullable<unknown> isn't much better than anany type – it's basicallyany, but withnull andundefined removed

@ParkreinerParkreiner self-assigned thisMay 31, 2024
Copy link

@cdr-botcdr-botbot left a comment

Choose a reason for hiding this comment

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

This PR is a hotfix and has been automatically approved.

  • ✅ Base is main
  • ✅ Has hotfix label
  • ✅ Head is from coder/coder
  • ✅ Less than 100 lines

@ParkreinerParkreinerenabled auto-merge (squash)May 31, 2024 03:26
@ParkreinerParkreinerdisabled auto-mergeMay 31, 2024 03:59
@matifali
Copy link
Member

matifali commentedMay 31, 2024
edited
Loading

@Parkreiner could it be related to#13257.
I am not able to delete workspaces for a while.

@Parkreiner
Copy link
MemberAuthor

Parkreiner commentedMay 31, 2024
edited
Loading

@matifali I haven't had the chance to touch the backend part of Coder core yet (I still need to learn Go), so I'm not 100% sure. My gut feeling, though, is that it wouldn't affect things too much

The client-side function takes the ID of a workspace, and an optional options object. This PR only affects that options object, and while incorrect properties were getting added to it, I would expect the server to just filter those out. The object has no required properties

matifali reacted with thumbs up emoji

@ParkreinerParkreiner merged commit19530c6 intomainMay 31, 2024
31 checks passed
@ParkreinerParkreiner deleted the mes/delete-type-fix branchMay 31, 2024 14:24
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMay 31, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@kylecarbskylecarbskylecarbs approved these changes

@cdr-botcdr-bot[bot]cdr-bot[bot] approved these changes

Assignees

@ParkreinerParkreiner

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@Parkreiner@matifali@kylecarbs

[8]ページ先頭

©2009-2025 Movatter.jp