microsoft / microsoft/TypeScript
Undocumented = operator syntax in Generic Constraining
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
In the declaration file for Fastify (https://github.com/fastify/fastify/blob/master/fastify.d.ts) there is some TypeScript code I do not recognize and cannot find another example of in the TypeScript documentation:
declare function fastify<
HttpServer extends (http.Server | http2.Http2Server) = http.Server,
HttpRequest extends (http.IncomingMessage | http2.Http2ServerRequest) = http.IncomingMessage,
HttpResponse extends (http.ServerResponse | http2.Http2ServerResponse) = http.ServerResponse
>(opts?: fastify.ServerOptions): fastify.FastifyInstance<HttpServer, HttpRequest, HttpResponse>;
I recognize the Generic constraint syntax with the extends keyword, but what about the = http.Server part? Is this like a default parameter or something?
Whatever this syntax means it should be better documented.
I tried googling for this syntax by searching
typescript generic constrainttypescript generic constraint assignmenttypescript generic defaults
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 leyendo la declaración genérica en fastify.d.ts de Fastify y compara su sintaxis de restricción y valor predeterminado con las búsquedas de la documentación de TypeScript indicadas en el issue. Documenta qué significan las partes = http.Server y añade un ejemplo o una explicación en la documentación de TypeScript correspondiente; se considera terminado cuando los recién llegados pueden encontrar y entender esta sintaxis.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- documentation
- Tipo de issue
- Documentación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100