sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: TypeScript
Issue: Intersection type with discriminated union type that includes all possible enum values cannot accept enum type
Labels: Bug,Help Wanted

In TypeScript you can create a union type discriminated by an `enum`. If the union includes all possible `enum` values, you can create it with a value that is typed to the `enum` (not one of its values).

Given my example below, this is valid: `const p: Payload = { type, value }`

When you create a new type by intersecting the discriminated union type with another type definition, for example to add another field, this no longer works. It is now no longer possible to assign a value that is typed to the `enum` to the new type.

So this is invalid: `const p: { id: string } & Payload = { id, type, value }`

The workaround I can think of is the following, but it's pretty tedious:

```typescript
type Identify<P> = P extends { type: infer T; value: infer V }
  ? { id: string; type: T; value: V }
  : never;

type IdentifiedPayload = Identify<Payload>;
```

**TypeScript Version:**  3.6.3

**Search Terms:** intersection discriminated union enum

**Code**

```ts
enum Type {
  Join = "join",
  Leave = "leave",
  Message = "message",
  Welcome = "welcome"
}

type Payload =
  | { type: Type.Join; value: { nickname: string } }
  | { type: Type.Leave; value: {} }
  | { type: Type.Message; value: { message: string } }
  | {
      type: Type.Welcome;
      value: { others: { id: string; nickname: string }[] };
    };

type IdentifiedPayload = { id: string } & Payload;

function parse(data: string): IdentifiedPayload {
  const [id, type, json] = data.split(" ", 3);
  if (typeof json !== "string") throw Error("received invalid data");
  if (!isType(type)) throw Error("invalid type " + type);
  const value = JSON.parse(json);
  // This line errors:
  return { id, type, value };
  // Note that TypeScript considers this valid:
  // const p: Payload = { type, value };
}

function isType(type: string): type is Type {
  return Object.values(Type).includes(type);
}
```

**Expected behavior:** Works

**Actual behavior:** `Type '{ id: string; type: Type; value: any; }' is not assignable to type 'IdentifiedPayload'.`

**Playground Link:** https://www.typescriptlang.org/play/index.html#code/KYOwrgtgBAKgngB2FA3gKClAUgewJYhQC8UARAFb4ikA0GUAMsAIYBuyJpANi+7fQFlgAZ2HMA5hzIQRYyf0wB1YFwDGOGcTIB3Fepmk0AXzRoALomQAFZnC45mAE2L0APqigWkALliWAdLgEANxQrMxcYMC+KFAgeKoA1iDMMr7CZgBOBOJQRnluHl7Rfkj+TGzAoeGRJSj5JpjuscW+8GVCohJVYRFRMVAyXZLpWTl5BU2o9JiYraXA-spqGlUzszX9HjhmABbAmcIDeI6j2SDiofFJKWlQGee5RgDaALp5wetGn+aWUACSjlAZjwADM8MBHDY7A5nCRYiczuN8gAyKDQ+xOH6gsAgVQgnCEBDMQ7AAAUjmYZmYSIuAEpfIDgWCIVDbJjnOhMOoQBkoM8TjRPJYheRhIT3iRKdT-MIEFw8GYyaQyEKAMx0z6YMFQMnFHCgqBiwlQACERE4DxypDpnl2mRw2igAFFMg7MsrMsBVMA8OxnAQaicoNLmDatVAdWTTXhhO1ycU6ba9g6na73crAxFg8UyFAANTCpCa+g8vmbKRYADKAHkAHL+YmksnGkAlzBesxgTKEBGOIXFIUVj7GUw4vEEwix+N6yy08QMovIWMLaYd4BdntQGsAI3I3rM-grwjJ8bp-gIqkiQJPic+JiAA

**Related Issues:** <!-- Did you find other bugs that looked similar? -->
Repository: terminal
Issue: Wrong colors using emacs-nox in WT-Ubuntu
Labels: Area-VT,Issue-Bug,Needs-Attention,Product-Terminal

By default I use MSYS2 MinTTY and by means of `wslbridge` I use also this MinTTY for WSL Ubuntu. With both these apps I use a color scheme which I added to the `profile.json`:

```
{
            "name" : "base16-default-mod-lighten",
            "foreground" : "#D0D0D0",
            "background" : "#151515",
            "black" : "#151515",
            "red" : "#AC4142",
            "green" : "#90A959",
            "yellow" : "#F4BF75",
            "blue" : "#6A9FB5",
            "purple" : "#AA759F",
            "cyan" : "#75B5AA",
            "white" : "#D0D0D0",
            "brightBlack" : "#505050",
            "brightRed" : "#C25E5E",
            "brightGreen" : "#A6BB7B",
            "brightYellow" : "#F8D5A5",
            "brightBlue" : "#8CB5C6",
            "brightPurple" : "#BE95B5",
            "brightCyan" : "#97C7BE",
            "brightWhite" : "#F5F5F5"
        }
```

In the same `profile.json` I added the profiles for MSYS2 bash. I use the same above color scheme for MSYS2 bash and Ubuntu in WT.

In this attachment 
[emacs-nox-sshots.tar.gz](https://github.com/microsoft/terminal/files/3665611/emacs-nox-sshots.tar.gz)
there are a few screenshots of emacs-nox running on various systems. As you can see I have the same good result in MinTTY (emacs-nox-mintty.png), Ubuntu in MinTTY (emacs-nox-mintty-Ubuntu.png) and in MSYS2 bash in WT (emacs-nox-WT-msys2.png). Instead in WT Ubuntu I get what I call _bad_ result (emacs-nox-WT-Ubuntu.png).
Repository: PowerToys
Issue: Add option to remove windows task-bar
Labels: Idea-New PowerToy,Product-Tweak UI Design

# Summary of the new feature/enhancement
I believe windows 10 does not have a way to completely remove the task-bar or only make it show when you explicitly ask it to.

* Hovering your mouse over it should not open the task-bar anymore
* Removing the small line that is drawn when the task-bar is closed would also be nice

# Proposed technical implementation details (optional)
Add an option that would remove the task-bar, clicking the start button should open the task bar with the start menu open. A separate key-bind that only opens the task-bar might be useful.
Repository: pytorch
Issue: Cmake warnings during build
Labels: triaged,module: build warnings

I'm receiving a lot of warnings like this. Is it okay? (I do have cuda installed and discoverable fine)

```
CMake Warning at modules/module_test/CMakeLists.txt:10 (add_library):
  Cannot generate a safe runtime search path for target
  caffe2_module_test_dynamic because there is a cycle in the constraint
  graph:

    dir 0 is [/miniconda/lib]
      dir 2 must precede it due to runtime library [libcudart.so.10.0]
    dir 1 is [/deepspeech.pytorch/pytorch/build/lib]
    dir 2 is [/usr/local/cuda/lib64]
      dir 0 must precede it due to runtime library [libnvToolsExt.so.1]

  Some of these libraries may not be found correctly.
```
Repository: angular
Issue: Support finishCallback and rootZoneStable in async test
Labels: feature,area: zones,feature: insufficient votes,feature: votes required

<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅

Oh hi there! 😄 

To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.

🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->


# 🚀 feature request

### Relevant Package
<!-- Can you pin-point one or more @angular/* packages the are relevant for this feature request? -->
<!-- ✍️edit: --> This feature request is for zone.js


### Description
<!-- ✍️--> A clear and concise description of the problem or missing capability...
the cases is from `angular components`, the following test are from @mmalerba.

```
fdescribe('repro', () => {
  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [OutsideNgZoneTest]
    }).compileComponents();
  });

  # Passes
  it('done should not wait for task outside of zone', done => {
    const fixture = TestBed.createComponent(OutsideNgZoneTest);
    const el = fixture.debugElement.nativeElement;
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      expect(el.classList.contains('timeout-done')).toBe(false);
      done();
    });
  });

  # Passes
  it('fakeAsync should wait for task outside of zone', fakeAsync(() => {
    const fixture = TestBed.createComponent(OutsideNgZoneTest);
    const el = fixture.debugElement.nativeElement;
    fixture.detectChanges();
    flush();
    expect(el.classList.contains('timeout-done')).toBe(true);
  }));

  # Fails
  it('async should wait for task outside of zone', async(() => {
    const fixture = TestBed.createComponent(OutsideNgZoneTest);
    const el = fixture.debugElement.nativeElement;
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      expect(el.classList.contains('timeout-done')).toBe(true);
    });
  }));
});

@Component({template: ''})
export class OutsideNgZoneTest {
  constructor(el: ElementRef, ngZone: NgZone) {
    ngZone.runOutsideAngular(() =>
        setTimeout(() => el.nativeElement.classList.add('timeout-done')));
  }
}
```

For the `1st and 3rd` cases, we want some mechanism to let user to easily test the async cases.
### Describe the solution you'd like
<!-- ✍️--> If you have a solution in mind, please describe it.
- For the `1st case` we may need some thing like
`rootZoneWhenStable().then()` or `asyncStable().then()` to monitor not only `ngZone` but also the `async tasks` outside of `ngZone`.

- For the `3rd case`, we need to add an option to `async` zone spec, to let user monitor when all async are done. 

### Describe alternatives you've considered
<!-- ✍️--> Have you considered any alternative solutions or workarounds?
No very easy workarounds for now.
Repository: neovim
Issue: hook/event for normal, Ex commands
Labels: enhancement,core,events

### Steps to reproduce using `nvim -u NORC`

Any `formatprg` or `equalprg` with an argument that gives an error in shellcode. Ex. use prettier in a one-line javascript object parameter.


### Actual behaviour

`formatprg` and `equalprg` replace stdin with stderr on shell error

### Expected behaviour

Some sort of error handling like doing nothins, dumping stderr in a quickfix, or even better stderr in a floating window.

### Reference

https://github.com/prettier/prettier/issues/743
https://stackoverflow.com/questions/13658696/vim-how-to-redirect-formatprg-errors-to-echoerr
https://stackoverflow.com/questions/9466795/vim-using-an-external-command-and-handling-errors
https://groups.google.com/forum/#!topic/vim_dev/SGcwy7GViNs
Repository: pytorch
Issue: Is it an incompleted dst tensor synchronization in CUDA device to device copy ?
Labels: module: cuda,triaged

## 🐛 Bug

When we perform a CUDA copy from device to device, I find PyTorch only block current stream on dst device before copy execution. Why don't we wait for all streams on dst device to ensure no one touches the dst tensor? The dst tensor might be written or read on other streams not current stream on dst device, when copy execution?

## To Reproduce

Here is a pseudo in my mind.

`auto src_device = src_tensor.device();`
`auto dst_device = dst_tensor.device();`

`// initialize two streams for dst_device`
`// stm1: the current stream when performing the copy.`
`// stm2: perform a workload which touches dst_tensor's memory.`
`CUDAGuard device_guard(dst_device); {`
`    at::cuda::CUDAStream s0 = at::cuda::getStreamFromPool();`
`    at::cuda::CUDAStream s1 = at::cuda::getStreamFromPool();`

`    setCurrentCUDAStream(s1);`
`    // submit a asynchronized kernel on s1 and the kernel will touch dst_tensor.`
`    workload_on_s1(dst_tensor.device(), s1);`

`    // current stream on dst_device is s0.`
`    setCurrentCUDAStream(s0);`

`    // perform copy`
`    // 1. record event of dst_device current stream, s0 in the case.`
`    CUDAEvent dst_ready;`
`    device_guard.set_device(dst_device);`
`    dst_ready.record(getCurrentCUDAStream(dst_device.index()));`

`    // *******`
`    // s0 is completed, but s1 might be still WIP on dst_device.`
`    // *******`

`    // 2. current stream of src_device block for the event.`
`    device_guard.set_device(src_device);`
`    dst_ready.block(getCurrentCUDAStream(src_device.index()));`

`    // 3. copy ...`
`    // 4. block src_stream/copy_stream to complete copy`
`}`

The exception could be implemented by Python user interface either.

Thanks.
Repository: terminal
Issue: Eventually register a terminfo with ncurses upstream
Labels: Issue-Docs,Area-VT,Product-Meta

Thomas Dickey, the maintainer of the ncurses project, also maintains the terminfo-db distributed with most Linux distributions. At the moment, the main TERM environment variable is `xterm-256color`, but not all xterm features are supported or even planned.  When 1.0 releases, it would be good to leave xterm-256color as the default TERM environment, but also to maintain a separate terminfo with the ncurses project upstream.  This means that as the changes in ncurses propagate down to the distros, the team can make a switchover and report the TERM as `ms-terminal`.  

This will give the team the freedom in the long-term to add new features not implemented in xterm (for example, to support 32-bit color (i.e. an alpha channel)) or any other cool features they might dream up.  Some projects like `libvte` and `kitty` have or previously had a bad relationship with the ncurses maintainer because they refused to submit their own accurate TERMINFO to the database.
Repository: rust
Issue: Tracking issue for `report-time`
Labels: T-libs-api,B-unstable,A-libtest,C-tracking-issue,Libs-Tracked

Tracks stabilization for the `report-time` and `ensure-test-time` `libtest` options.
Repository: pytorch
Issue: Tensorboard logging image WITH LABEL
Labels: triaged,module: tensorboard

## 🚀 Feature

We need a function that
- When log image to tensorboard, put text/label beside/over the image.
- When saving image, put text/label beside/over the image.

## Motivation

Now, we can use tensorboard to log images in PyTorch. However, there are just images when we logging images. It's better for visual debugging that we can know the label/prediction directly with the images. For example, just put the label over the image.
In TensorFlow, there is a function `tf_put_text` to do this thing, as described [HERE](https://stackoverflow.com/questions/36015170/how-can-i-add-labels-to-tensorboard-images). Can you copy it to PyTorch? I think it is a really useful tool.

## Pitch

For example:

```
|--------------------|
| Class:42           |
|                    |
|    The image       |
|                    |
|                    |
|--------------------|
```

AND

```
|--------------------|
|                    |
|                    |
|    The image       |
|                    |
|                    |
|--------------------|
     Class: 42
```

## Alternatives

Refer: `tf_put_text` function in TensorFlow

## Additional context

- https://discuss.pytorch.org/t/add-a-title-or-text-to-torch-make-grid/13501
Repository: PowerToys
Issue: Quick action buttons with on/off status
Labels: Idea-New PowerToy

# Summary of the new feature/enhancement
i regularly need to perform certain windows actions like : 
- change network parameters to a certain setting (when i swap from using my computer from personal to professional use for example)
- turn on/off the power save detection (when i launch a long task and i dont what it to be interrupted)
- change multi screen parameter (from clone to extension for exemple)

And that is only a sample of the actions... 

For each of theses actions, i need to go through a serie of windows configuration menus every time... back and forth... 

I'd really like to have shortcuts to configuration actions. in the form of  simple buttons with a simple on/off status accessed in one click (or double click) from a shortcut on the desktop of from the taskbar. 

Thanks!

# Proposed technical implementation details (optional)

<!-- 
A clear and concise description of what you want to happen.
-->
Repository: terminal
Issue: Profiles Schema: Invalid command chords validate
Labels: Help Wanted,Issue-Docs,Area-Settings,Product-Terminal

First of all, I'm very happy to see that parts of the schema that I suggested in #1003 made it into a release, but in the review process I think that an important feature of the (allegedly, very long) regular expression to validate the `keys` strings was lost: It will now incorrectly validates key chords that won't parse properly. This is because the strings recognized in [KeyChordSerialization.cpp](https://github.com/microsoft/terminal/blob/master/src/cascadia/TerminalApp/KeyChordSerialization.cpp) are not spelled out explicitly.

May I suggest that the expression is changed to (the `<key>` group is new, and the last `+` in `<modifier>` is required):
```regexp
^(?<modifier>(ctrl|alt|shift)(?:\+(ctrl|alt|shift)(?<!\2))?(?:\+(ctrl|alt|shift)(?<!\2|\3))?\+)?(?<key>[^\s+]|backspace|tab|enter|esc|space|pgup|pgdn|end|home|left|up|right|down|insert|delete|numpad_(?:[0-9]|multiply|plus|minus|period|divide)|f[1-9]|f1[0-9]|f2[0-4]|plus)$
```
Note that the problem with my original expression is fixed - it now allows single ` |}` etc. keys, as it should. However, it will *not* validate `ctrl++` or `ctrlplus`, which should be `ctrl+plus` instead. Also, modifiers without keys will not validate (e.g. `ctrl`).

Another improvement would be to list out the allowed words in the description, of course. This is a tricky value to get right without documentation as a crutch, but at least proper validation can help you catch errors early.

Maybe @oising, who improved on the original regexp, would like to comment?

Edit: [Link to example at Regex101](https://regex101.com/r/6FEcX6/1)
Repository: flutter
Issue: [WEB] Need more PageTransitionTheme for web transition
Labels: c: new feature,framework,c: proposal,P3,team-framework,triaged-framework

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill our the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Use case

<!--
     Please tell us the problem you are running into that led to you wanting
     a new feature.

     Is your feature request related to a problem? Please give a clear and
     concise description of what the problem is.

     Describe alternative solutions you've considered. Is there a package
     on pub.dev/flutter that already solves this?
-->

## Proposal

<!--
     Briefly but precisely describe what you would like Flutter to be able to do.

     Consider attaching images showing what you are imagining.

     Does this have to be provided by Flutter directly, or can it be provided
     by a package on pub.dev/flutter? If so, maybe consider implementing and
     publishing such a package rather than filing a bug.
-->
        pageTransitionsTheme: PageTransitionsTheme(builders: {
          TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
          TargetPlatform.android: OpenUpwardsPageTransitionsBuilder(),
        }),

Web transition doesn't need those of 
-FadeUpwardsPageTransitionsBuilder
-OpenUpwardsPageTransitionsBuilder
-CupertinoPageTransitionsBuilder

I think TranisitionBuilder for web should be supported, 

such as NoAnimationTransitionBuilder..
Repository: TypeScript
Issue: From debian : please support multiple system dir
Labels: Suggestion,Needs Proposal

Under debian and other distrib we want to load systemdir from a search path.

for instance we want first to look up from lib/x86_64-linux-gnu/nodejs then share/nodejs then lib/nodejs'

I tried a local patch but I do not suceed.

Could you help us ?

rouca@debian.org
Repository: terminal
Issue: Feature Request: Customize confirmation prompt before exit.
Labels: Help Wanted,Area-UserInterface,Product-Terminal,Issue-Task

Feature request: A confirmation prompt before terminal app exit.
For example, if there are multiple tabs open, upon initiation of exit a prompt to confirm or cancel exit.

Particularly with the case when multiple tabs open, prompting the user to think before closing multiple tabs may prevent a accidental loss of work/processing in tabs that are not in the foreground.

Perhaps make the prompt configurable in settings with the options:

- disabled (no prompt before exit)
- multiple (prompt if multiple tabs open)
- always (prompt always before exit - for a check before closing even a single open tab)

* [ ] #6641 add a "remember" checkbox
Repository: vscode
Issue: Better Touch using
Labels: feature-request,editor-core

Issue Type: <b>Feature Request</b>

Hello,

I realised it is not easy to select text on a touch screen. This is, because all touch gestures are interpreted as scrolling and not as selecting.

I looked what Notepad++ does. This is very interesting. Notepad++ works differently depending on what direction the touch swiping starts. If it starts vertically (up/down) then ist is scrolling and if it starte horizontally (left/right) it is selecting. - It should be noted, that even if you start moving the finger up or down for scrolling, if the scrolling has started you still can scroll left or right. If you are in selection mode (left/right movement) you can also select up and down. So the application looks how the movement started. This is a really cool and accassible way of using touch in this program.

Visual Studio code should work in a similar way.

(PS: This whole way of using with touch reminds me of the clever way Tiles worked Windows 8. Unfortunately Microsoft forgot about that, when they switched scrolling direction of Tiles in Windows 10.)

VS Code version: Code 1.38.1 (b37e54c98e1a74ba89e03073e5a3761284e3ffb0, 2019-09-11T13:35:15.005Z)
OS version: Windows_NT x64 10.0.18362


<!-- generated by issue reporter -->
Repository: go
Issue: proposal: doc: document api compatibility
Labels: Documentation,Proposal

### Background
Currently there are four official definitions for api compatibility<sup>[0](https://golang.org/doc/go1compat)[1](https://blog.golang.org/publishing-go-modules#TOC_3.)[2](https://go.googlesource.com/exp/+/master/apidiff/README.md)[3](https://golang.org/ref/spec)</sup>, as well as others offered by the community<sup>[4](https://github.com/bradleyfalzon/apicompat)</sup>. It should be noted that some of these definitions target package compatibility, where other target module compatibility, and some are experimental, while others have been constant since go1. Unfortunately, they each disagree on at least a few minor points in their definitions of compatibility. This lack of an official stance and single vision for compatibility has led to confusion and uncertainty among the community.

### Proposal
In some official capacity, publish documentation both package and module compatibility guarantees. This should involve a package level definition, such as the `apidiff` definition<sup>[2](https://go.googlesource.com/exp/+/master/apidiff/README.md)</sup>, and module definition, which can borrow heavily from the former.

### Footnotes
0] https://golang.org/doc/go1compat
1] https://blog.golang.org/publishing-go-modules#TOC_3.
2] https://go.googlesource.com/exp/+/master/apidiff/README.md
3] https://golang.org/ref/spec
4] https://github.com/bradleyfalzon/apicompat