microsoft / microsoft/TypeScript
Property is not assignable to the same property in generic base type
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
### 🔎 Search Terms
Property is not assignable to the same property in generic base type
### 🕗 Version & Regression Information
-This is the behavior in every version I tried, and I reviewed
### ⏯ Playground Link
https://www.typescriptlang.org/zh/play/?ts=5.8.3#code/IYIwzgLgTsDGEAJYBthjAgSgCwPYIG8AoBBUSGeBABwEsATAc1oDswAeAMQH0BRBAKYAPCAJb0MLAK4BbEAKgAaBDwBSAPgAUIKFLABHKQMgAuFd1UIAPud4BKM2uu2A3EQC+RFGgwAhZFIAZoEKgiJiElh4hCQ0DMxsXHxhouKSsvJK5hraugZGptnOPPaOFsXJscSkpFACEFJQLKQ6eobGEG6knp5AA
### 💻 Code
```ts
abstract class Rho {
abstract pidgins(brusquest: F_J | F_E): F_J | F_E;
}
class Bluffer extends Rho {
pidgins(brusquest: F_J | F_E): F_J | F_E
{
return brusquest;
}
}
```
### 🙁 Actual behavior
Property 'pidgins' in type 'Bluffer' is not assignable to the same property in base type 'Rho'.
Type '(brusquest: F_E | F_J) => F_E | F_J' is not assignable to type '(brusquest: F_E | F_J) => F_E | F_J'. Two different types with this name exist, but they are unrelated.
Type 'number | F_E | F_J' is not assignable to type 'F_E | F_J'.
Type 'number' is not assignable to type 'F_E | F_J'.(2416)
### 🙂 Expected behavior
No error
### Additional information about the issue
The following works with no error:
```
abstract class Rho {
abstract pidgins(brusquest: F_J | F_E): F_J | F_E;
abstract pidgins(brusquest: F_J | F_E): F_J | F_E;
}
class Bluffer extends Rho {
pidgins(brusquest: F_J | F_E): F_J | F_E
{
return brusquest;
}
}
```
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
Inizia riproducendo l’esempio dal TypeScript Playground collegato e confronta il metodo generico in Rho con l’implementazione in Bluffer. Traccia il percorso del controllo dei tipi per la compatibilità dei metodi generici; il lavoro è completato quando la riproduzione non segnala errori senza compromettere il comportamento di assegnabilità correlato.
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
- Abbastanza chiara
- Idoneità per principianti
- 35/100