microsoft / microsoft/TypeScript
Semantic highlighting: Non-explicit readonly properties not shown as such
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
🔎 Search Terms
readonly, readonly properties
🕗 Version & Regression Information
Nothing to put in here, has never worked, I don't think.
Might be a language server issue, idk
⏯ Playground Link
💻 Code
In this example, there are 4 variables, all with a readonly property called abcdef, only the first one is registered by the IDE as being readonly, even though they are.
declare const a: {
readonly abcdef: number
}
a.abcdef
declare const b: Readonly<{
abcdef: number
}>
b.abcdef
declare const c: { readonly abcdef: true } | { readonly abcdef: false }
c.abcdef
if (c.abcdef) {
c.abcdef
}
class D {
get abcdef() {
return 1
}
}
declare const d: D
d.abcdef
🙁 Actual behavior
This is an IDE issue regarding code highlighting. When a property is readonly, but not explicitly so, it doesn't show up as a readonly property. TypeScript knows it's readonly, but the syntax highlighting doesn't always match it, which can be a bit confusing, just like if consts didn't always have the different highlighting. It's a lot nicer when you can always immediatly tell when something is readony, not by having to test it out and it makes it a lot more readable.
🙂 Expected behavior
All the properties should be registered as readonly, in the case of VSCode, the same colour as constants
Additional information about the issue
No response
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduce el comportamiento del resaltado semántico utilizando el ejemplo enlazado de TypeScript Playground e inspecciona el resaltado correspondiente en VSCode. Compara los cuatro casos de propiedades readonly, incluidos Readonly, las uniones y el getter, y considera el issue completado cuando todas las propiedades readonly se resalten de forma coherente según lo esperado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- tooling
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100