microsoft / microsoft/TypeScript
TS3.6 regression: Map constructor overloads
Abierto
@rbuckton ya está trabajando en esto.
Desde el 26/9/2019.
Needs Investigation
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
TypeScript Version: 3.7.0-dev.20190917
Search Terms: Map constructor overload array concatenation
Code
const M1 = new Map([
['k', {a: 1, b: 'asd'}],
['k', {a: 2, b: 'asd'}],
]);
const M2 = new Map([
...M1,
['k', {a: 1}],
]);
Expected behavior:
Success, constructs a const M2: Map<string, {a: number;}>.
Actual behavior:
input.ts(6,20): error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '([string, { a: number; b: string; }] | [string, { a: number; }])[]' is not assignable to parameter of type 'readonly (readonly [string, { a: number; b: string; }])[]'.
Type '[string, { a: number; b: string; }] | [string, { a: number; }]' is not assignable to type 'readonly [string, { a: number; b: string; }]'.
Type '[string, { a: number; }]' is not assignable to type 'readonly [string, { a: number; b: string; }]'.
Types of property '1' are incompatible.
Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'.
Related Issues:
None found.
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.
Evaluación
Este issue todavía no se ha evaluado.