jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.2k stars 505 forks source link

Unable to build code containing TypeScript "named tuples" -- upgrade to TS 4 #1103

Closed dragonman225 closed 2 years ago

dragonman225 commented 2 years ago

Current Behavior

tsdx build failed with below error:

syntax error TS1005: ',' expected.

when building code containing "named tuples", like this:

/** Parameters that describe an arrow. */
export type ArrowDescriptor = [
  /** start point */
  sx: number,
  sy: number,
  /** control point for start point */
  c1x: number,
  c1y: number,
  /** control point for end point */
  c2x: number,
  c2y: number,
  /** end point */
  ex: number,
  ey: number,
  /** angle of end point */
  ae: number,
  /** angle of start point */
  as: number
]

the error pointed to the line sx: number,.

Expected behavior

tsdx build should build code containing "named tuples".

Suggested solution(s)

I guess there's something wrong in the rollup plugins tsdx is using. Probably upgrading them would fix.

Additional context

Staring from TypeScript 4.0, "named tuples" can be used to annotate parameters in an array.

Your environment

  System:
    OS: Linux 5.4 Manjaro Linux
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Memory: 447.06 MB / 15.48 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 15.14.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.7.6 - /usr/local/bin/npm
  Browsers:
    Chrome: Linux
    Chromium: 96.0.4664.45
    Firefox: 95.0
  npmPackages:
    tsdx: ^0.14.1 => 0.14.1 
    typescript: ^4.5.3 => 4.5.3 
  npmGlobalPackages:
    typescript: 4.0.8
agilgur5 commented 2 years ago

Staring from TypeScript 4.0

Duplicate of #926