microsoft / microsoft/TypeScript

random error TS2345 type incompatible

Abierto
#39,711 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Needs Investigation
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

TypeScript Version: 3.7.x-dev.201xxxxx

Search Terms:

Code

https://github.com/bluelovers/ws-glob/blob/fa6b1f033b353065dda276e524c680a81ee8c36d/packages/%40lazy-glob/rename/lib/util/globGroupsCollection.ts#L130-L149

		this._globPartsArray.forEach((g: IPartsPattern, idx) =>
		{
			// Use matches[idx + 1] because whole match is at index 0 of the array of matches
			if (g === EnumWildcard.Asterisk || g === EnumWildcard.QuestionMark)
			{
				this._groups.push(Object.freeze({
					type: EnumPartsAstType.wildcard,
					pattern: g,
					match: matches[idx + 1],
				}));
			}
			else
			{
				this._groups.push(Object.freeze({
					type: EnumPartsAstType.literal,
					pattern: g,
					match: matches[idx + 1],
				}));
			}
		});

Expected behavior:

no error by random happen

Actual behavior:

bandicam 2020-07-23 09-49-14-211.zip

Error:(143, 23) TS2345: Argument of type 'Readonly<{ type: EnumPartsAstType; pattern: string; match: string; }>' is not assignable to parameter of type 'Error | IAsterisk | IQuestionMark | ILiteral'.
  Type 'Readonly<{ type: EnumPartsAstType; pattern: string; match: string; }>' is not assignable to type 'ILiteral'.
    Types of property 'type' are incompatible.
      Type 'EnumPartsAstType' is not assignable to type 'EnumPartsAstType.literal'.

Playground Link:

Related Issues:

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comience reproduciendo el error de packages/@lazy-glob/rename/lib/util/globGroupsCollection.ts en las líneas 130-149 con la versión de TypeScript 3.7.x-dev indicada y con una versión actual. Inspeccione el tipo inferido del objeto pasado a _groups.push y determine si el diagnóstico es reproducible; la tarea requiere una reproducción mínima o un defecto confirmado del compilador con una prueba adecuada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
compilers
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
18/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.