microsoft / microsoft/TypeScript
Syntax error in a union type which contains a callback type
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.3k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
TypeScript Version: 3.8.3
Search Terms:
- algebraic data types
Expected behavior:
Both b and c definitions are correct
Actual behavior:
Syntax errors:

Texts of errors (from left to right)
Exported variable 'c' has or is using private name ''.(4025)
Type expected.(1110)
';' expected.(1005)
'(' expected.(1005)
Related Issues:
Code
type ArrFunc = () => Array<number>;
let b: Array<number> | number | ArrFunc;
let c: Array<number> | number | () => Array<number>;
Output
"use strict";
let b;
let c;
Array();
Compiler Options
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"useDefineForClassFields": false,
"alwaysStrict": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"downlevelIteration": false,
"noEmitHelpers": false,
"noLib": false,
"noStrictGenericChecks": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"esModuleInterop": true,
"preserveConstEnums": false,
"removeComments": false,
"skipLibCheck": false,
"checkJs": false,
"allowJs": false,
"declaration": true,
"experimentalDecorators": false,
"emitDecoratorMetadata": false,
"target": "ES2017",
"module": "ESNext"
}
}
Playground Link: Provided
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
Reproduce los errores de sintaxis informados con las definiciones de TypeScript proporcionadas para b y c, utilizando el Playground enlazado o la versión indicada de TypeScript 3.8.3. Compara el tipo de callback directo en c con la forma ArrFunc con nombre en b; la tarea está terminada cuando ambas definiciones compilan sin los errores informados y el comportamiento existente del compilador sigue estando cubierto por una prueba de regresión.
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
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100