Language-tools: ts__default$1.default.isTypeAssertionExpression is not a function (ts)

Created on 23 Nov 2020  路  2Comments  路  Source: sveltejs/language-tools

Describe the bug
after update to 1.1.15 svelte-check returns error on each svelte component

<component>.svelte:NaN:1
Error: ts__default$1.default.isTypeAssertionExpression is not a function (ts)

project builds and works ok, vscode shows no error

To Reproduce
npm upgrade && npx svelte-check

System (please complete the following information):

  • OS: Linux
  • IDE: VSCode
  • Plugin/Package: svelte+TS

Additional context

  "devDependencies": {
    "@rollup/plugin-commonjs": "^14.0.0",
    "@rollup/plugin-node-resolve": "^8.0.0",
    "@rollup/plugin-typescript": "^6.1.0",
    "@tsconfig/svelte": "^1.0.0",
    "rollup": "^2.33.3",
    "rollup-plugin-livereload": "^2.0.0",
    "rollup-plugin-svelte": "^6.1.1",
    "rollup-plugin-terser": "^7.0.0",
    "svelte": "^3.29.7",
    "svelte-check": "^1.1.15",
    "svelte-preprocess": "^4.6.1",
    "tslib": "^2.0.3",
    "typescript": "^3.9.7"
  }

Fixed bug

Most helpful comment

Try upgrading TypeScript to the latest version. It seems like the isTypeAssertionExpression function got added only recently to TypeScript, which we are using inside svelte2tsx.

Thanks. Problem solved :-)

All 2 comments

Try upgrading TypeScript to the latest version. It seems like the isTypeAssertionExpression function got added only recently to TypeScript, which we are using inside svelte2tsx.

@jasonlyu123 should we maybe fall back to using a "handcrafted" version of that function? As an alternative we can also just check for the existence of this function. It will "only" prevent people from getting the <any>foo to foo as any transformation. I think I'm slightly in favor of the latter solution. Edit: I chose the latter solution for a simple fix. If you think that's crap we can switch to the handcrafted function.

Try upgrading TypeScript to the latest version. It seems like the isTypeAssertionExpression function got added only recently to TypeScript, which we are using inside svelte2tsx.

Thanks. Problem solved :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matthewmueller picture matthewmueller  路  5Comments

PatrickG picture PatrickG  路  3Comments

vatro picture vatro  路  3Comments

koddr picture koddr  路  6Comments

NickKaramoff picture NickKaramoff  路  4Comments