majestic
majestic copied to clipboard
[Bug] Majestic fails on Typescript generics
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.
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
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
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.