sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: TypeScript
Issue: Operator to produce keys of a type where the properties of that type in those keys match some type
Labels: Suggestion,Awaiting More Feedback

# Suggestion

<!--
  Please fill in each section completely. Thank you!
-->

## 🔍 Search Terms

keyof property keysOfType

## ✅ Viability Checklist

My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x]  This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).


## ⭐ Suggestion

We frequently get people writing definitions to produce the keys `K` of an object type `O` where `O[K] extends T`. Let's call this operation `KeysOfType<O, T>`. Varying userland definitions include

```ts
type ObjectKey<O, T> = {[K in keyof O]: O[K] extends T ? K : never}[keyof O & string]
// TODO: Link more definitions
```

These userland definitions work in concrete cases, but can't be used to write generic functions:
```ts
type ObjectKey<O, T> = {[K in keyof O]: O[K] extends T ? K : never}[keyof O & string];
function getString<O extends object, K extends ObjectKey<O, string>>(obj: O, key: K): string {
    // Can't assign ObjectKey<O, K> to 'string', but this is sound by construction
    return obj[key];
}

// Demo
interface MyInterface {
    someString: string;
    someNumber: number;
}
declare const mi: MyInterface;
getString(mi, "someString"); // OK
getString(mi, "someNumber"); // Error
```

We could add a new type operator or intrinsic alias `KeysOfType<T, P>` that returns all `keyof T` `K` such that `T[K] extends P`. When this type indexes a generic object of type `T`, we can then know that `T[KeysOfType<T, P>]` is assignable to `P`. In non-generic positions, this can be immediately resolved the same way as the userland definition.

```ts
type KeysOfType<O, P> = intrinsic;

// Hypothetical
function getString<O extends object>(obj: O, key: KeysOfType<O, string>): string {
     // OK, O[KeysOfType<O, string>] is known to be assignable to
     // string because O is a subtype of O and string is assignable to string
    return obj[key];
}

// getString works the same from the outside as the userland version
```

## 📃 Motivating Example

See `getString` above

## 💻 Use Cases

This is a frequent complaint; need link more inbound issues here

#48989
Repository: pytorch
Issue: Display EC2 information
Labels: module: ci,triaged

Please see parent issue for further instructions #71563 

cc @seemethere @malfet @pytorch/pytorch-dev-infra
Repository: go
Issue: os: RemoveAll susceptible to symlink race
Labels: NeedsFix

Both the `at` (systems that implement `openat`, `unlinkat` etc) and the `noat` implementations of `os.RemoveAll` are susceptible to a TOCTOU symlink race, where a directory can be replaced with a symlink between being stat'd and open'd. This can be used to 'trick' the program into deleting things it does not expect to delete. This is a minor security issue, but has relatively limited impact because it requires a multi-user system where an attacker is able to create symlinks, a program which will call `os.RemoveAll` on an attacker writable tree.

This is due to `O_NOFOLLOW` not being passed to `openat`/`open` on Unix systems, and `FILE_FLAG_OPEN_REPARSE_POINT` not being passed to `CreateFileW` on Windows. On Unix systems the fix is extremely simple, but on Windows it requires some changes to the Windows syscalls, since the flags passed to `CreateFileW` are fixed and cannot be altered by the caller currently.
Repository: terminal
Issue: Clicking on empty space on tab bar activates window, but does not activate current terminal
Labels: Help Wanted,Issue-Bug,Area-UserInterface,Product-Terminal,Priority-3

### Windows Terminal version

1.12.10982.0

### Windows build number

10.0.19044.1645

### Other Software

_No response_

### Steps to reproduce

1. Open terminal.
2. activate some other window
3. click in terminal window at the empty space on tab bar
4. type with keyboard

### Expected Behavior

Typed characters show up in currently active terminal on terminal window.

### Actual Behavior

Nothing happens. Characters to not appear on active terminal.
Repository: youtube-dl
Issue: Thumbnail-embedding for .opus files ("Only mp3 and m4a/mp4 are supported for thumbnail embedding for now")
Labels: request

<!--

######################################################################
  WARNING!
  IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE
######################################################################

-->


## Checklist

<!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2021.12.17. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
- Search the bugtracker for similar feature requests: http://yt-dl.org/search-issues. DO NOT post duplicates.
- Finally, put x into all relevant boxes (like this [x])
-->

- [x] I'm reporting a feature request
- [x] I've verified that I'm running youtube-dl version **2021.12.17**
- [x] I've searched the bugtracker for similar feature requests including closed ones


## Description

<!--
Provide an explanation of your issue in an arbitrary form. Please make sure the description is worded well enough to be understood, see https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient. Provide any additional information, suggested solution and as much context and examples as possible.
-->

When I download some audio with (and this command should be in the readme imo):
```
firejail youtube-dl --extract-audio --embed-thumbnail --audio-format best -i -o '/path/%(title)s.%(ext)s' https://www.youtube.com/watch?v=GhJNXlMsPG4
```
I get `ERROR: Only mp3 and m4a/mp4 are supported for thumbnail embedding for now.`.
I used to get `ERROR: AtomicParsley was not found. Please install`, instead of that error, I'm now getting the above - this could also be due to the filetype which here is .opus. I have atomicparsley v0.9.6-2 installed from the Debian repos (maybe I needed to add some path so that it works).
These issues may be related: https://github.com/ytdl-org/youtube-dl/issues/5840 https://github.com/ytdl-org/youtube-dl/issues/6046
Repository: kubernetes
Issue: When restartPolicy=OnFailure the calculation for number of retries is not accurate
Labels: kind/bug,area/batch,sig/apps,lifecycle/frozen,needs-triage

### What happened?

Currently, the number of retries is calculated in two ways:
1. The number of Pods with `.status.phase = "Failed"`.
2. When using `restartPolicy = "OnFailure"`, the number of retries in all the  containers of Pods with `.status.phase` equal to `Pending` or `Running`.

Only the first number is reflected in the API. However, when either of the two numbers reaches the backoffLimit, the job is considered failed.

This behavior is very unpredictable.

### What did you expect to happen?

`.status.failed` to include the number of retries for all containers, even if they finished successfully or where removed.

### How can we reproduce it (as minimally and precisely as possible)?

Create a failing Job with `restartPolicy = "OnFailure"` and delete the Pod before the backoffLimit is reached.

### Anything else we need to know?

When using JobTrackingWithFinalizers, we could increase the `.status.failed` counter by the number of container retries.

We could do it by inserting a counter (number of container retries) alongside the UIDs in `.status.uncountedTerminatedPods.Failed`, perhaps separated by a comma. This would require 2 releases. In the first release, we need to relax the API validation and make the controller aware of the counter, but not write the counter.

### Kubernetes version

master

### Cloud provider

any

### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```

</details>


### Install tools

<details>

</details>


### Container runtime (CRI) and version (if applicable)

<details>

</details>


### Related plugins (CNI, CSI, ...) and versions (if applicable)

<details>

</details>
Repository: PowerToys
Issue: FancyZones app-running-as-administrator prompt doesn't honor the don't show again option
Labels: Issue-Bug,Product-FancyZones,Priority-1,Status-Reproducible

### Microsoft PowerToys version

0.58.0

### Running as admin

- [ ] Yes

### Area(s) with issue?

FancyZones

### Steps to reproduce

Launch Terminal as admin, click through UAC, observe the notification that FancyZones doesn't work with elevated windows. Click the button to not show again. Take a new flight of Windows (reboot, restart, etc.), relaunch Terminal as admin and observe the notification again, and that the ignore isn't honored.

Unclear if the trigger is the new flight or just a new logon session or if it's because this is happening over RDP.

### ✔️ Expected Behavior

The notification doesn't pop up.

### ❌ Actual Behavior

The notification continues to pop up.

### Other Software

_No response_
Repository: godot
Issue: [Mono] Cant Inherit custom class via "Create Script" window
Labels: bug,topic:editor,topic:dotnet

### Godot version

v4.0.alpha.mono.custom_build [1b2992799]

### System information

linux manjaro KDE

### Issue description

I tried inheriting existing custom class from "Create Script" Dialog but it doesnt work

