Enhance type definition for XMLParser `isArray` option when using TypeScript
Los mantenedores suelen responder en 4 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- javascript, typescript
- Área
- developer-experience
Línea de trabajo
Comienza con la definición de tipos de XMLParser para la opción isArray y compárala con el ejemplo vinculado de TypeScript Playground. Actualiza los tipos para que jPath true o undefined seleccione string y jPath false seleccione Matcher, y verifica que los usuarios de TypeScript ya no necesiten comprobaciones condicionales ni aserciones.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
- Are you running the latest version?
- Have you included sample input, output, error, and expected output?
- Have you checked if you are using correct configuration?
- Did you try online tool?
- Have you checked the docs for helpful APIs and examples?
Description
When creating an instance of XMLParser using the isArray option, the method arguments are currently defined as the following, with the jPathOrMatcher argument being either a string or Matcher type:
The behaviour as documented is that if the jPath option is set to true (or undefined since the default is true), then the type of jPathOrMatcher will be a string, and if jPath is false then the type of jPathOrMatcher will be a Matcher.
However, since the type of jPathOrMatcher is currently string | Matcher, to satisfy TypeScript I either have to add unnecessary conditional logic to check whether the type is string or Matcher, or add in a type assertion like (jPathOrMatcher as string).includes("blah").
I would like to propose updating the types so that it can smartly detect whether the jPath option is true or false, and set the type of isArray based on that. I've found that this can be achieved using union types, and I have a minimal working example using the TypeScript Playground:
Would you like to work on this issue?
- Yes
- No
Bookmark this repository for further updates. Visit SoloThought to know about recent features.
- Lenguaje dominante
- JavaScript
- Estrellas
- 3.1k
- Forks
- 398
- Merge medio
- 3 d 9 h
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la 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.
Más de NaturalIntelligence/fast-xml-parser
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
NaturalIntelligence/fast-xml-parser#890 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
NaturalIntelligence/fast-xml-parser#888 · 2 comentarios ·
Los mantenedores suelen responder en 4 días
-
ignoreDeclaration does not ignore lower case doctype declarationQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
NaturalIntelligence/fast-xml-parser#870 · 2 comentarios ·
Los mantenedores suelen responder en 4 días
-
CLI crashes with an uncaught exception when the input file is missingPosiblemente ocupada @troclaux la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
NaturalIntelligence/fast-xml-parser#894 · 3 comentarios ·
Los mantenedores suelen responder en 4 días
-
Numeric character references (A, A) are not decoded unless htmlEntities is enabledPosiblemente ocupada @guocn la tomó hace 6 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 64/100
NaturalIntelligence/fast-xml-parser#892 · 3 comentarios ·
Los mantenedores suelen responder en 4 días
Todos los issues de NaturalIntelligence/fast-xml-parser
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
glossyio/traffic-monitor#264 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
micromatch/picomatch#243 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
getComputedStyle().display is "" for span, a, b, label and other inline elements instead of "inline"Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
capricorn86/happy-dom#2556 ·
Los mantenedores suelen responder en 1 día