Traducir archivo /src/topics/merge.js de JavaScript a TypeScript#58
Open
rebeca1012 wants to merge 1 commit intoUSB-CI3715:f24from
Open
Traducir archivo /src/topics/merge.js de JavaScript a TypeScript#58rebeca1012 wants to merge 1 commit intoUSB-CI3715:f24from
rebeca1012 wants to merge 1 commit intoUSB-CI3715:f24from
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Este Pull Request resuelve el Issues #15 (fixes #15), cuyo propósito era traducir el archivo /src/topics/merge.js de JavaScript a TypeScript.
Los cambios principales fueron:
Adición de interfaces:
TopicsTypepara definir la estructura y los métodos del objetoTopics.MergeOptionspara definir las opciones del métodomerge.Tipado de funciones:
this: TopicsTypeen las funciones para especificar el tipo dethis.Cambios en la estructura del módulo:
topicsModule.module.exports = topicsModule;al final del archivo.Tipado de variables:
(count: number, topic: any)en la funciónupdateViewCount.Cambios en la llamada a funciones:
createNewTopic.call(this, ...)yupdateViewCount.call(this, ...)para mantener el contexto correcto dethis.Optimizaciones menores:
Math.min.apply(null, tids)porMath.min(...tids)enfindOldestTopic.Manejo de errores:
fireHookpara manejar posibles errores en los hooks de plugins.Conversiones de tipo:
tid.toString()yparseInt(..., 10)donde era necesario para asegurar tipos correctos.Mantenimiento de 'use strict':
'use strict';al principio del archivo, aunque generalmente no es necesaria en TypeScript.Mantenimiento de importaciones CommonJS:
require().