parcel: @parcel/transformer-typescript-types: Debug Failure. Unhandled SyntaxKind: ImportClause.

@parcel-bundler

๐ŸŽ› Configuration

package.json

{
    "source": "source/index.ts",
    "types": "dist/index.d.ts",
    "module": "dist/index.esm.js",
    "main": "dist/index.js",
    "dependencies": {
        "@swc/helpers": "^0.4.11",
        "class-validator": "^0.13.2",
        "koajax": "^0.8.1",
        "reflect-metadata": "^0.1.13",
        "regenerator-runtime": "^0.13.9",
        "web-utility": "^3.9.2"
    },
    "peerDependencies": {
        "mobx": ">=4 <6"
    },
    "devDependencies": {
        "@parcel/packager-ts": "^2.7.0",
        "@parcel/transformer-typescript-types": "^2.7.0",
        "@types/node": "^14.18.26",
        "dotenv": "^16.0.1",
        "mobx": "^5.15.7",
        "parcel": "^2.7.0",
        "typescript": "~4.8.2"
    },
    "browserslist": "> 0.5%, last 2 versions, not dead, IE 11",
    "targets": {
        "main": {
            "optimize": true
        }
    },
    "scripts": {
        "build": "rm -rf dist/ docs/  &&  parcel build"
    }
}

tsconfig.json

{
    "compilerOptions": {
        "target": "ES5",
        "module": "ES6",
        "moduleResolution": "Node",
        "esModuleInterop": true,
        "downlevelIteration": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "skipLibCheck": true,
        "lib": ["ES2022", "DOM", "DOM.Iterable"]
    },
    "include": ["source/*"]
}

๐Ÿค” Expected Behavior

Build TS libraries with typescript@^4.8.0 successfully.

๐Ÿ˜ฏ Current Behavior

Throw an error with typescript@4.8.2:

@parcel/transformer-typescript-types: Debug Failure. Unhandled SyntaxKind: ImportClause.

but succeed with typescript@^4.7.0.

๐Ÿ’ Possible Solution

Support ImportClause Syntax Kind.

๐Ÿ’ป Code Sample

idea2app/MobX-RESTful#6

๐ŸŒ Your Environment

Software Version(s)
Parcel 2.7.0
Node 14.19.1
PNPM 7.9.5
Operating System Windows 10 Pro 21H2

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 9
  • Comments: 18 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Using the package-lock.json or yarn.lock to pin a dependency version is abusive and dangerous. An acceptable workaround is to use yarns โ€œresolutionsโ€ field. For example in your (root when using workspaces) package.json file:

"resolutions": {
   "typescript": "~4.7"
}

@levino I think thereโ€™re Interface Breaking Changes between TS 4.7 and 4.8, which needs Parcel to adapt.

Lets continue this conversation in your repo.

If I recall I have tried resolutions but ts 4.8 still got in through from another project in the monorepo.

When yarn list showed TS 4.8 in the root project and 4.7 in the leaf project, Parcel still got 4.8. Gotta fight the module resolution a bit.

Hi @devongovett , could you plz. suggest the solution to this issue. I am using pnpm workspace and TS 4.8.4, also tried the above suggestion and downgraded the TS to 4.7 still got the same issue.