microsoft / microsoft/TypeScript
random error TS2345 type incompatible
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
TypeScript Version: 3.7.x-dev.201xxxxx
Search Terms:
Code
this._globPartsArray.forEach((g: IPartsPattern, idx) =>
{
// Use matches[idx + 1] because whole match is at index 0 of the array of matches
if (g === EnumWildcard.Asterisk || g === EnumWildcard.QuestionMark)
{
this._groups.push(Object.freeze({
type: EnumPartsAstType.wildcard,
pattern: g,
match: matches[idx + 1],
}));
}
else
{
this._groups.push(Object.freeze({
type: EnumPartsAstType.literal,
pattern: g,
match: matches[idx + 1],
}));
}
});
Expected behavior:
no error by random happen
Actual behavior:
bandicam 2020-07-23 09-49-14-211.zip
Error:(143, 23) TS2345: Argument of type 'Readonly<{ type: EnumPartsAstType; pattern: string; match: string; }>' is not assignable to parameter of type 'Error | IAsterisk | IQuestionMark | ILiteral'.
Type 'Readonly<{ type: EnumPartsAstType; pattern: string; match: string; }>' is not assignable to type 'ILiteral'.
Types of property 'type' are incompatible.
Type 'EnumPartsAstType' is not assignable to type 'EnumPartsAstType.literal'.
Playground Link:
Related Issues:
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.
Direzione di ricerca
Iniziare riproducendo l'errore di packages/@lazy-glob/rename/lib/util/globGroupsCollection.ts alle righe 130-149 con la versione segnalata di TypeScript 3.7.x-dev e con una versione attuale. Esaminare il tipo inferito dell'oggetto passato a _groups.push e determinare se la diagnostica è riproducibile; il completamento richiede una riproduzione minima oppure un difetto del compilatore confermato con un test appropriato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 18/100