Skip to content

spurious type errors involving maps #1932

Open
@johnw42

Description

@johnw42

When compiling this code (with --language_in=ES6_STRICT)...

/**
 * @param {Map<KEY,VALUE>} map
 * @template KEY, VALUE
 */
const foo = function(map) {
};

/**
 * @param {Map<string, number>} map
 */
const bar = function(map) {
  foo(map);
};

...I get this warning:

test.js:12: WARNING - actual parameter 1 of foo does not match formal parameter
found   : (Map<string,number>|null)
required: (Map<(number|string),(number|string)>|null)
  foo(map);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions