Skip to content

Invalid code emitted when function argument is explicitly typed as null or undefined #11645

@ghost

Description

TypeScript Version: nightly (Version 2.1.0-dev.20161011)

Code

// A *self-contained* demonstration of the problem follows.
// Ditto for null, haven't tested with 'never' ...
function foo(value: undefined) {
  return value;
}

Expected behavior:
Should produce syntactically valid JavaScript.

Actual behavior:
Instead this is emitted by the compiler:

function foo(value: ) {
    return value;
}

resulting in runtime error:

function foo(value: ) {
                  ^
SyntaxError: Unexpected token :

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: TransformsRelates to the public transform APIFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions