microsoft / microsoft/TypeScript
Symbol properties should not be exempt from excess property checks in presence of a string index signature
Offen
@ahejlsberg arbeitet bereits daran.
Seit 28.6.2021.
Breaking Change
Bug
Domain: check: Excess Property Checking
Rescheduled
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.