Skip to content

code compiles error in D3 with typescript v2.5.x #18406

Closed
@musicq

Description

@musicq

TypeScript Version: 2.5.x

Code

// snippet
  return s.length < 2 ? (q[0]
    ? one(q[0].x)
    : zero(b))
    : (b = q.length, function(t) {
        for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
        return s.join("");
      });
  };

Expected behavior:
Compile correc.
Actual behavior:
Both in javascript and typescript, it reports error when compile

ERROR in [at-loader] ./apps/home/js/lib/d3.js:2567:25
    TS1005: '=' expected.

ERROR in [at-loader] ./apps/home/js/lib/d3.js:2570:7
    TS8010: 'types' can only be used in a .ts file.

ERROR in [at-loader] ./apps/home/js/lib/d3.js:2570:22
    TS1138: Parameter declaration expected.

ERROR in [at-loader] ./apps/home/js/lib/d3.js:2570:34
    TS1005: '=>' expected.

ERROR in [at-loader] ./apps/home/js/lib/d3.js:2573:8
    TS1005: ':' expected.

ERROR in [at-loader] ./apps/home/js/lib/d3.js:2573:9
    TS1005: ')' expected.

ERROR in [at-loader] ./apps/home/js/lib/d3.js:2574:1
    TS1128: Declaration or statement expected.

ERROR in [at-loader] ./apps/home/js/lib/d3.js:16405:1
    TS1128: Declaration or statement expected.

ERROR in [at-loader] ./apps/home/js/lib/d3.js:16405:2
    TS1128: Declaration or statement expected.

ERROR in [at-loader] ./apps/home/js/lib/d3.js:16405:3
    TS1128: Declaration or statement expected.

ERROR in [at-loader] ./apps/home/js/lib/d3.js:16405:4
    TS1128: Declaration or statement expected.

This happens only in v2.5.x, with 2.4.x, it works fine.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions