microsoft / microsoft/TypeScript
noImplicitThis codefix should account for static functions
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.3k
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 132
Descripción
Search Terms
codefix static this noImplicitThis
Suggestion
If a function is used as the initializer of a static property declaration, should the type of its this added by the --noImplicitThis codefix include typeof?
See discussion in #31138.
Use Cases
Static methods are arguably more likely to be called with the static class as their this scope in common practice. This would more accurately reflect that behavior.
Examples
const returnThisMember = function ([| |]) {
return this.member;
}
class Container {
member = "sample";
static returnThisMember = returnThisMember;
};
Right now [| |] just becomes this: Container.
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
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
Comienza con el noImplicitThis codefix y la discusión en #31138; después, sigue cómo una función utilizada como inicializador de una propiedad estática recibe su tipo this. Usa el ejemplo de Container para verificar que el tipo sugerido tiene en cuenta el ámbito estático de la clase, incluido typeof cuando corresponda.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- compilers
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100