![image](https://user-images.githubusercontent.com/58845030/167196497-75e05744-2b5e-4aa9-bc76-44ed48c22872.png)


### Steps to reproduce

* Create custom script: `Test.cs`
* Create a new script via "Create Script"
* in the inherits option place `Test`
* Should work, but doesnt

### Minimal reproduction project

N/a
Repository: neovim
Issue: tests/busted: `LuaJIT ASSERT lj_api.c:836: lua_rawgeti: stack slot 2 is not a table`
Labels: status:blocked-external,test,dependencies

### Neovim version (nvim -v)

Latest as of right now, cb3211516298c8b01ffb432b7a7f33acdc01b34b

### Vim (not Nvim) behaves the same?

N/A

### Operating system/version

macOS 12

### Terminal name/version

iTerm2

### $TERM environment variable

xterm-256color

### Installation

From source

### How to reproduce the issue

Clean clone of the repo, run `TEST_FILTER=whatever make test`.

### Expected behavior

Clean run of the tests.

### Actual behavior

```
[----------] Global test environment teardown.
[==========] 12 tests from 365 test files ran. (2239.55 ms total)
[  PASSED  ] 12 tests.
-- Tests exited non-zero: Subprocess aborted
-- Output to stderr:
LuaJIT ASSERT lj_api.c:836: lua_rawgeti: stack slot 2 is not a table

CMake Error at /Users/mishchea/tmp/neovim/cmake/RunTests.cmake:98 (message):
  functional tests failed with error: Subprocess aborted


FAILED: CMakeFiles/functionaltest /Users/mishchea/tmp/neovim/build/CMakeFiles/functionaltest
cd /Users/mishchea/tmp/neovim/build && /opt/homebrew/Cellar/cmake/3.23.1/bin/cmake -DBUSTED_PRG=/Users/mishchea/tmp/neovim/.deps/usr/bin/busted -DLUA_PRG=/Users/mishchea/tmp/neovim/.deps/usr/bin/luajit -DNVIM_PRG=/Users/mishchea/tmp/neovim/build/bin/nvim -DWORKING_DIR=/Users/mishchea/tmp/neovim -DBUSTED_OUTPUT_TYPE=nvim -DTEST_DIR=/Users/mishchea/tmp/neovim/test -DBUILD_DIR=/Users/mishchea/tmp/neovim/build -DTEST_TYPE=functional -P /Users/mishchea/tmp/neovim/cmake/RunTests.cmake
ninja: build stopped: subcommand failed.
make: *** [functionaltest] Error 1
~/repos/neovim $ 
```
Repository: flutter
Issue: Define time period of support for IDE tools to support older versions of flutter
Labels: P2,team-release

This topic came up because we'd like to retire some complex code in the IntelliJ plugin that makes the plugin compatible to very old versions of flutter tools. We'd like to have a specified period of support that we promise users, and then encourage people to update to newer versions.

Some questions mentioned by @nuritzi :
- Timeline: We don't have a particular due date in mind. We need some guidance on this before we start retiring old code.
- What's needed: A defined length of time of support, or some other metric like usage percentage at which we stop supporting old versions of flutter. For example, currently about 0.8% of flutter tools usages are from pre-2.0 versions of flutter, but we still have checks in our plugin code to support these versions.
- Main stakeholders: The IntelliJ plugin and the VSCode plugin would be affected. Internal users would not be affected.

cc @itsjustkevin @timsneath @DanTup @jwren @jacob314
Repository: vscode
Issue: Support macOS Configuration Profiles as a policy backend
Labels: feature-request,macos,config

- [ ] Generate .plist files from our configuration registrations
- [ ] Implement a Configuration Profiles policy source
Repository: godot
Issue: Gridmaps do not render when using Rooms and Portals System
Labels: discussion,topic:rendering,documentation,topic:3d

### Godot version

3.4.2 stable official (45eaa2daf)

### System information

Windows 10, GLES 3, Nvidia Geforce 1660 Ti (30.0.14.7168)

### Issue description

- Gridmaps aren't rendered when placed inside of a Room node after calling the RoomManager's room_convert() function, because they do not inherit from CullingInstance. They remain thus invisible.

### Steps to reproduce

- Download and launch the project below.
- Launch the World scene and notice that the white surface (gridmap) doesn't render.

### Minimal reproduction project

[Gridmap Culling.zip](https://github.com/godotengine/godot/files/8643178/Gridmap.Culling.zip)
Repository: godot
Issue: [Mono] Inherited classes doesnt show exported variables from super
Labels: bug,topic:dotnet

### Godot version

v4.0.alpha.mono.custom_build [1b2992799]

### System information

linux manjaro KDE

### Issue description

I have a class named: `KartController.cs`

I made two descendants: `HumanController.cs` and `MachineController` which extends from `KartController`
but the exported variables from `KartController` doesnt show in editor for the two descendants:

![image](https://user-images.githubusercontent.com/58845030/167205671-4564ff65-b1d8-448a-bbd7-7ea14b99310c.png)


### Steps to reproduce

* Create class A
* create a exported variable
* Create class B and C
* Make B and C extends A
* in-editor you should see exported vars from A on B and C, but this doesnt happen!

### Minimal reproduction project

N/a
Repository: godot
Issue: Wrong collision response of test_move() when the CharacterBody2D is inside a One Way Collision
Labels: bug,topic:physics

### Godot version

4.0.alpha7

### System information

Ubuntu 20.04.3 LTS

### Issue description

Expected behavior: Collision detection with one-way CollisionShapes using test_move() only happens when the body is moving **against** the CollisionShape

What happens: test_move() detects one-way collisions even when moving along a vector with no y-component. The CharacterBody2D itself doesn't seem to detect a collision.

For example, if the one-way collision margin is the default of 1 and the safe margin of the CharacterBody is 0.01, the vertical space where this misfired collision can occur seems to be ~0.43px. This gets wider with bigger collision margins of the one-way collisions or with smaller safe margins used in test_move().

### Steps to reproduce

1. Create a CharacterBody2D and a StaticBody2D with one-way collision.
2. Give the CharacterBody2D a script and run test_move() on the CharacterBody2D with its global_transform, a horizontal distance vector, and a small safe margin. The smaller it is, the easier to get a misfired collision.
3. Place the CharacterBody2D inside the very top of the StaticBody2D, while still being inside it. The one-way collision margin of the StaticBody2D can be increased, or the safe margin inside test_move reduced, to see the effect more clearly.

With the minimal reproduction project, just run it, read the script comments, and notice how for some time, the output logs print "true".

### Minimal reproduction project

[test_move bug.zip](https://github.com/godotengine/godot/files/9966695/test_move.bug.zip)
Repository: vscode
Issue: Opening CPUProfile from SCM fails
Labels: bug,scm

Issue Type: <b>Bug</b>

Opening a cpuprofile file from SCM shows a "Unexpected end of JSON input"

<img width="500" alt="image" src="https://user-images.githubusercontent.com/8599/167208478-b32112b1-f072-4739-a785-ec4b4e00d4a5.png">

_Left side, the file opened via "Open File", right side opened from SCM._

VS Code version: Code - Insiders 1.67.0-insider (57fd6d0195bb9b9d1b49f6da5db789060795de47, 2022-05-04T12:09:01.690Z)
OS version: Darwin x64 21.4.0
Restricted Mode: No


<!-- generated by issue reporter -->
Repository: rust
Issue: empty expansion of a macro pattern does not cause the comma-separated repetition expander to omit the comma
Labels: A-macros,T-compiler,C-bug

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->

I tried this code:

```rust
macro_rules! make_accessors {
(
        struct $struct_name:ident {
                $(
                        $(#[$field_meta:meta])*
                        $field_vis:vis $field_name:ident : $field_ty:ty
                        $(: get $getter_ty:ty)?,
                )* $(,)?
        }
) => {
        struct $struct_name {
                $(
                        $(#[$field_meta])*
                        $(
                                $field_name : $getter_ty
                        )?
                ),*
        }
}}

make_accessors! {
        struct A {
                a: u32 : get u32,
                b: u32,
                c: u32 : get u32,
        }
}

fn main() {
}
```

I expected to see this happen:

Since the expansion of the `$(...)?` and `$field_meta` is the empty expansion, I would have expected the `$(...),*` not to add a comma.

Instead, this happened:

It added a comma after the empty expansion.

After that, the Rust compiler failed with the following error message:

```
error: expected identifier, found `,`
  --> src/main.rs:18:4
   |
18 |         ),*
   |          ^
   |          |
   |          expected identifier
   |          help: remove this comma
```

Even `cargo expand` failed:

```
cargo expand
    Checking zzmac1 v0.1.0 (/home/dannym/backup/zzmac1)
error: expected identifier, found `,`
  --> src/main.rs:18:4
   |
18 |         ),*
   |          ^
   |          |
   |          expected identifier
   |          help: remove this comma

#![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2021::*;
#[macro_use]
extern crate std;
struct A {
    a: u32,
}
fn main() {
}
```

Tested in rustc 1.62.0-nightly (055bf4ccd 2022-04-25) and in rustc 1.57.0.
Repository: TypeScript
Issue: Distributed keyof over union leads to erroneous indexed access
Labels: Bug,Help Wanted

# Bug Report

### 🕗 Version & Regression Information

This is the behavior in every version I tried


### ⏯ Playground Link

[Playground link with relevant code](https://www.typescriptlang.org/play?jsx=0&ts=4.7.0-dev.20220506#code/C4TwDgpgBA0hIHkBmAeAKgPigXimqEAHsBAHYAmAzlAK6kDWpA9gO6lQD8U98TSeUAFxRSEAG4QATgChpoSFADqkpqQDm6LLgDeUANowoAS3ZxEqTAF1haA5agBfWfOglKwXMtUbdYFWAAGYXdJEzVHKAAfKF9-AEZhUhoAWwAjKQBuKD8mMAAmYVSmJgAbCABDdgcomOz-AGZg4FD1PXsHDGkAei6oPr6APQ4gA)

### 💻 Code

<!-- Please post the relevant code sample here as well-->
```ts
type KeyOf<T> = T extends unknown ? keyof T : never

type Wrong<T> = { [K in KeyOf<T>]: T[K] }
```

### 🙁 Actual behavior

It is accepted by the type checker, but it shouldn't be allowed because `T` could be a union of objects with unrelated properties. The computed type doesn't even have any sense:

```ts
type test= Wrong<{ prop0: string } | { prop1: number; prop2: boolean } | { prop3: string[] }>
//   { prop0: unknown; prop1: unknown; prop2: unknown; prop3: unknown; }
```

### 🙂 Expected behavior

`K` shouldn't be allowed to index type `T`.
Repository: flutter
Issue: [integration_test] Missing documentation on how to compare taken screenshots (like in golden tests)
Labels: framework,d: examples,f: integration_test,P2,team-framework,triaged-framework

## Description
My goal is to write integration tests where I take a screenshot and compare this with a master screenshot, like you do in golden tests. So looked into the [documentation](https://github.com/flutter/flutter/tree/master/packages/integration_test) on how do this. But I only found information about how to take a screenshot. How can I compare this taken screenshot now the with the master screenshot?

I searched a lot, but couldn’t any information. Until I found the PR for Android integration tests (https://github.com/flutter/flutter/pull/84472), where is some documentation about how to compare the screenshots:
```dart
final bytes = binding.takeScreenshot('myApp');
await expectLater(bytes, matchesGoldenFile('screenshot.png'));
```

I also found that you need to use `flutter test integartion_test` instead of `flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart`. Otherwise, your tests will pass and you will see in the console: "Golden file comparison requested for "screenshot-1.png"; skipping..." (https://github.com/flutter/flutter/blob/3752fb7bd15e72215cb9dc40086816e6ff7d5e7d/packages/flutter_test/lib/src/goldens.dart#L279)

For me is also an open question, where should I locate the master screenshot? I'm always getting this error `Which: Could not be compared against non-existent file: "goldens/screenshot-1.png"`) - I tried in `integration_test/`, `test/` and `Users`.
Repository: godot
Issue: Moving Area2D over Tilemap: body_entered occasionally skips cells
Labels: bug,topic:physics

### Godot version

3.4.4

### System information

Arch Linux

### Issue description

I’m currently working on a “fog of war” implementation where black cells of a Tilemap that are touched by an Area2D (which moves with the player) are cleared. However, when the Area2D moves over the tilemap and triggers the body_entered signal, it occasionally (with a certain predictability) skips cells, as illustrated here:
![Peek 2022-05-06 22-28](https://user-images.githubusercontent.com/5293125/167213494-87582735-3917-49c2-be02-06d0ecfbe646.gif)

I’m using the following code for the body_entered receiver:
```
func _on_SightSensor_body_entered(body_rid, _body, body_shape, _local_shape) -> void:
	var coordinate: Vector2 = Physics2DServer.body_get_shape_metadata(body_rid, body_shape)
	_body.set_cellv(coordinate, -1)
```

### Steps to reproduce

Move Area2D over Tilemap and monitor the entering cells via body_get_shape_metadata.

### Minimal reproduction project

[Godot-Bughunt.zip](https://github.com/godotengine/godot/files/8643561/Godot-Bughunt.zip)