gajus / gajus/flow-runtime

Generics in function

Open
#94 2 comments 0 reactions 0 assignees View on GitHub
bug more-info-required
Dominant language
JavaScript
Stars
797
Forks
49
PR merge metrics
No merged PRs in 30d

Description

This is a: Bug Report

Which concerns: babel-plugin-flow-runtime

---

### What is the current behaviour?

```js
function throwIfNull(result: ?T): T {
if (result === null || result === undefined) {
throw error;
}
return result;
}
```

Outputs the following error:

```
ReferenceError: src/runner/validate-return-type.js: Reference to undeclared variable "T"
> 14 | function throwIfNull(result: ?T): T {
| ^
15 | if (result === null || result === undefined) {
16 | throw error;
17 | }
```

---

### What is the expected behaviour?

This should probably not really assert anything at runtime. I expect flow to use this, but probably not flow-runtime.

---

### Which package versions are you using?

0.10.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.