facebook / facebook/flow

Consider dropping empty type parameter list with default params

Aperta
#4,857 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
feature request
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Currently if you have a type with a param that has a default:

```js
type Foo = {};
```

You are required to add `<>` even when you want to add that default:

```js
type Bar1 = Foo; // error
type Bar2 = Foo<>; // works
```

It's not been intuitive in my experience, and syntactically it's not obvious this is necessary.

In the AST, all this adds is an empty `TypeParameterInstantiation` inside of the existing `GenericTypeAnnotation`.

When resolving the generic, I'm wondering if Flow could treat the plain GenericTypeAnnotation as having a TypeParameterInstantiation when the targeted type doesn't require any type params to be provided

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.