majestic icon indicating copy to clipboard operation
majestic copied to clipboard

[Bug] Majestic fails on Typescript generics

Open dylanwatsonsoftware opened this issue 5 years ago • 3 comments

Is this a bug report or a feature request?

Bug

Version Info

  • Version of Majestic: 1.2.23
  • Version of Jest: 24.5.0
  • Version of Node: 8.11.2
  • Operating System: Windows

Reproduction Repo

https://github.com/lotsabackscatter/majestic-generics-bug/tree/master

Can be easily reproduced to a single typescript test that contains generics.

This appears to be because Majestic confuses TS generics with JSX.

dylanwatsonsoftware avatar Apr 02 '19 05:04 dylanwatsonsoftware

Thanks for the example repo. We use babel to parse the files and is it a known issue with babel?

https://babeljs.io/en/repl#?babili=false&browsers=&build=&builtIns=false&spec=false&loose=false&code_lz=CYUwzgxgTglgRiAFAcgOIgHYlhMACAIQFcBzZAGj0QEo8BeAPjwG8AoVvPGAFxTAAsA9kQA2wPAAcAhmHzd-IPN3DcKVWoxYdOeCIIxhueAGZSA1iACSGZVHp4APNdumIIAIIM2OncZggxdwAuPGQ4ESl-ZG1OAF8AbnYfEAAPCRAIXlMLZ2wAOj8A4HdqPO5BAiQwiKjqbVjqRIbE1hgbbFdFXKhO9y1OQsCQw1gMEkSB_zECYe5R8dZY1iA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=typescript&prettier=false&targets=&version=7.4.2

Raathigesh avatar Apr 02 '19 10:04 Raathigesh

If I add the @babel/plugin-syntax-typescript, then it seems to work: https://babeljs.io/en/repl#?babili=false&browsers=&build=&builtIns=false&spec=false&loose=false&code_lz=CYUwzgxgTglgRiAFAcgOIgHYlhMACAIQFcBzZAGj0QEo8BeAPjwG8AoVvPGAFxTAAsA9kQA2wPAAcAhmHzd-IPN3DcKVWoxYdOeCIIxhueAGZSA1iACSGZVCn08AHmu3TEEAEEGbHTuMwQMQ8ALjxkOBEpfmRtTgBfAG52XxAADwkQCF5TCxdsADp_QOAPanzuQQIkcMjo6m046iTGpNYYG2w3RTyoLo8tTiKg0MNYDBIkwYCxAhHuMYnWONYgA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=true&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=es2015%2Ctypescript&prettier=false&targets=&version=7.4.2

dylanwatsonsoftware avatar Apr 03 '19 04:04 dylanwatsonsoftware

Right. I wonder if we could pass additional plugins to https://babeljs.io/docs/en/babel-parser since that's what we use to parse. Will have to look into it.

Raathigesh avatar Apr 03 '19 12:04 Raathigesh