microsoft / microsoft/TypeScript

Symbol properties should not be exempt from excess property checks in presence of a string index signature

Aperta
#44,794 4 commenti 2 reazioni 1 assegnatario Vedi su GitHub

@ahejlsberg ci sta già lavorando.

Dal 28/6/2021.

Breaking Change Bug Domain: check: Excess Property Checking Rescheduled
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

In #44793, we found that a symbol index signature doesn't turn off excess property checks on symbols; however, a string index signature turns these excess property checks entirely.

interface A {
    a?: string
    b?: number
    [key: string]: unknown
}

const symbolKey = Symbol('key')

const a: A = {
    [symbolKey]: '123', // works!
}

It's likely that some users relied on this behavior; however, those users will be able to use symbol index signatures in TypeScript 4.4.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.