Better Typing for `forwardRef` and `resolveForwardRef`
- Dominant language
- TypeScript
- Stars
- 101k
- Forks
- 27.5k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 288
Description
We have a fix but wanted to make sure a pull request for `forwardRef` would be accepted. It's marked as`@experimental`, are there any plans to change it?
**I'm submitting a ...** (check one with "x")
```
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
```
**Current behavior**
When using `forwardRef` and `resolveForwardRef`, types will not be tracked.
```
class MyType {}
let myForwardRef = forwardRef(() => MyType);
resolveForwardRef(myForwardRef) //=> any
```
**Expected behavior**
```
class MyType {}
let myForwardRef = forwardRef(() => MyType);
resolveForwardRef(myForwardRef) //=> MyType
```
**Reproduction of the problem**
Just import `forwardRef` and `resolveForwardRef` and observe the types in a supporting editor
**What is the motivation / use case for changing the behavior?**
To keep code type-safe and tooling effective
**Please tell us about your environment:**
MacOS Sierra 10.12, VSCode
- **Angular version:** 2.0.0-rc.7
- **Browser:** N/A
- **Language:** TypeScript 2.0.2
- **Node (for AoT issues):** N/A
Contributor guide
Research direction
Start by importing `forwardRef` and `resolveForwardRef` in a TypeScript 2.0.2 project and observing their inferred types in a supporting editor. Done means the `forwardRef` example resolves to `MyType` rather than `any`, while preserving type safety.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100