microsoft / microsoft/TypeScript
Variadic tuple constraint incoherent ?
Aperta
@ahejlsberg ci sta già lavorando.
Dal 23/7/2020.
Awaiting More Feedback
Suggestion
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
TypeScript Version: 4.0.0-dev.20200722
Search Terms:
Variadic tuple
Variadic tuple constraint
Code
type A<GArgs extends [number, string, ...any[]]> = true;
type B<GArgs extends [string, ...any[]]> = A<[number, ...GArgs]>; // ERROR
type C = A<[number, ...[string, ...any[]]]>; // OK
Actual / Expected behavior:
On the type B we get an error:
TS2344: Type '[number, ...GArgs]' does not satisfy the constraint '[number, string, ...any[]]'. Element at index 1 is variadic in one type but not in the other
Sounds incorrect because on B, GArgs is properly shaped to be just like in C
Related Issues:
The variadic issues are a big jungle, and I was not able to find any related issue (but probably some exists?)
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.