Skip to content

tsc crashes when decorating negative number literal fields #29329

Closed
@yanche

Description

@yanche

Crash stack looks like this
Error: Debug Failure. Unexpected node.
Node 202 was unexpected.
at serializeTypeNode ($PATH\node_modules\typescript\lib\tsc.js:56506:45)

TypeScript Version: 3.3.0-dev.20190108

Search Terms:
decorat; negative; number literal
Code

class A {
    @decorator
    public field1: -1 = -1;
}
function decorator(target: any, field: any) {}
{
  "compilerOptions": {
    "target": "es5",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}

Expected behavior:
tsc should not crash in any input

Actual behavior:
tsc crashes in above sample typescript

Playground Link: No, just compile the above ts you will repro the crash easily

Related Issues: No

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions