sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: TypeScript
Issue: Readonly properties type narrowing doesn't flow into inner function scopes
Labels: Suggestion,Experience Enhancement,Domain: Control Flow

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section!

Please help us by doing the following steps before logging an issue:
  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues
  * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ

Please fill in the *entire* template below.
-->

<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:**  3.3.0-dev.20190105

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:** Readonly, strictNullChecks, optional, inner function

**Code**

Using `strictNullChecks: true`:

```ts
interface Thing {
    foo?: (a: number) => boolean;
}

const t: Readonly<Thing> = {
    foo: (a) => true,
};

if (t.foo !== undefined) {
    const bar = () => {
        t.foo(5);
    }
}
```

**Expected behavior:**

👍 Compile

**Actual behavior:**

On the expression `t.foo(5);` the following error:

```
Cannot invoke an object which is possibly 'undefined'.
(property) foo?: ((a: number) => boolean) | undefined
```

**Playground Link:** https://www.typescriptlang.org/play/index.html#src=interface%20Thing%20%7B%0D%0A%20%20%20%20foo%3F%3A%20(a%3A%20number)%20%3D%3E%20boolean%3B%0D%0A%7D%0D%0A%0D%0Aconst%20t%3A%20Readonly%3CThing%3E%20%3D%20%7B%0D%0A%20%20%20%20foo%3A%20(a)%20%3D%3E%20true%2C%0D%0A%7D%3B%0D%0A%0D%0Aif%20(t.foo%20!%3D%3D%20undefined)%20%7B%0D%0A%20%20%20%20const%20bar%20%3D%20()%20%3D%3E%20%7B%0D%0A%20%20%20%20%20%20%20%20t.foo(5)%3B%0D%0A%20%20%20%20%7D%0D%0A%7D%0D%0A%0D%0A

**Related Issues:**
* Possibly a duplicate https://github.com/Microsoft/TypeScript/issues/22137, but I wasn't sure.
* Following the theory of this issue, this should be seen as a bug: https://github.com/Microsoft/TypeScript/issues/10927.
Repository: rust
Issue: Suggest code to use enum type in return type when accidentally using variant instance
Labels: C-enhancement,A-diagnostics,T-compiler,A-suggestion-diagnostics,D-invalid-suggestion

When encountering an enum variant instance in a return type, make a better effort to suggest appropriate code.

Right now, if you accidentally write `Some(Span)` when you meant `Option<Span>`, we mention the existence of the enum, but we don't suggest code:

```
error[E0573]: expected type, found variant `Some`
    --> src/librustc_typeck/check/mod.rs:5198:10
     |
5198 |     ) -> Some(Span) {
     |          ^^^^^^^^^^ not a type
     |
     = help: there is an enum variant `rustc::middle::cstore::LibSource::Some`, try using `rustc::middle::cstore::LibSource`?
     = help: there is an enum variant `rustc::session::config::Passes::Some`, try using `rustc::session::config::Passes`?
     = help: there is an enum variant `std::prelude::v1::Option::Some`, try using `std::prelude::v1::Option`?
     = help: there is an enum variant `std::prelude::v1::Some`, try using `std::prelude::v1`?
```

It'd be nice if we could suggest the appropriate code.
Repository: react
Issue: Nested portals should be discoverable
Labels: Type: Feature Request

This is more about a bridge between actual DOM Tree and React Tree.

**Do you want to request a *feature* or report a *bug*?**
feature

**What is the current behavior?**
You can _portal_ a part of your rendering tree to another place in Dom Tree, and React would handle events, including events on Capture Phase like there were no portals - events could dive through all the _react_ parents, and bubble up through all the _react_ parents.

This is quite useful, as long as portal is an implementation detail, but useful only for normal events; there are more cases around it.

**What is the expected behavior?**

It's better to explain it by example
- you have a Modal Dialog and it uses a Focus Lock, ie focus could not leave it.
- inside Modal you have a Custom Select, with Dropdown menu rendered via a portal.
- you could not use it, as long as from DOM prospective `ModalNode.contains(DropDownNode)` is always false, and Focus Lock will prevent focusing.

It's a real issue - https://github.com/reach/reach-ui/issues/83, https://github.com/theKashey/react-focus-lock/issues/19.

Proposed solution:
- `containsNode(domNode):boolean` - _React-aware_ version of DOM API `node.contains(anotherNode)`.
- `getHostNodes():Nodes[]` - returns a list of all root nodes inside "current component" including direct children and portals. Similar to `ReactDom.findDomNode`, and (proposed)refs attached to React.Fragment. It just finds all nodes "you are consists of". As a result you will be able to `tab` from one `piece` of you to another, making focus management independed of implementation details.

Cons:
- requires Component to access fiber, DOM node to access fiber thought node, or an new `hook` to do it in a functional way.
- does twice dreadfull things than deprecated `findDomNode`
- usage scope is very narrow.

Pros:
- _my_ use case requires _momentum_ access to a rendered tree, and does not suffer async stuff as `findDomNode`, where underlaying node might not be yet created. Stuff like "_does something `containsNode` right now_", or _"`getHostNodes` I consist from right now"_ are sync, and the question asked about actual DOM tree structure.

Example using [react-dom-reflection](https://github.com/theKashey/react-dom-reflection), which implements required API - https://codesandbox.io/s/1or60v506l

**Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?**

Never worked
Repository: vscode
Issue: Emmet toggle comment not working correctly for jsx
Labels: bug,emmet,emmet-parse

- VSCode Version: 1.30.1
- OS Version: win10 v1803

This issue occurs for both js & jsx extension files

Steps to Reproduce:
![vscbug](https://user-images.githubusercontent.com/28700378/50750725-41786080-1281-11e9-9efa-93bf8ee1ab4c.gif)


<!-- Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes
Repository: rust
Issue: Lifetime elision applies differently in traits and impls with explicit self type
Labels: A-lifetimes,T-compiler,A-inference,C-bug

A specific  function signature works in trait decl, but not in the impl:

```rust
trait Silly {
    // OK
    fn id(self: &Self) -> &Self;
}

impl<T> Silly for T {
    // error[E0106]: missing lifetime specifier
    fn id(self: &T) -> &T { self}
    //                 ^ help: consider giving it a 'static lifetime: `&'static`
}
```
[playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2e0094386c365b2e0e7d88911432ddf8)
Repository: vscode
Issue: autoclosing markdown preview when closing md file
Labels: feature-request,markdown

Issue Type: <b>Feature Request</b>

When editing markdown file, it is quite convenient to have the preview in a aplit view. However, when I switch to another opened file (or closing the md file), the preview of markdown and the split is still there. This is annoying because I can only use half of the window for the new file. 

VS Code version: Code 1.30.1 (dea8705087adb1b5e5ae1d9123278e178656186a, 2018-12-18T18:05:00.654Z)
OS version: Darwin x64 18.2.0


<!-- generated by issue reporter -->
Repository: nvm
Issue: Using latest node subversion of any version
Labels: installing node

Possible feature request if not already implemented.

If I want to use the latest node 6 version (6.16.0 at the moment), is it possible to install it using nvm install 6.x ? I couldn't find it in the documentation and tried doing:
```
nvm install 6.16.0
nvm use 6.x
```
which throws a 
```
N/A: version "6.x -> N/A" is not yet installed.

You need to run "nvm install 6.x" to install it before using it.
```
Repository: kubernetes
Issue: Support arbitrary subresources for custom resources
Labels: priority/backlog,sig/api-machinery,kind/feature,area/custom-resources,lifecycle/frozen

Currently, custom resources support only `status` and `scale` subresources. The only way to use custom subresources with CRs is to use an aggregated apiserver.

Given that using CRDs is comparatively easier than setting up an aggregated apiserver, there have been requests [[1](https://github.com/kubernetes/enhancements/issues/571#issuecomment-450404761)][[2](https://github.com/kubernetes/apiextensions-apiserver/issues/33)] for supporting arbitrary subresources with CRDs.

I don't think we intended to support this or have this on our roadmap in the near future. But we don't have a formal consensus on this yet. I created this issue to have a discussion and gather consensus.


/sig api-machinery
/area custom-resources
/kind feature
/cc @sttts @liggitt @deads2k @lavalamp @mbohlool
Repository: vscode
Issue: [html] code complete for href anchors
Labels: feature-request,html

<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed: https://code.visualstudio.com/insiders/ -->

<!-- Use Help > Report Issue to prefill these. -->
- VSCode Version: Version: 1.30.1 (user setup)
Commit: dea8705087adb1b5e5ae1d9123278e178656186a
Date: 2018-12-18T18:12:07.165Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
- OS Version: Windows_NT x64 10.0.17134

Steps to Reproduce:

1. Create html file and some elements with their own id like so: `<div id="TEXTHERE">`
2. Create an `<a>` tag with href like this: `<a href="#TEXTHERE>content</a>`
3. You will see no autocompletion for the href. If you reload VSCode fresh the autocompletion works for a few secs (via word autocompletion) but stops to work when VSCode has completed all startup processes.

Use-case: You have a static HTML file with a lot of elements with IDs and want to check while typing in an anchor link if that ID exists.

I tried three different autocompletion plugins, none of them could give me this functionality.

This works flawlessly in Atom, though.

<!-- Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: **Yes**
Repository: flutter
Issue: Consider make flutter/engine truly platform-agnostic/portable
Labels: c: new feature,engine,dependency: dart,e: embedder,P3,team-engine,triaged-engine

Hello folks!

Flutter Engine claims to be truly platform agnostic, self-contained and portable. In reality we are not there yet. There are a bunch of code in the engine repo which is platform-specific like the ones here: https://github.com/flutter/engine/tree/master/fml/platform 

We are porting flutter to a very restrict and secure ARM device. So far we are having success except that flutter on linux is requiring `timerfd_create` syscall in order to create timers but, for security reasons, the device doesn't allow that and that syscall isn't implemented. 

That is a clear case where the engine is embracing platform specific code which should be on the embeder or PAL.

We will make that to work by emulating that syscall all over the place, which is far from desirable. 

It would be good if those platform-specific code got moved elsewhere and that way the engine would became what it is meant to be... A clean and slick engine which when initialised takes as parameter all the required platform-specific implementations. That way we open flutter to even more target platforms.

We are pretty new on flutter and we're learning as we walk every step on the port process. If there is something that achieve what I'm asking already in place, please forgive the noobish and we would appreciate if you can point us to the right direction.

Thanks!
Repository: flutter
Issue: Deep-linking support for Navigator
Labels: c: new feature,framework,d: api docs,f: routes,customer: crowd,P2,team-framework,triaged-framework

Is there a particular way to make Flutter's Navigator have a specific navigation history if you for example want to send in a new navigation history based on an Android notification?

For example, start the `FlutterView` at `[Main, List, Detail[someId]]`?
Repository: rust
Issue: Suggestion for pub(crate) and reexports are tricked
Labels: T-compiler,C-bug,A-suggestion-diagnostics,D-invalid-suggestion,L-unreachable_pub

First [reported upstream](https://github.com/rust-lang/cargo/issues/6465#issuecomment-448836441), this code:

```rust
#![warn(unreachable_pub)]
#![deny(unused_imports)]

pub mod core {
    pub mod compiler {
        mod context {
            mod compilation_files {
                pub struct Metadata;
                pub struct CompilationFiles;
                impl CompilationFiles {
                    pub fn metadata() -> Metadata { Metadata }
                }
            }
            use self::compilation_files::CompilationFiles;
            pub use self::compilation_files::Metadata;  // Suggests pub(crate)
                                // but that causes unused_imports to complain.

            pub struct Context;
            impl Context {
                pub fn files() -> CompilationFiles { CompilationFiles }
            }
        }
        pub use self::context::Context;
    }
}
```

[generates the warning](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=4202a0227a013abc063afcb5d881a3e3)

```
warning: unreachable `pub` item
  --> src/lib.rs:15:13
   |
15 |             pub use self::compilation_files::Metadata;  // Suggests pub(crate)
   |             ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |             |
   |             help: consider restricting its visibility: `pub(crate)`
   |
note: lint level defined here
  --> src/lib.rs:1:9
   |
1  | #![warn(unreachable_pub)]
   |         ^^^^^^^^^^^^^^^
   = help: or consider exporting it for use by other crates

warning: unreachable `pub` item
  --> src/lib.rs:15:21
   |
15 |             pub use self::compilation_files::Metadata;  // Suggests pub(crate)
   |             ---     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |             |
   |             help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates
```

but the suggested fix doesn't compile!
Repository: flutter
Issue: image_picker plugin should allow generation of thumbnail images
Labels: c: new feature,p: image_picker,package,c: proposal,team-ecosystem,P3,triaged-ecosystem

Since the image_picker returns the full resolution images and flutter doesn't automagicly shrink images based on the rendered size, it is easy to trigger OOM/memory pressure when using the returned images. (See https://github.com/flutter/flutter/issues/21571). Regardless of the decisions we make regarding OOM handling for images, it would be nice if the image_picker could also generate much smaller thumbnails to make it easy to avoid loading the full size images.

Example:
```
ImageWithThumbnail imageWithThumbnail = await ImagePicker.pickImageWithThumbnail(source: ImageSource.camera, thumbnailSize: Size(100, 100));

class ImageWithThumbnail {
  File get image
  File get thumbnail
}
Repository: vscode
Issue: Find usages (find all file references / find all folder references)
Labels: feature-request,editor-symbols

If you search the issues here on GitHub and on StackOverflow, you'll find that there is a ton of fragmentation around this feature for a few reasons:

- Everyone is referring to different subsets of the feature
- Everyone is calling it by different names (users coming from WebStorm will refer to it as "Find Usages")
- VSCode actually already has this partially implemented, but it's hidden and not documented well.

This feature refers to three subsets of finding references:

**1. Find all references of a symbol**

VSCode has this already.

**2. Find all references of a file**

VSCode has this already, but few know about it, and the process for getting to it is unnecessary. Currently you need to use the "find all references" command on an import path that includes the file.

This is a very useful feature, and should be made available in the file explorer, for a file's context menu when right clicking it, [as explained here](https://github.com/Microsoft/vscode/issues/66150). Additionally, there should be a command, `References: Find All References of File` as [explained here](https://github.com/Microsoft/vscode/issues/41681).

**3. Find all references of a folder**

VSCode does not yet have this feature. When using this on a folder (made available in the context menu), it should show the references for all files inside that folder. A command might be useful here as well (`References: Find All References of Folder`).

**Note:**

I've already submitted [a feature request](https://github.com/Microsoft/vscode/issues/52845) mentioning this in the past, which was closed and suggested as an extension. However, it looks like I wasn't clear on what my request was, because VSCode has since implemented a lot of this functionality. And it's also clear that there's a lot of confusion around this among VSCode users.
Repository: TypeScript
Issue: Unexpected implicit any for return value of Array<T>.indexOf
Labels: Bug,Domain: Control Flow



<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section!

Please help us by doing the following steps before logging an issue:
  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues
  * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ

Please fill in the *entire* template below.
-->

<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:**  3.3.0-dev.20190105

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:** evolving array type, indexOf

**Code**

```js
const arr = [];

arr.push(1);

while (true) {
    const index = arr.indexOf(1);
    arr[index] = 1;
}
```

**Expected behavior:**

No errors.

**Actual behavior:**

```
'index' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
```

**Playground Link:** [(turn on `noImplicitAny`)](http://www.typescriptlang.org/play/#src=const%20arr%20%3D%20%5B%5D%3B%0A%0Aarr.push(1)%3B%0Aarr%3B%0A%0Awhile%20(true)%20%7B%0A%20%20%20%20const%20index%20%3D%20arr.indexOf(1)%3B%0A%20%20%20%20arr%5Bindex%5D%20%3D%201%3B%0A%7D)

**Related Issues:** #19955

**In the wild:** https://github.com/GoogleChrome/lighthouse/pull/6874#discussion_r244243029. Note @brendankenny's educated guess on [what is going on](https://github.com/GoogleChrome/lighthouse/pull/6874#discussion_r245186223).
Repository: rust
Issue: perform macro-expansion on doctests before checking for `fn main`
Labels: T-rustdoc,C-feature-request,A-doctests

As discussed in https://github.com/rust-lang/rust/pull/57019, i'd like to refactor the doctest parsing/execution code in rustdoc so that it checks for `fn main` and `extern crate` *during* compilation, not before. This allows us to take advantage of macro expansion and a proper parsing step to find multi-line attributes or `extern crate` statements with the `#[macro_use]` on a separate line.

I believe it's possible to break up the compilation steps in `test::run_test` like in `core::run_core`, except this time we'd stop after `phase_2` and inspect the crate for our desired items. If the test doesn't have a `fn main` or the right `extern crate` statement, then we can modify the crate in-place (or attempt to splice in the right text in the original text and run compilation again) before continuing. I haven't tried it, but i'd like to sketch it out soon.
Repository: TypeScript
Issue: Javascript, Nodejs: Go to definition for required file does not work if required file does not contain exports.
Labels: Bug,Domain: TSServer,Domain: Symbol Navigation

a.js
```js
require('./b.js'); // Go to definion does not work here. But 'Find all references' does work.
require('./c.js'); // Go to definion works here.
```

b.js
```js
// no exports or module.exports assigns here, just some side effects.
```

c.js
```
exports.a = 42;
```

VSCode 1.30.1.
Linux 4.18 x64..

> Does this issue occur when all extensions are disabled?: Yes/No

Yes.
Repository: TypeScript
Issue: Show unused public properties and methods
Labels: Suggestion,In Discussion

It would be nice to have unused detection expanded, capable of detecting unused methods, exports, etc.

**Code Example**

_Shape.js_
```javascript
class Shape {
    constructor() {
        this.color = 'red';
    }

    colorLog() {
        console.log(this.color);
    }
}

export default Shape;
```
_Circle.js_
```javascript
import Shape from "./Shape";

class Circle extends Shape {
  constructor() {
    super();

    // FIXME: description should show as unused in VSCode, as it does in WebStorm.
    this.description = 'A circle shape';
  }

  // FIXME: circleLog should show as unused in VSCode, as it does in WebStorm.
  circleLog() {
    // NOTE: both VSCode and WebStorm have detected an unused variable.
    const num = 2;

    // NOTE: colorLog is being used, so no unused code errors in Shape.js file.
    super.colorLog();
  }
}

// FIXME: export should show as unused in VSCode, as it does in WebStorm.
export default Circle;
```

**VSCode Screen**

<img width="1440" alt="screen shot 2019-01-04 at 9 23 48 pm" src="https://user-images.githubusercontent.com/12591890/50719791-161a2980-1067-11e9-8b16-3f4e4fe6b531.png">

**WebStorm Screen**

<img width="1440" alt="screen shot 2019-01-04 at 9 23 07 pm" src="https://user-images.githubusercontent.com/12591890/50719793-1ca8a100-1067-11e9-8c17-071746dd085f.png">
Repository: TypeScript
Issue: Rename file when renaming default export
Labels: Suggestion,Needs Proposal,Domain: Refactorings

Currently we can use the `rename symbol` command and that will rename the symbol and its usages (exports, imports, usages in other files, etc.). That's a great start, but I'd love to see this feature expanded to do the following:

- Many times a file name will coincide with the symbol being refactored. The refactor option should be available when renaming the file, so everything can be done at once.

- In addition to the refactor changing symbol references across all files, it'd be nice to have the ability to also update comments, strings, etc. that refer to that symbol.

**Code Example:**

_Shape.js_
```javascript
class Shape {}
export default Shape;
```

_Circle.js - We reference Shape as an import, extends, inside a comment, and inside a string. They should all be refactored._
```javascript
import Shape from "./Shape";

// Shape subclass
class Circle extends Shape {
  constructor() {
    super();
    console.log('A circle is a Shape.');
  }
}

export default Circle;
```

**WebStorm Examples**

<img width="1440" alt="screen shot 2019-01-04 at 8 36 22 pm" src="https://user-images.githubusercontent.com/12591890/50719461-c1c07b00-1061-11e9-96f2-768c81458e24.png">

<img width="1440" alt="screen shot 2019-01-04 at 8 37 02 pm" src="https://user-images.githubusercontent.com/12591890/50719462-c1c07b00-1061-11e9-9f82-1a2af9ca3ba7.png">