TypeScriptでダイヤモンド演算子で型指定した時に “Parse error on arrow function with type parameters” というエラーがでる問題の解消方法

dorayakikun
1 min readDec 26, 2018

--

TLDR

以下のようにjsxの設定を無効化すれば解消できます。

"parserOptions": {
"ecmaFeatures": {
"jsx": false
}
}

なぜか

ダイヤモンド演算子で囲った場合、時々それが型の指定なのかJSX要素なのか曖昧になってしてしまい正しくパースできないことが原因のようです。詳細は以下のイシューを参考にしてください。

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

dorayakikun
dorayakikun

Written by dorayakikun

Flag of Japan he/him. Web Developer. A founder of the http://rust.tokyo . An organizer of http://RustFest.global . All my own views.

No responses yet

Write a response